接口 StompSessionHandler
- 所有超级接口:
StompFrameHandler
- 所有已知实现类:
StompSessionHandlerAdapter
public interface StompSessionHandler extends StompFrameHandler
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
.- 从以下版本开始:
- 4.2
- 作者:
- Rossen Stoyanchev
- 另请参阅:
StompSessionHandlerAdapter
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 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.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 applicationStompFrameHandler
.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.从接口继承的方法 org.springframework.messaging.simp.stomp.StompFrameHandler
getPayloadType, handleFrame
方法详细资料
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.- 参数:
session
- the client STOMP sessionconnectedHeaders
- 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 applicationStompFrameHandler
.- 参数:
session
- the client STOMP sessioncommand
- the STOMP command of the frameheaders
- the headerspayload
- the raw payloadexception
- 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.Note that
ConnectionLostException
will be passed into this method when the connection is lost rather than closed normally viaStompSession.disconnect()
.- 参数:
session
- the client STOMP sessionexception
- the exception that occurred