Top Description Methods
org.springframework.messaging.simp.stomp

public Interface StompSessionHandler

extends StompFrameHandler
Known Direct Implementers
org.springframework.messaging.simp.stomp.StompSessionHandlerAdapter
Imports
org.springframework.lang.Nullable

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

This contract also extends StompFrameHandler in order to handle STOMP ERROR frames received from the broker.

Implementations of this interface should consider extending StompSessionHandlerAdapter.

Author
Rossen Stoyanchev
Since
4.2
See Also
StompSessionHandlerAdapter

Method Summary

Modifier and TypeMethod and Description
public void
afterConnected(StompSession
the client STOMP session
session
,
StompHeaders
the STOMP CONNECTED frame headers
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.

public void
handleException(StompSession
the client STOMP session
session
,
StompCommand
the STOMP command of the frame
command
,
StompHeaders
the headers
headers
,
byte[]
the raw payload
payload
,
Throwable
the exception
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 StompFrameHandler.

public void
handleTransportError(StompSession
the client STOMP session
session
,
Throwable
the exception that occurred
exception
)

Handle a low level transport error which could be an I/O error or a failure to encode or decode a STOMP message.

Inherited from org.springframework.messaging.simp.stomp.StompFrameHandler:
getPayloadTypehandleFrame

Method Detail

afterConnectedback to summary
public 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.

Parameters
session:StompSession

the client STOMP session

connectedHeaders:StompHeaders

the STOMP CONNECTED frame headers

handleExceptionback to summary
public 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 StompFrameHandler.

Parameters
session:StompSession

the client STOMP session

command:StompCommand

the STOMP command of the frame

headers:StompHeaders

the headers

payload:byte[]

the raw payload

exception:Throwable

the exception

handleTransportErrorback to summary
public 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.

Note that ConnectionLostException will be passed into this method when the connection is lost rather than closed normally via StompSession#disconnect().

Parameters
session:StompSession

the client STOMP session

exception:Throwable

the exception that occurred