new StompServerHandler()
STOMP server handler implements the behavior of the STOMP server when a specific event occurs. For instance, if
let customize the behavior when specific STOMP frames arrives or when a connection is closed. This class has been
designed to let you customize the server behavior. The default implementation is compliant with the STOMP
specification. In this default implementation, not acknowledge frames are dropped.
Methods
-
abortHandler(handler) → {StompServerHandler}
-
Configures the action to execute when a
ABORT
frame is received.Parameters:
Name Type Description handler
function the handler Returns:
the current StompServerHandler- Type
- StompServerHandler
-
ackHandler(handler) → {StompServerHandler}
-
Configures the action to execute when a
ACK
frame is received.Parameters:
Name Type Description handler
function the handler Returns:
the current StompServerHandler- Type
- StompServerHandler
-
authProvider(handler) → {StompServerHandler}
-
Configures the to be used to authenticate the user.
Parameters:
Name Type Description handler
AuthProvider the handler Returns:
the current StompServerHandler- Type
- StompServerHandler
-
beginHandler(handler) → {StompServerHandler}
-
Configures the action to execute when a
BEGIN
frame is received.Parameters:
Name Type Description handler
function the handler Returns:
the current StompServerHandler- Type
- StompServerHandler
-
bridge(options) → {StompServerHandler}
-
Configures the STOMP server to act as a bridge with the Vert.x event bus.
Parameters:
Name Type Description options
Object the configuration options Returns:
the current StompServerHandler.- Type
- StompServerHandler
-
closeHandler(handler) → {StompServerHandler}
-
Configures the action to execute when a connection with the client is closed.
Parameters:
Name Type Description handler
function the handler Returns:
the current StompServerHandler- Type
- StompServerHandler
-
commitHandler(handler) → {StompServerHandler}
-
Configures the action to execute when a
COMMIT
frame is received.Parameters:
Name Type Description handler
function the handler Returns:
the current StompServerHandler- Type
- StompServerHandler
-
connectHandler(handler) → {StompServerHandler}
-
Configures the action to execute when a
CONNECT
frame is received.Parameters:
Name Type Description handler
function the handler Returns:
the current StompServerHandler- Type
- StompServerHandler
-
destinationFactory(factory) → {StompServerHandler}
-
Configures the DestinationFactory used to create Destination objects.
Parameters:
Name Type Description factory
DestinationFactory the factory Returns:
the current StompServerHandler.- Type
- StompServerHandler
-
disconnectHandler(handler) → {StompServerHandler}
-
Configures the action to execute when a
DISCONNECT
frame is received.Parameters:
Name Type Description handler
function the handler Returns:
the current StompServerHandler- Type
- StompServerHandler
-
getDestination(destination) → {Destination}
-
Gets the destination with the given name.
Parameters:
Name Type Description destination
string the destination Returns:
the Destination,null
if not existing.- Type
- Destination
-
getDestinations() → {Array.<Destination>}
-
Returns:
-
the list of destination managed by the STOMP server. Don't forget the STOMP interprets destination as opaque Strings.
-
- Type
- Array.<Destination>
-
-
getOrCreateDestination(destination) → {Destination}
-
Gets a Destination object if existing, or create a new one. The creation is delegated to the DestinationFactory.
Parameters:
Name Type Description destination
string the destination Returns:
the Destination instance, may have been created.- Type
- Destination
-
handle(arg0)
-
Parameters:
Name Type Description arg0
ServerFrame -
nackHandler(handler) → {StompServerHandler}
-
Configures the action to execute when a
NACK
frame is received.Parameters:
Name Type Description handler
function the handler Returns:
the current StompServerHandler- Type
- StompServerHandler
-
onAck(connection, subscribe, messages) → {StompServerHandler}
-
Method called by single message (client-individual policy) or a set of message (client policy) are acknowledged. Implementations must call the handler configured using StompServerHandler#onAckHandler.
Parameters:
Name Type Description connection
StompServerConnection the connection subscribe
Object the SUBSCRIBE
framemessages
Array.<Object> the acknowledge messages Returns:
the current StompServerHandler- Type
- StompServerHandler
-
onAckHandler(handler) → {StompServerHandler}
-
Configures the action to execute when messages are acknowledged.
Parameters:
Name Type Description handler
function the handler Returns:
the current StompServerHandler- Type
- StompServerHandler
-
onAuthenticationRequest(server, login, passcode, handler) → {StompServerHandler}
-
Called when the client connects to a server requiring authentication. It invokes the configured using StompServerHandler#authProvider.
Parameters:
Name Type Description server
StompServer the STOMP server. login
string the login passcode
string the password handler
function handler receiving the authentication result Returns:
the current StompServerHandler- Type
- StompServerHandler
-
onClose(connection)
-
Called when the connection is closed. This method executes a default behavior and must calls the configured StompServerHandler#closeHandler if any.
Parameters:
Name Type Description connection
StompServerConnection the connection -
onNack(connection, subscribe, messages) → {StompServerHandler}
-
Method called by single message (client-individual policy) or a set of message (client policy) are not acknowledged. Not acknowledgment can result from a
NACK
frame or from a timeout (noACK
frame received in a given time. Implementations must call the handler configured using StompServerHandler#onNackHandler.Parameters:
Name Type Description connection
StompServerConnection the connection subscribe
Object the SUBSCRIBE
framemessages
Array.<Object> the acknowledge messages Returns:
the current StompServerHandler- Type
- StompServerHandler
-
onNackHandler(handler) → {StompServerHandler}
-
Configures the action to execute when messages are not acknowledged.
Parameters:
Name Type Description handler
function the handler Returns:
the current StompServerHandler- Type
- StompServerHandler
-
pingHandler(handler) → {StompServerHandler}
-
Allows customizing the action to do when the server needs to send a `PING` to the client. By default it send a frame containing
EOL
(specification). However, you can customize this and send another frame. However, be aware that this may requires a custom client. The handler will only be called if the connection supports heartbeats.Parameters:
Name Type Description handler
function the action to execute when a `PING` needs to be sent. Returns:
the current StompServerHandler- Type
- StompServerHandler
-
sendHandler(handler) → {StompServerHandler}
-
Configures the action to execute when a
SEND
frame is received.Parameters:
Name Type Description handler
function the handler Returns:
the current StompServerHandler- Type
- StompServerHandler
-
stompHandler(handler) → {StompServerHandler}
-
Configures the action to execute when a
STOMP
frame is received.Parameters:
Name Type Description handler
function the handler Returns:
the current StompServerHandler- Type
- StompServerHandler
-
subscribeHandler(handler) → {StompServerHandler}
-
Configures the action to execute when a
SUBSCRIBE
frame is received.Parameters:
Name Type Description handler
function the handler Returns:
the current StompServerHandler- Type
- StompServerHandler
-
unsubscribeHandler(handler) → {StompServerHandler}
-
Configures the action to execute when a
UNSUBSCRIBE
frame is received.Parameters:
Name Type Description handler
function the handler Returns:
the current StompServerHandler- Type
- StompServerHandler