StompSessionHandler

A contract for client STOMP session lifecycle events including a callback when the session is established and notifications of transport or message handling failures.

<p>This contract also extends {@link StompFrameHandler} in order to handle STOMP ERROR frames received from the broker.

<p>Implementations of this interface should consider extending {@link StompSessionHandlerAdapter}.

@author Rossen Stoyanchev @since 4.2 @see StompSessionHandlerAdapter

Members

Functions

afterConnected
void afterConnected(StompSession session, StompHeaders connectedHeaders)

Invoked when the session is ready to use, i.e. after the underlying transport (TCP, WebSocket) is connected and a STOMP CONNECTED frame is received from the broker. @param session the client STOMP session @param connectedHeaders the STOMP CONNECTED frame headers

handleException
void handleException(StompSession session, StompCommand command, StompHeaders headers, byte[] payload, Throwable exception)

Handle any exception arising while processing a STOMP frame such as a failure to convert the payload or an unhandled exception in the application {@code StompFrameHandler}. @param session the client STOMP session @param command the STOMP command of the frame @param headers the headers @param payload the raw payload @param exception the exception

handleTransportError
void handleTransportError(StompSession session, Throwable exception)

Handle a low level transport error which could be an I/O error or a failure to encode or decode a STOMP message. <p>Note that {@link hunt.stomp.simp.stomp.ConnectionLostException ConnectionLostException} will be passed into this method when the connection is lost rather than closed normally via {@link StompSession#disconnect()}. @param session the client STOMP session @param exception the exception that occurred

Inherited Members

From StompFrameHandler

getPayloadType
TypeInfo getPayloadType(StompHeaders headers)

Invoked before {@link #handleFrame(StompHeaders, Object)} to determine the type of Object the payload should be converted to. @param headers the headers of a message

handleFrame
void handleFrame(StompHeaders headers, Object payload)

Handle a STOMP frame with the payload converted to the target type returned from {@link #getPayloadType(StompHeaders)}. @param headers the headers of the frame @param payload the payload, or {@code null} if there was no payload

Meta