Class AbstractStompSessionManager
java.lang.Object
org.springframework.integration.stomp.AbstractStompSessionManager
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.DisposableBean,org.springframework.context.ApplicationEventPublisherAware,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle,StompSessionManager
- Direct Known Subclasses:
ReactorNettyTcpStompSessionManager,WebSocketStompSessionManager
public abstract class AbstractStompSessionManager
extends Object
implements StompSessionManager, org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.SmartLifecycle, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.BeanNameAware
Base
StompSessionManager implementation to manage a single StompSession
over its ListenableFuture from the target implementation of this class.
The connection to the StompSession is made during start().
The stop() lifecycle method manages StompSession.disconnect().
The connect(StompSessionHandler) and disconnect(StompSessionHandler) method
implementations populate/remove the provided StompSessionHandler to/from an internal
AbstractStompSessionManager.CompositeStompSessionHandler, which delegates all operations
to the provided StompSessionHandlers.
This AbstractStompSessionManager.CompositeStompSessionHandler is used for the
StompSession connection.
- Since:
- 4.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.commons.logging.Logprotected final org.springframework.messaging.simp.stomp.StompClientSupportFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsConstructorDescriptionAbstractStompSessionManager(org.springframework.messaging.simp.stomp.StompClientSupport stompClient) -
Method Summary
Modifier and TypeMethodDescriptionvoidconnect(org.springframework.messaging.simp.stomp.StompSessionHandler handler) voiddestroy()voiddisconnect(org.springframework.messaging.simp.stomp.StompSessionHandler handler) protected abstract CompletableFuture<org.springframework.messaging.simp.stomp.StompSession>doConnect(org.springframework.messaging.simp.stomp.StompSessionHandler handler) protected org.springframework.messaging.simp.stomp.StompHeadersintgetPhase()longbooleanbooleanbooleanbooleanvoidsetApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) voidsetAutoReceipt(boolean autoReceipt) voidsetAutoStartup(boolean autoStartup) voidsetBeanName(String name) voidsetConnectHeaders(org.springframework.messaging.simp.stomp.StompHeaders connectHeaders) voidsetPhase(int phase) voidsetRecoveryInterval(int recoveryInterval) Specify a reconnect interval in milliseconds in case of lost connection.voidstart()voidstop()toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.context.SmartLifecycle
stop
-
Field Details
-
logger
protected final org.apache.commons.logging.Log logger -
stompClient
protected final org.springframework.messaging.simp.stomp.StompClientSupport stompClient
-
-
Constructor Details
-
AbstractStompSessionManager
public AbstractStompSessionManager(org.springframework.messaging.simp.stomp.StompClientSupport stompClient)
-
-
Method Details
-
setConnectHeaders
public void setConnectHeaders(org.springframework.messaging.simp.stomp.StompHeaders connectHeaders) -
setAutoReceipt
public void setAutoReceipt(boolean autoReceipt) -
isAutoReceiptEnabled
public boolean isAutoReceiptEnabled()- Specified by:
isAutoReceiptEnabledin interfaceStompSessionManager
-
isConnected
public boolean isConnected()- Specified by:
isConnectedin interfaceStompSessionManager
-
setApplicationEventPublisher
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) - Specified by:
setApplicationEventPublisherin interfaceorg.springframework.context.ApplicationEventPublisherAware
-
setBeanName
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware
-
setRecoveryInterval
public void setRecoveryInterval(int recoveryInterval) Specify a reconnect interval in milliseconds in case of lost connection.- Parameters:
recoveryInterval- the reconnect interval in milliseconds in case of lost connection.- Since:
- 4.2.2
-
setAutoStartup
public void setAutoStartup(boolean autoStartup) -
setPhase
public void setPhase(int phase) -
getRecoveryInterval
public long getRecoveryInterval() -
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartupin interfaceorg.springframework.context.SmartLifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
getPhase
public int getPhase()- Specified by:
getPhasein interfaceorg.springframework.context.Phased- Specified by:
getPhasein interfaceorg.springframework.context.SmartLifecycle
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-
start
public void start()- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
connect
public void connect(org.springframework.messaging.simp.stomp.StompSessionHandler handler) - Specified by:
connectin interfaceStompSessionManager
-
disconnect
public void disconnect(org.springframework.messaging.simp.stomp.StompSessionHandler handler) - Specified by:
disconnectin interfaceStompSessionManager
-
getConnectHeaders
protected org.springframework.messaging.simp.stomp.StompHeaders getConnectHeaders() -
toString
-
doConnect
protected abstract CompletableFuture<org.springframework.messaging.simp.stomp.StompSession> doConnect(org.springframework.messaging.simp.stomp.StompSessionHandler handler)
-