Class AbstractStompSessionManager
java.lang.Object
org.springframework.integration.stomp.AbstractStompSessionManager
- All Implemented Interfaces:
Aware,BeanNameAware,DisposableBean,ApplicationEventPublisherAware,Lifecycle,Phased,SmartLifecycle,StompSessionManager
- Direct Known Subclasses:
ReactorNettyTcpStompSessionManager,WebSocketStompSessionManager
public abstract class AbstractStompSessionManager
extends Object
implements StompSessionManager, ApplicationEventPublisherAware, SmartLifecycle, DisposableBean, BeanNameAware
Base
StompSessionManager implementation to manage a single StompSession
over its CompletableFuture 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
- Author:
- Artem Bilan, Gary Russell, Christian Tzolov
-
Field Summary
FieldsFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconnect(StompSessionHandler handler) voiddestroy()voiddisconnect(StompSessionHandler handler) protected abstract CompletableFuture<StompSession> doConnect(StompSessionHandler handler) protected @Nullable StompHeadersintgetPhase()longbooleanbooleanbooleanbooleanvoidsetApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) voidsetAutoReceipt(boolean autoReceipt) voidsetAutoStartup(boolean autoStartup) voidsetBeanName(String name) voidsetConnectHeaders(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
isPauseable, stop
-
Field Details
-
logger
-
stompClient
-
-
Constructor Details
-
AbstractStompSessionManager
-
-
Method Details
-
setConnectHeaders
-
setAutoReceipt
public void setAutoReceipt(boolean autoReceipt) -
isAutoReceiptEnabled
public boolean isAutoReceiptEnabled()- Specified by:
isAutoReceiptEnabledin interfaceStompSessionManager
-
isConnected
public boolean isConnected()- Specified by:
isConnectedin interfaceStompSessionManager
-
setApplicationEventPublisher
- Specified by:
setApplicationEventPublisherin interfaceApplicationEventPublisherAware
-
setBeanName
- Specified by:
setBeanNamein interfaceBeanNameAware
-
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 interfaceSmartLifecycle
-
isRunning
-
getPhase
public int getPhase()- Specified by:
getPhasein interfacePhased- Specified by:
getPhasein interfaceSmartLifecycle
-
destroy
public void destroy()- Specified by:
destroyin interfaceDisposableBean
-
start
-
stop
-
connect
- Specified by:
connectin interfaceStompSessionManager
-
disconnect
- Specified by:
disconnectin interfaceStompSessionManager
-
getConnectHeaders
-
toString
-
doConnect
-