Package io.vertx.rxjava3.ext.stomp
Class StompClientConnection
- java.lang.Object
-
- io.vertx.rxjava3.ext.stomp.StompClientConnection
-
- All Implemented Interfaces:
RxDelegate
public class StompClientConnection extends Object implements RxDelegate
Once a connection to the STOMP server has been made, client receives aStompClientConnection
, that let send and receive STOMP frames. NOTE: This class has been automatically generated from theoriginal
non RX-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<StompClientConnection>
__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description StompClientConnection(StompClientConnection delegate)
StompClientConnection(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description io.reactivex.rxjava3.core.Single<Frame>
abort(String id)
Aborts a transaction.io.reactivex.rxjava3.core.Single<Frame>
abort(String id, Map<String,String> headers)
Aborts a transaction.io.reactivex.rxjava3.core.Single<Frame>
ack(String id)
Sends an acknowledgement for a specific message.io.reactivex.rxjava3.core.Single<Frame>
ack(String id, String txId)
Sends an acknowledgement for the given frame.io.reactivex.rxjava3.core.Single<Frame>
beginTX(String id)
Begins a transaction.io.reactivex.rxjava3.core.Single<Frame>
beginTX(String id, Map<String,String> headers)
Begins a transaction.void
close()
Closes the connection without sending theDISCONNECT
frame.StompClientConnection
closeHandler(Handler<StompClientConnection> handler)
Sets a handler notified when the STOMP connection is closed.io.reactivex.rxjava3.core.Single<Frame>
commit(String id)
Commits a transaction.io.reactivex.rxjava3.core.Single<Frame>
commit(String id, Map<String,String> headers)
Commits a transaction.StompClientConnection
connectionDroppedHandler(Handler<StompClientConnection> handler)
Sets a handler notified when the server does not respond to aping
request in time.io.reactivex.rxjava3.core.Single<Frame>
disconnect()
Disconnects the client.io.reactivex.rxjava3.core.Single<Frame>
disconnect(Frame frame)
Disconnects the client.boolean
equals(Object o)
StompClientConnection
errorHandler(Handler<Frame> handler)
Sets a handler notified when anERROR
frame is received by the client.StompClientConnection
exceptionHandler(Handler<Throwable> exceptionHandler)
Configures the exception handler notified upon TCP-level errors.StompClientConnection
getDelegate()
int
hashCode()
boolean
isConnected()
Returns whether or not the `CONNECTED` frame has been receive meaning that the Stomp connection is established.io.reactivex.rxjava3.core.Single<Frame>
nack(String id)
Sends a non-acknowledgement for the given message.io.reactivex.rxjava3.core.Single<Frame>
nack(String id, String txId)
Sends a non-acknowledgement for the given frame.static StompClientConnection
newInstance(StompClientConnection arg)
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.io.reactivex.rxjava3.core.Single<Frame>
rxAbort(String id)
Aborts a transaction.io.reactivex.rxjava3.core.Single<Frame>
rxAbort(String id, Map<String,String> headers)
Aborts a transaction.io.reactivex.rxjava3.core.Single<Frame>
rxAck(String id)
Sends an acknowledgement for a specific message.io.reactivex.rxjava3.core.Single<Frame>
rxAck(String id, String txId)
Sends an acknowledgement for the given frame.io.reactivex.rxjava3.core.Single<Frame>
rxBeginTX(String id)
Begins a transaction.io.reactivex.rxjava3.core.Single<Frame>
rxBeginTX(String id, Map<String,String> headers)
Begins a transaction.io.reactivex.rxjava3.core.Single<Frame>
rxCommit(String id)
Commits a transaction.io.reactivex.rxjava3.core.Single<Frame>
rxCommit(String id, Map<String,String> headers)
Commits a transaction.io.reactivex.rxjava3.core.Single<Frame>
rxDisconnect()
Disconnects the client.io.reactivex.rxjava3.core.Single<Frame>
rxDisconnect(Frame frame)
Disconnects the client.io.reactivex.rxjava3.core.Single<Frame>
rxNack(String id)
Sends a non-acknowledgement for the given message.io.reactivex.rxjava3.core.Single<Frame>
rxNack(String id, String txId)
Sends a non-acknowledgement for the given frame.io.reactivex.rxjava3.core.Single<Frame>
rxSend(Frame frame)
Sends the given frame to the server.io.reactivex.rxjava3.core.Single<Frame>
rxSend(String destination, Buffer body)
Sends aSEND
frame to the server to the given destination.io.reactivex.rxjava3.core.Single<Frame>
rxSend(String destination, Map<String,String> headers, Buffer body)
Sends aSEND
frame to the server to the given destination.io.reactivex.rxjava3.core.Single<Frame>
rxSend(Map<String,String> headers, Buffer body)
Sends aSEND
frame to the server.io.reactivex.rxjava3.core.Single<String>
rxSubscribe(String destination, Handler<Frame> handler)
Subscribes to the given destination.io.reactivex.rxjava3.core.Single<String>
rxSubscribe(String destination, Map<String,String> headers, Handler<Frame> handler)
Subscribes to the given destination.io.reactivex.rxjava3.core.Single<Frame>
rxUnsubscribe(String destination)
Un-subscribes from the given destination.io.reactivex.rxjava3.core.Single<Frame>
rxUnsubscribe(String destination, Map<String,String> headers)
Un-subscribes from the given destination.io.reactivex.rxjava3.core.Single<Frame>
send(Frame frame)
Sends the given frame to the server.io.reactivex.rxjava3.core.Single<Frame>
send(String destination, Buffer body)
Sends aSEND
frame to the server to the given destination.io.reactivex.rxjava3.core.Single<Frame>
send(String destination, Map<String,String> headers, Buffer body)
Sends aSEND
frame to the server to the given destination.io.reactivex.rxjava3.core.Single<Frame>
send(Map<String,String> headers, Buffer body)
Sends aSEND
frame to the server.String
server()
String
session()
io.reactivex.rxjava3.core.Single<String>
subscribe(String destination, Handler<Frame> handler)
Subscribes to the given destination.io.reactivex.rxjava3.core.Single<String>
subscribe(String destination, Map<String,String> headers, Handler<Frame> handler)
Subscribes to the given destination.String
toString()
io.reactivex.rxjava3.core.Single<Frame>
unsubscribe(String destination)
Un-subscribes from the given destination.io.reactivex.rxjava3.core.Single<Frame>
unsubscribe(String destination, Map<String,String> headers)
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.
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<StompClientConnection> __TYPE_ARG
-
-
Constructor Detail
-
StompClientConnection
public StompClientConnection(StompClientConnection delegate)
-
StompClientConnection
public StompClientConnection(Object delegate)
-
-
Method Detail
-
getDelegate
public StompClientConnection getDelegate()
- Specified by:
getDelegate
in interfaceRxDelegate
-
session
public String session()
- Returns:
- the session id.
-
version
public String version()
- Returns:
- the STOMP protocol version negotiated with the server.
-
close
public void close()
Closes the connection without sending theDISCONNECT
frame.
-
server
public String server()
- Returns:
- the server name.
-
send
public io.reactivex.rxjava3.core.Single<Frame> send(Map<String,String> headers, Buffer body)
Sends aSEND
frame to the server.- Parameters:
headers
- the headers, must not benull
body
- the body, may benull
- Returns:
- the current
StompClientConnection
-
rxSend
public io.reactivex.rxjava3.core.Single<Frame> rxSend(Map<String,String> headers, Buffer body)
Sends aSEND
frame to the server.- Parameters:
headers
- the headers, must not benull
body
- the body, may benull
- Returns:
- the current
StompClientConnection
-
send
public io.reactivex.rxjava3.core.Single<Frame> send(String destination, Buffer body)
Sends aSEND
frame to the server to the given destination. The message does not have any other header.- Parameters:
destination
- the destination, must not benull
body
- the body, may benull
- Returns:
- the current
StompClientConnection
-
rxSend
public io.reactivex.rxjava3.core.Single<Frame> rxSend(String destination, Buffer body)
Sends aSEND
frame to the server to the given destination. The message does not have any other header.- Parameters:
destination
- the destination, must not benull
body
- the body, may benull
- Returns:
- the current
StompClientConnection
-
send
public io.reactivex.rxjava3.core.Single<Frame> send(Frame frame)
Sends the given frame to the server.- Parameters:
frame
- the frame- Returns:
- the current
StompClientConnection
-
rxSend
public io.reactivex.rxjava3.core.Single<Frame> rxSend(Frame frame)
Sends the given frame to the server.- Parameters:
frame
- the frame- Returns:
- the current
StompClientConnection
-
send
public io.reactivex.rxjava3.core.Single<Frame> send(String destination, Map<String,String> headers, Buffer body)
Sends aSEND
frame to the server to the given destination.- Parameters:
destination
- the destination, must not benull
headers
- the header. Thedestination
header is replaced by the value given to thedestination
parameterbody
- the body, may benull
- Returns:
- the current
StompClientConnection
-
rxSend
public io.reactivex.rxjava3.core.Single<Frame> rxSend(String destination, Map<String,String> headers, Buffer body)
Sends aSEND
frame to the server to the given destination.- Parameters:
destination
- the destination, must not benull
headers
- the header. Thedestination
header is replaced by the value given to thedestination
parameterbody
- the body, may benull
- Returns:
- the current
StompClientConnection
-
subscribe
public io.reactivex.rxjava3.core.Single<String> subscribe(String destination, Handler<Frame> handler)
Subscribes to the given destination. This destination is used as subscription id.- Parameters:
destination
- the destination, must not benull
handler
- the handler invoked when a message is received on the given destination. Must not benull
.- Returns:
- the current
StompClientConnection
-
rxSubscribe
public io.reactivex.rxjava3.core.Single<String> rxSubscribe(String destination, Handler<Frame> handler)
Subscribes to the given destination. This destination is used as subscription id.- Parameters:
destination
- the destination, must not benull
handler
- the handler invoked when a message is received on the given destination. Must not benull
.- Returns:
- the current
StompClientConnection
-
subscribe
public io.reactivex.rxjava3.core.Single<String> subscribe(String destination, Map<String,String> headers, Handler<Frame> handler)
Subscribes to the given destination.- Parameters:
destination
- the destination, must not benull
headers
- the headers to configure the subscription. It may contain theack
header to configure the acknowledgment policy. If the given set of headers contains theid
header, this value is used as subscription id.handler
- the handler invoked when a message is received on the given destination. Must not benull
.- Returns:
- the current
StompClientConnection
-
rxSubscribe
public io.reactivex.rxjava3.core.Single<String> rxSubscribe(String destination, Map<String,String> headers, Handler<Frame> handler)
Subscribes to the given destination.- Parameters:
destination
- the destination, must not benull
headers
- the headers to configure the subscription. It may contain theack
header to configure the acknowledgment policy. If the given set of headers contains theid
header, this value is used as subscription id.handler
- the handler invoked when a message is received on the given destination. Must not benull
.- Returns:
- the current
StompClientConnection
-
unsubscribe
public io.reactivex.rxjava3.core.Single<Frame> unsubscribe(String destination)
Un-subscribes from the given destination. This method only works if the subscription did not specifies a subscription id (using theid
header).- Parameters:
destination
- the destination- Returns:
- the current
StompClientConnection
-
rxUnsubscribe
public io.reactivex.rxjava3.core.Single<Frame> rxUnsubscribe(String destination)
Un-subscribes from the given destination. This method only works if the subscription did not specifies a subscription id (using theid
header).- Parameters:
destination
- the destination- Returns:
- the current
StompClientConnection
-
unsubscribe
public io.reactivex.rxjava3.core.Single<Frame> unsubscribe(String destination, Map<String,String> headers)
Un-subscribes from the given destination. This method computes the subscription id as follows. If the given headers contains theid
header, the header value is used. Otherwise the destination is used.- Parameters:
destination
- the destinationheaders
- the headers- Returns:
- the current
StompClientConnection
-
rxUnsubscribe
public io.reactivex.rxjava3.core.Single<Frame> rxUnsubscribe(String destination, Map<String,String> headers)
Un-subscribes from the given destination. This method computes the subscription id as follows. If the given headers contains theid
header, the header value is used. Otherwise the destination is used.- Parameters:
destination
- the destinationheaders
- the headers- Returns:
- the current
StompClientConnection
-
errorHandler
public StompClientConnection errorHandler(Handler<Frame> handler)
Sets a handler notified when anERROR
frame is received by the client. The handler receives theERROR
frame and a reference on theStompClientConnection
.- Parameters:
handler
- the handler- Returns:
- the current
StompClientConnection
-
closeHandler
public StompClientConnection closeHandler(Handler<StompClientConnection> handler)
Sets a handler notified when the STOMP connection is closed.- Parameters:
handler
- the handler- Returns:
- the current
StompClientConnection
-
connectionDroppedHandler
public StompClientConnection connectionDroppedHandler(Handler<StompClientConnection> handler)
Sets a handler notified when the server does not respond to aping
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.- Parameters:
handler
- the handler- Returns:
- the current
StompClientConnection
receiving the dropped connection.
-
pingHandler
public StompClientConnection pingHandler(Handler<StompClientConnection> handler)
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.- Parameters:
handler
- the handler- Returns:
- the current
StompClientConnection
-
beginTX
public io.reactivex.rxjava3.core.Single<Frame> beginTX(String id)
Begins a transaction.- Parameters:
id
- the transaction id, must not benull
- Returns:
- the current
StompClientConnection
-
rxBeginTX
public io.reactivex.rxjava3.core.Single<Frame> rxBeginTX(String id)
Begins a transaction.- Parameters:
id
- the transaction id, must not benull
- Returns:
- the current
StompClientConnection
-
beginTX
public io.reactivex.rxjava3.core.Single<Frame> beginTX(String id, Map<String,String> headers)
Begins a transaction.- Parameters:
id
- the transaction id, must not benull
headers
- additional headers to send to the server. Thetransaction
header is replaced by the value passed in the @{code id} parameter- Returns:
- the current
StompClientConnection
-
rxBeginTX
public io.reactivex.rxjava3.core.Single<Frame> rxBeginTX(String id, Map<String,String> headers)
Begins a transaction.- Parameters:
id
- the transaction id, must not benull
headers
- additional headers to send to the server. Thetransaction
header is replaced by the value passed in the @{code id} parameter- Returns:
- the current
StompClientConnection
-
commit
public io.reactivex.rxjava3.core.Single<Frame> commit(String id)
Commits a transaction.- Parameters:
id
- the transaction id, must not benull
- Returns:
- the current
StompClientConnection
-
rxCommit
public io.reactivex.rxjava3.core.Single<Frame> rxCommit(String id)
Commits a transaction.- Parameters:
id
- the transaction id, must not benull
- Returns:
- the current
StompClientConnection
-
commit
public io.reactivex.rxjava3.core.Single<Frame> commit(String id, Map<String,String> headers)
Commits a transaction.- Parameters:
id
- the transaction id, must not benull
headers
- additional headers to send to the server. Thetransaction
header is replaced by the value passed in the @{code id} parameter- Returns:
- the current
StompClientConnection
-
rxCommit
public io.reactivex.rxjava3.core.Single<Frame> rxCommit(String id, Map<String,String> headers)
Commits a transaction.- Parameters:
id
- the transaction id, must not benull
headers
- additional headers to send to the server. Thetransaction
header is replaced by the value passed in the @{code id} parameter- Returns:
- the current
StompClientConnection
-
abort
public io.reactivex.rxjava3.core.Single<Frame> abort(String id)
Aborts a transaction.- Parameters:
id
- the transaction id, must not benull
- Returns:
- the current
StompClientConnection
-
rxAbort
public io.reactivex.rxjava3.core.Single<Frame> rxAbort(String id)
Aborts a transaction.- Parameters:
id
- the transaction id, must not benull
- Returns:
- the current
StompClientConnection
-
abort
public io.reactivex.rxjava3.core.Single<Frame> abort(String id, Map<String,String> headers)
Aborts a transaction.- Parameters:
id
- the transaction id, must not benull
headers
- additional headers to send to the server. Thetransaction
header is replaced by the value passed in the @{code id} parameter- Returns:
- the current
StompClientConnection
-
rxAbort
public io.reactivex.rxjava3.core.Single<Frame> rxAbort(String id, Map<String,String> headers)
Aborts a transaction.- Parameters:
id
- the transaction id, must not benull
headers
- additional headers to send to the server. Thetransaction
header is replaced by the value passed in the @{code id} parameter- Returns:
- the current
StompClientConnection
-
disconnect
public io.reactivex.rxjava3.core.Single<Frame> disconnect()
Disconnects the client. Unlike theclose()
method, this method send theDISCONNECT
frame to the server.- Returns:
- the current
StompClientConnection
-
rxDisconnect
public io.reactivex.rxjava3.core.Single<Frame> rxDisconnect()
Disconnects the client. Unlike theclose()
method, this method send theDISCONNECT
frame to the server.- Returns:
- the current
StompClientConnection
-
disconnect
public io.reactivex.rxjava3.core.Single<Frame> disconnect(Frame frame)
Disconnects the client. Unlike theclose()
method, this method send theDISCONNECT
frame to the server. This method lets you customize theDISCONNECT
frame.- Parameters:
frame
- theDISCONNECT
frame.- Returns:
- a future resolved with the sent frame when the
RECEIPT
frame associated with the sent frame has been received
-
rxDisconnect
public io.reactivex.rxjava3.core.Single<Frame> rxDisconnect(Frame frame)
Disconnects the client. Unlike theclose()
method, this method send theDISCONNECT
frame to the server. This method lets you customize theDISCONNECT
frame.- Parameters:
frame
- theDISCONNECT
frame.- Returns:
- a future resolved with the sent frame when the
RECEIPT
frame associated with the sent frame has been received
-
ack
public io.reactivex.rxjava3.core.Single<Frame> ack(String id)
Sends an acknowledgement for a specific message. It means that the message has been handled and processed by the client. Theid
parameter is the message id received in the frame.- Parameters:
id
- the message id of the message to acknowledge- Returns:
- the current
StompClientConnection
-
rxAck
public io.reactivex.rxjava3.core.Single<Frame> rxAck(String id)
Sends an acknowledgement for a specific message. It means that the message has been handled and processed by the client. Theid
parameter is the message id received in the frame.- Parameters:
id
- the message id of the message to acknowledge- Returns:
- the current
StompClientConnection
-
nack
public io.reactivex.rxjava3.core.Single<Frame> nack(String id)
Sends a non-acknowledgement for the given message. It means that the message has not been handled by the client. Theid
parameter is the message id received in the frame.- Parameters:
id
- the message id of the message to acknowledge- Returns:
- the current
StompClientConnection
-
rxNack
public io.reactivex.rxjava3.core.Single<Frame> rxNack(String id)
Sends a non-acknowledgement for the given message. It means that the message has not been handled by the client. Theid
parameter is the message id received in the frame.- Parameters:
id
- the message id of the message to acknowledge- Returns:
- the current
StompClientConnection
-
ack
public io.reactivex.rxjava3.core.Single<Frame> ack(String id, String txId)
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.- Parameters:
id
- the message id of the message to acknowledgetxId
- the transaction id- Returns:
- the current
StompClientConnection
-
rxAck
public io.reactivex.rxjava3.core.Single<Frame> rxAck(String id, String txId)
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.- Parameters:
id
- the message id of the message to acknowledgetxId
- the transaction id- Returns:
- the current
StompClientConnection
-
nack
public io.reactivex.rxjava3.core.Single<Frame> nack(String id, String txId)
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.- Parameters:
id
- the message id of the message to acknowledgetxId
- the transaction id- Returns:
- the current
StompClientConnection
-
rxNack
public io.reactivex.rxjava3.core.Single<Frame> rxNack(String id, String txId)
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.- Parameters:
id
- the message id of the message to acknowledgetxId
- the transaction id- Returns:
- the current
StompClientConnection
-
receivedFrameHandler
public StompClientConnection receivedFrameHandler(Handler<Frame> handler)
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(io.vertx.core.Handler<io.vertx.ext.stomp.Frame>)
, the given handler won't receive theCONNECTED
frame. If a received frame handler is set on theStompClient
, it will be used by all clients connection, so calling this method is useless, except if you want to use a different handler.- Parameters:
handler
- the handler- Returns:
- the current
StompClientConnection
-
writingFrameHandler
public StompClientConnection writingFrameHandler(Handler<Frame> handler)
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.- Parameters:
handler
- the handler- Returns:
- the current
StompClientConnection
-
exceptionHandler
public StompClientConnection exceptionHandler(Handler<Throwable> exceptionHandler)
Configures the exception handler notified upon TCP-level errors.- Parameters:
exceptionHandler
- the handler- Returns:
- the current
StompClientConnection
-
isConnected
public boolean isConnected()
Returns whether or not the `CONNECTED` frame has been receive meaning that the Stomp connection is established.- Returns:
true
if the connection is established,false
otherwise
-
newInstance
public static StompClientConnection newInstance(StompClientConnection arg)
-
-