public interface StompClientConnection
StompClientConnection
, that let
send and receive STOMP frames.Modifier and Type | Method and Description |
---|---|
Future<Frame> |
abort(String id)
Aborts a transaction.
|
StompClientConnection |
abort(String id,
Handler<AsyncResult<Frame>> receiptHandler)
Aborts a transaction.
|
Future<Frame> |
abort(String id,
Map<String,String> headers)
Aborts a transaction.
|
StompClientConnection |
abort(String id,
Map<String,String> headers,
Handler<AsyncResult<Frame>> receiptHandler)
Aborts a transaction.
|
Future<Frame> |
ack(String id)
Sends an acknowledgement for a specific message.
|
StompClientConnection |
ack(String id,
Handler<AsyncResult<Frame>> receiptHandler)
Sends an acknowledgement for a specific message.
|
Future<Frame> |
ack(String id,
String txId)
Sends an acknowledgement for the given frame.
|
StompClientConnection |
ack(String id,
String txId,
Handler<AsyncResult<Frame>> receiptHandler)
Sends an acknowledgement for the given frame.
|
Future<Frame> |
beginTX(String id)
Begins a transaction.
|
StompClientConnection |
beginTX(String id,
Handler<AsyncResult<Frame>> receiptHandler)
Begins a transaction.
|
Future<Frame> |
beginTX(String id,
Map<String,String> headers)
Begins a transaction.
|
StompClientConnection |
beginTX(String id,
Map<String,String> headers,
Handler<AsyncResult<Frame>> receiptHandler)
Begins a transaction.
|
void |
close()
Closes the connection without sending the
DISCONNECT frame. |
StompClientConnection |
closeHandler(Handler<StompClientConnection> handler)
Sets a handler notified when the STOMP connection is closed.
|
Future<Frame> |
commit(String id)
Commits a transaction.
|
StompClientConnection |
commit(String id,
Handler<AsyncResult<Frame>> receiptHandler)
Commits a transaction.
|
Future<Frame> |
commit(String id,
Map<String,String> headers)
Commits a transaction.
|
StompClientConnection |
commit(String id,
Map<String,String> headers,
Handler<AsyncResult<Frame>> receiptHandler)
Commits a transaction.
|
StompClientConnection |
connectionDroppedHandler(Handler<StompClientConnection> handler)
Sets a handler notified when the server does not respond to a
ping request in time. |
Future<Frame> |
disconnect()
Disconnects the client.
|
Future<Frame> |
disconnect(Frame frame)
Disconnects the client.
|
StompClientConnection |
disconnect(Frame frame,
Handler<AsyncResult<Frame>> receiptHandler)
Disconnects the client.
|
StompClientConnection |
disconnect(Handler<AsyncResult<Frame>> receiptHandler)
Disconnects the client.
|
StompClientConnection |
errorHandler(Handler<Frame> handler)
Sets a handler notified when an
ERROR frame is received by the client. |
StompClientConnection |
exceptionHandler(Handler<Throwable> exceptionHandler)
Configures the exception handler notified upon TCP-level errors.
|
boolean |
isConnected()
Returns whether or not the `CONNECTED` frame has been receive meaning that the Stomp connection is established.
|
Future<Frame> |
nack(String id)
Sends a non-acknowledgement for the given message.
|
StompClientConnection |
nack(String id,
Handler<AsyncResult<Frame>> receiptHandler)
Sends a non-acknowledgement for the given message.
|
Future<Frame> |
nack(String id,
String txId)
Sends a non-acknowledgement for the given frame.
|
StompClientConnection |
nack(String id,
String txId,
Handler<AsyncResult<Frame>> receiptHandler)
Sends a non-acknowledgement for the given frame.
|
StompClientConnection |
pingHandler(Handler<StompClientConnection> handler)
Sets a handler that let customize the behavior when a ping needs to be sent to the server.
|
StompClientConnection |
receivedFrameHandler(Handler<Frame> handler)
Configures a received handler that get notified when a STOMP frame is received by the client.
|
Future<Frame> |
send(Frame frame)
Sends the given frame to the server.
|
StompClientConnection |
send(Frame frame,
Handler<AsyncResult<Frame>> receiptHandler)
Sends the given frame to the server.
|
Future<Frame> |
send(Map<String,String> headers,
Buffer body)
Sends a
SEND frame to the server. |
StompClientConnection |
send(Map<String,String> headers,
Buffer body,
Handler<AsyncResult<Frame>> receiptHandler)
Sends a
SEND frame to the server. |
Future<Frame> |
send(String destination,
Buffer body)
Sends a
SEND frame to the server to the given destination. |
StompClientConnection |
send(String destination,
Buffer body,
Handler<AsyncResult<Frame>> receiptHandler)
Sends a
SEND frame to the server to the given destination. |
Future<Frame> |
send(String destination,
Map<String,String> headers,
Buffer body)
Sends a
SEND frame to the server to the given destination. |
StompClientConnection |
send(String destination,
Map<String,String> headers,
Buffer body,
Handler<AsyncResult<Frame>> receiptHandler)
Sends a
SEND frame to the server to the given destination. |
String |
server() |
String |
session() |
Future<String> |
subscribe(String destination,
Handler<Frame> handler)
Subscribes to the given destination.
|
StompClientConnection |
subscribe(String destination,
Handler<Frame> handler,
Handler<AsyncResult<String>> receiptHandler)
Subscribes to the given destination.
|
Future<String> |
subscribe(String destination,
Map<String,String> headers,
Handler<Frame> handler)
Subscribes to the given destination.
|
StompClientConnection |
subscribe(String destination,
Map<String,String> headers,
Handler<Frame> handler,
Handler<AsyncResult<String>> receiptHandler)
Subscribes to the given destination.
|
Future<Frame> |
unsubscribe(String destination)
Un-subscribes from the given destination.
|
StompClientConnection |
unsubscribe(String destination,
Handler<AsyncResult<Frame>> receiptHandler)
Un-subscribes from the given destination.
|
Future<Frame> |
unsubscribe(String destination,
Map<String,String> headers)
Un-subscribes from the given destination.
|
StompClientConnection |
unsubscribe(String destination,
Map<String,String> headers,
Handler<AsyncResult<Frame>> receiptHandler)
Un-subscribes from the given destination.
|
String |
version() |
StompClientConnection |
writingFrameHandler(Handler<Frame> handler)
Configures a handler notified when a frame is going to be written on the wire.
|
String session()
String version()
void close()
DISCONNECT
frame.disconnect()
,
disconnect(Handler)
String server()
Future<Frame> send(Map<String,String> headers, Buffer body)
SEND
frame to the server.headers
- the headers, must not be null
body
- the body, may be null
RECEIPT
frame associated with the sent frame has been receivedStompClientConnection send(Map<String,String> headers, Buffer body, Handler<AsyncResult<Frame>> receiptHandler)
SEND
frame to the server.headers
- the headers, must not be null
body
- the body, may be null
receiptHandler
- the handler invoked when the RECEIPT
frame associated with the
sent frame has been received. The handler receives the sent frame.StompClientConnection
Future<Frame> send(String destination, Buffer body)
SEND
frame to the server to the given destination. The message does not have any other header.destination
- the destination, must not be null
body
- the body, may be null
RECEIPT
frame associated with the sent frame has been receivedStompClientConnection send(String destination, Buffer body, Handler<AsyncResult<Frame>> receiptHandler)
SEND
frame to the server to the given destination. The message does not have any other header.destination
- the destination, must not be null
body
- the body, may be null
receiptHandler
- the handler invoked when the RECEIPT
frame associated with the
sent frame has been received. The handler receives the sent frame.StompClientConnection
Future<Frame> send(Frame frame)
frame
- the frameRECEIPT
frame associated with the sent frame has been receivedStompClientConnection send(Frame frame, Handler<AsyncResult<Frame>> receiptHandler)
frame
- the framereceiptHandler
- the handler invoked when the RECEIPT
frame associated with the
sent frame has been received. The handler receives the sent frame.StompClientConnection
Future<Frame> send(String destination, Map<String,String> headers, Buffer body)
SEND
frame to the server to the given destination.destination
- the destination, must not be null
body
- the body, may be null
headers
- the header. The destination
header is replaced by the value given to the destination
parameterRECEIPT
frame associated with the sent frame has been receivedStompClientConnection send(String destination, Map<String,String> headers, Buffer body, Handler<AsyncResult<Frame>> receiptHandler)
SEND
frame to the server to the given destination.destination
- the destination, must not be null
body
- the body, may be null
headers
- the header. The destination
header is replaced by the value given to the destination
parameterreceiptHandler
- the handler invoked when the RECEIPT
frame associated with the
sent frame has been received. The handler receives the sent frame.StompClientConnection
Future<String> subscribe(String destination, Handler<Frame> handler)
destination
- the destination, must not be null
handler
- the handler invoked when a message is received on the given destination. Must not be null
.RECEIPT
frame associated with the sent frame has been receivedStompClientConnection subscribe(String destination, Handler<Frame> handler, Handler<AsyncResult<String>> receiptHandler)
destination
- the destination, must not be null
handler
- the handler invoked when a message is received on the given destination. Must not be null
.receiptHandler
- the handler invoked when the RECEIPT
frame associated with the
subscription has been received. The handler receives the subscription id.StompClientConnection
Future<String> subscribe(String destination, Map<String,String> headers, Handler<Frame> handler)
destination
- the destination, must not be null
.headers
- the headers to configure the subscription. It may contain the ack
header to configure the acknowledgment policy. If the given set of headers contains the
id
header, this value is used as subscription id.handler
- the handler invoked when a message is received on the given destination. Must not be null
.RECEIPT
frame associated with the sent frame has been receivedStompClientConnection subscribe(String destination, Map<String,String> headers, Handler<Frame> handler, Handler<AsyncResult<String>> receiptHandler)
destination
- the destination, must not be null
headers
- the headers to configure the subscription. It may contain the ack
header to configure the acknowledgment policy. If the given set of headers contains the
id
header, this value is used as subscription id.handler
- the handler invoked when a message is received on the given destination. Must not be null
.receiptHandler
- the handler invoked when the RECEIPT
frame associated with the
subscription has been received. The handler receives the subscription id.StompClientConnection
Future<Frame> unsubscribe(String destination)
id
header).destination
- the destinationRECEIPT
frame associated with the sent frame has been receivedStompClientConnection unsubscribe(String destination, Handler<AsyncResult<Frame>> receiptHandler)
id
header).destination
- the destinationreceiptHandler
- the handler invoked when the RECEIPT
frame associated with the
un-subscription has been received. The handler receives the sent frame (UNSUBSCRIBE
).StompClientConnection
Future<Frame> unsubscribe(String destination, Map<String,String> headers)
id
header, the header value is used. Otherwise the destination is used.destination
- the destinationheaders
- the headersRECEIPT
frame associated with the sent frame has been receivedStompClientConnection unsubscribe(String destination, Map<String,String> headers, Handler<AsyncResult<Frame>> receiptHandler)
id
header, the header value is used. Otherwise the destination is used.destination
- the destinationheaders
- the headersreceiptHandler
- the handler invoked when the RECEIPT
frame associated with the
un-subscription has been received. The handler receives the sent frame (UNSUBSCRIBE
).StompClientConnection
StompClientConnection errorHandler(Handler<Frame> handler)
ERROR
frame is received by the client. The handler receives the ERROR
frame and a reference on the StompClientConnection
.handler
- the handlerStompClientConnection
StompClientConnection closeHandler(Handler<StompClientConnection> handler)
handler
- the handlerStompClientConnection
StompClientConnection connectionDroppedHandler(Handler<StompClientConnection> handler)
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.handler
- the handlerStompClientConnection
receiving the dropped connection.StompClientConnection pingHandler(Handler<StompClientConnection> handler)
handler
- the handlerStompClientConnection
StompClientConnection beginTX(String id, Handler<AsyncResult<Frame>> receiptHandler)
id
- the transaction id, must not be null
receiptHandler
- the handler invoked when the RECEIPT
frame associated with the
transaction begin has been processed by the server. The handler receives the sent frame
(BEGIN
).StompClientConnection
Future<Frame> beginTX(String id)
id
- the transaction id, must not be null
RECEIPT
frame associated with the sent frame has been receivedFuture<Frame> beginTX(String id, Map<String,String> headers)
id
- the transaction id, must not be null
headers
- additional headers to send to the server. The transaction
header is replaced by the value
passed in the @{code id} parameterRECEIPT
frame associated with the sent frame has been receivedStompClientConnection beginTX(String id, Map<String,String> headers, Handler<AsyncResult<Frame>> receiptHandler)
id
- the transaction id, must not be null
headers
- additional headers to send to the server. The transaction
header is replaced by the
value passed in the @{code id} parameterreceiptHandler
- the handler invoked when the RECEIPT
frame associated with the
transaction begin has been processed by the server. The handler receives the sent frame
(BEGIN
).StompClientConnection
Future<Frame> commit(String id)
id
- the transaction id, must not be null
RECEIPT
frame associated with the sent frame has been receivedStompClientConnection commit(String id, Handler<AsyncResult<Frame>> receiptHandler)
id
- the transaction id, must not be null
receiptHandler
- the handler invoked when the RECEIPT
frame associated with the
transaction commit has been processed by the server. The handler receives the sent frame
(COMMIT
).StompClientConnection
Future<Frame> commit(String id, Map<String,String> headers)
id
- the transaction id, must not be null
headers
- additional headers to send to the server. The transaction
header is replaced by the
value passed in the @{code id} parameterRECEIPT
frame associated with the sent frame has been receivedStompClientConnection commit(String id, Map<String,String> headers, Handler<AsyncResult<Frame>> receiptHandler)
id
- the transaction id, must not be null
headers
- additional headers to send to the server. The transaction
header is replaced by the
value passed in the @{code id} parameterreceiptHandler
- the handler invoked when the RECEIPT
frame associated with the
transaction commit has been processed by the server. The handler receives the sent frame
(COMMIT
).StompClientConnection
Future<Frame> abort(String id)
id
- the transaction id, must not be null
RECEIPT
frame associated with the sent frame has been receivedStompClientConnection abort(String id, Handler<AsyncResult<Frame>> receiptHandler)
id
- the transaction id, must not be null
receiptHandler
- the handler invoked when the RECEIPT
frame associated with the
transaction cancellation has been processed by the server. The handler receives the sent
frame (ABORT
).StompClientConnection
Future<Frame> abort(String id, Map<String,String> headers)
id
- the transaction id, must not be null
headers
- additional headers to send to the server. The transaction
header is replaced by the
value passed in the @{code id} parameterRECEIPT
frame associated with the sent frame has been receivedStompClientConnection abort(String id, Map<String,String> headers, Handler<AsyncResult<Frame>> receiptHandler)
id
- the transaction id, must not be null
headers
- additional headers to send to the server. The transaction
header is replaced by the
value passed in the @{code id} parameterreceiptHandler
- the handler invoked when the RECEIPT
frame associated with the
transaction cancellation has been processed by the server. The handler receives the sent
frame (ABORT
).StompClientConnection
Future<Frame> disconnect()
close()
method, this method send the DISCONNECT
frame to the
server.RECEIPT
frame associated with the sent frame has been receivedStompClientConnection disconnect(Handler<AsyncResult<Frame>> receiptHandler)
close()
method, this method send the DISCONNECT
frame to the
server.receiptHandler
- the handler invoked when the RECEIPT
frame associated with the
disconnection has been processed by the server. The handler receives the sent
frame (DISCONNECT
).StompClientConnection
Future<Frame> disconnect(Frame frame)
close()
method, this method send the DISCONNECT
frame to the
server. This method lets you customize the DISCONNECT
frame.frame
- the DISCONNECT
frame.RECEIPT
frame associated with the sent frame has been receivedStompClientConnection disconnect(Frame frame, Handler<AsyncResult<Frame>> receiptHandler)
close()
method, this method send the DISCONNECT
frame to the
server. This method lets you customize the DISCONNECT
frame.frame
- the DISCONNECT
frame.receiptHandler
- the handler invoked when the RECEIPT
frame associated with the
disconnection has been processed by the server. The handler receives the sent
frame (DISCONNECT
).RECEIPT
frame associated with the sent frame has been receivedFuture<Frame> ack(String id)
id
parameter is the message id received in the frame.id
- the message id of the message to acknowledgeRECEIPT
frame associated with the sent frame has been receivedStompClientConnection ack(String id, Handler<AsyncResult<Frame>> receiptHandler)
id
parameter is the message id received in the frame.id
- the message id of the message to acknowledgereceiptHandler
- the handler invoked when the RECEIPT
frame associated with the
acknowledgment has been processed by the server. The handler receives the sent
frame (ACK
).StompClientConnection
Future<Frame> nack(String id)
id
parameter is the message id received in the frame.id
- the message id of the message to acknowledgeRECEIPT
frame associated with the sent frame has been receivedStompClientConnection nack(String id, Handler<AsyncResult<Frame>> receiptHandler)
id
parameter is the message id received in the frame.id
- the message id of the message to acknowledgereceiptHandler
- the handler invoked when the RECEIPT
frame associated with the
non-acknowledgment has been processed by the server. The handler receives the sent
frame (NACK
).StompClientConnection
Future<Frame> ack(String id, String txId)
id
- the message id of the message to acknowledgetxId
- the transaction idRECEIPT
frame associated with the sent frame has been receivedStompClientConnection ack(String id, String txId, Handler<AsyncResult<Frame>> receiptHandler)
id
- the message id of the message to acknowledgetxId
- the transaction idreceiptHandler
- the handler invoked when the RECEIPT
frame associated with the
acknowledgment has been processed by the server. The handler receives the sent
frame (ACK
).StompClientConnection
Future<Frame> nack(String id, String txId)
id
- the message id of the message to acknowledgetxId
- the transaction idRECEIPT
frame associated with the sent frame has been receivedStompClientConnection nack(String id, String txId, Handler<AsyncResult<Frame>> receiptHandler)
id
- the message id of the message to acknowledgetxId
- the transaction idreceiptHandler
- the handler invoked when the RECEIPT
frame associated with the
non-acknowledgment has been processed by the server. The handler receives the sent
frame (NACK
).StompClientConnection
StompClientConnection receivedFrameHandler(Handler<Frame> 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.
handler
- the handlerStompClientConnection
StompClientConnection writingFrameHandler(Handler<Frame> handler)
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.
handler
- the handlerStompClientConnection
StompClientConnection exceptionHandler(Handler<Throwable> exceptionHandler)
exceptionHandler
- the handlerStompClientConnection
boolean isConnected()
true
if the connection is established, false
otherwiseCopyright © 2024 Eclipse. All rights reserved.