vertx / io.vertx.ext.stomp / StompClientConnection

# StompClientConnection

`interface StompClientConnection`

Once a connection to the STOMP server has been made, client receives a StompClientConnection, that let send and receive STOMP frames.

Author
Clement Escoffier

### Functions

abort | `abstract fun abort(id: String): StompClientConnection` `abstract fun abort(id: String, receiptHandler: Handler<Frame>): StompClientConnection` `abstract fun abort(id: String, headers: MutableMap<String, String>): StompClientConnection` `abstract fun abort(id: String, headers: MutableMap<String, String>, receiptHandler: Handler<Frame>): StompClientConnection` Aborts a transaction.
ack | `abstract fun ack(id: String): StompClientConnection` `abstract fun ack(id: String, receiptHandler: Handler<Frame>): StompClientConnection` Sends an acknowledgement for a specific message. It means that the message has been handled and processed by the client. The `id` parameter is the message id received in the frame. `abstract fun ack(id: String, txId: String): StompClientConnection` `abstract fun ack(id: String, txId: String, receiptHandler: Handler<Frame>): StompClientConnection` Sends an acknowledgement for the given frame. It means that the frame has been handled and processed by the client. The sent acknowledgement is part of the transaction identified by the given id.
beginTX | `abstract fun beginTX(id: String, receiptHandler: Handler<Frame>): StompClientConnection` `abstract fun beginTX(id: String): StompClientConnection` `abstract fun beginTX(id: String, headers: MutableMap<String, String>): StompClientConnection` `abstract fun beginTX(id: String, headers: MutableMap<String, String>, receiptHandler: Handler<Frame>): StompClientConnection` Begins a transaction.
close | `abstract fun close(): Unit` Closes the connection without sending the `DISCONNECT` frame.
closeHandler | `abstract fun closeHandler(handler: Handler<StompClientConnection>): StompClientConnection` Sets a handler notified when the STOMP connection is closed.
commit | `abstract fun commit(id: String): StompClientConnection` `abstract fun commit(id: String, receiptHandler: Handler<Frame>): StompClientConnection` `abstract fun commit(id: String, headers: MutableMap<String, String>): StompClientConnection` `abstract fun commit(id: String, headers: MutableMap<String, String>, receiptHandler: Handler<Frame>): StompClientConnection` Commits a transaction.
connectionDroppedHandler | `abstract fun connectionDroppedHandler(handler: Handler<StompClientConnection>): StompClientConnection` Sets a handler notified when the server does not respond to a `ping` request in time. In other words, this handler is invoked when the heartbeat has detected a connection failure with the server. The handler can decide to reconnect to the server.
disconnect | `abstract fun disconnect(): StompClientConnection` `abstract fun disconnect(receiptHandler: Handler<Frame>): StompClientConnection` Disconnects the client. Unlike the `#close()` method, this method send the `DISCONNECT` frame to the server. `abstract fun disconnect(frame: Frame): StompClientConnection` `abstract fun disconnect(frame: Frame, receiptHandler: Handler<Frame>): StompClientConnection` Disconnects the client. Unlike the `#close()` method, this method send the `DISCONNECT` frame to the server. This method lets you customize the `DISCONNECT` frame.
errorHandler | `abstract fun errorHandler(handler: Handler<Frame>): StompClientConnection` Sets a handler notified when an `ERROR` frame is received by the client. The handler receives the `ERROR` frame and a reference on the StompClientConnection.
exceptionHandler | `abstract fun exceptionHandler(exceptionHandler: Handler<Throwable>): StompClientConnection` Configures the exception handler notified upon TCP-level errors.
isConnected | `abstract fun isConnected(): Boolean` Returns whether or not the `CONNECTED` frame has been receive meaning that the Stomp connection is established.
nack | `abstract fun nack(id: String): StompClientConnection` `abstract fun nack(id: String, receiptHandler: Handler<Frame>): StompClientConnection` Sends a non-acknowledgement for the given message. It means that the message has not been handled by the client. The `id` parameter is the message id received in the frame. `abstract fun nack(id: String, txId: String): StompClientConnection` `abstract fun nack(id: String, txId: String, receiptHandler: Handler<Frame>): StompClientConnection` Sends a non-acknowledgement for the given frame. It means that the frame has not been handled by the client. The sent non-acknowledgement is part of the transaction identified by the given id.
pingHandler | `abstract fun pingHandler(handler: Handler<StompClientConnection>): StompClientConnection` Sets a handler that let customize the behavior when a ping needs to be sent to the server. Be aware that changing the default behavior may break the compliance with the STOMP specification.
receivedFrameHandler | `abstract fun receivedFrameHandler(handler: Handler<Frame>): StompClientConnection` Configures a received handler that get notified when a STOMP frame is received by the client. This handler can be used for logging, debugging or ad-hoc behavior. The frame can still be modified by the handler. Unlike `StompClient#receivedFrameHandler(Handler)`, the given handler won't receive the `CONNECTED` frame. If a received frame handler is set on the StompClient, it will be used by all clients connection, so calling this method is useless, except if you want to use a different handler.
send | `abstract fun send(headers: MutableMap<String, String>, body: Buffer): StompClientConnection` `abstract fun send(headers: MutableMap<String, String>, body: Buffer, receiptHandler: Handler<Frame>): StompClientConnection` Sends a `SEND` frame to the server. `abstract fun send(destination: String, body: Buffer): StompClientConnection` `abstract fun send(destination: String, body: Buffer, receiptHandler: Handler<Frame>): StompClientConnection` Sends a `SEND` frame to the server to the given destination. The message does not have any other header. `abstract fun send(frame: Frame): StompClientConnection` `abstract fun send(frame: Frame, receiptHandler: Handler<Frame>): StompClientConnection` Sends the given frame to the server. `abstract fun send(destination: String, headers: MutableMap<String, String>, body: Buffer): StompClientConnection` `abstract fun send(destination: String, headers: MutableMap<String, String>, body: Buffer, receiptHandler: Handler<Frame>): StompClientConnection` Sends a `SEND` frame to the server to the given destination.
server | `abstract fun server(): String`
session | `abstract fun session(): String`
subscribe | `abstract fun subscribe(destination: String, handler: Handler<Frame>): String` `abstract fun subscribe(destination: String, handler: Handler<Frame>, receiptHandler: Handler<Frame>): String` Subscribes to the given destination. This destination is used as subscription id. `abstract fun subscribe(destination: String, headers: MutableMap<String, String>, handler: Handler<Frame>): String` `abstract fun subscribe(destination: String, headers: MutableMap<String, String>, handler: Handler<Frame>, receiptHandler: Handler<Frame>): String` Subscribes to the given destination.
unsubscribe | `abstract fun unsubscribe(destination: String): StompClientConnection` `abstract fun unsubscribe(destination: String, receiptHandler: Handler<Frame>): StompClientConnection` Un-subscribes from the given destination. This method only works if the subscription did not specifies a subscription id (using the `id` header). `abstract fun unsubscribe(destination: String, headers: MutableMap<String, String>): StompClientConnection` `abstract fun unsubscribe(destination: String, headers: MutableMap<String, String>, receiptHandler: Handler<Frame>): StompClientConnection` Un-subscribes from the given destination. This method computes the subscription id as follows. If the given headers contains the `id` header, the header value is used. Otherwise the destination is used.
version | `abstract fun version(): String`
writingFrameHandler | `abstract fun writingFrameHandler(handler: Handler<Frame>): StompClientConnection` Configures a handler notified when a frame is going to be written on the wire. This handler can be used from logging, debugging. The handler can modify the received frame. If a writing frame handler is set on the StompClient, it will be used by all clients connection, so calling this method is useless, except if you want to use a different handler.