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 java.lang.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
Fields Modifier and Type Field Description protected org.apache.commons.logging.Logloggerprotected org.springframework.messaging.simp.stomp.StompClientSupportstompClient -
Constructor Summary
Constructors Constructor Description AbstractStompSessionManager(org.springframework.messaging.simp.stomp.StompClientSupport stompClient) -
Method Summary
Modifier and Type Method Description voidconnect(org.springframework.messaging.simp.stomp.StompSessionHandler handler)voiddestroy()voiddisconnect(org.springframework.messaging.simp.stomp.StompSessionHandler handler)protected abstract org.springframework.util.concurrent.ListenableFuture<org.springframework.messaging.simp.stomp.StompSession>doConnect(org.springframework.messaging.simp.stomp.StompSessionHandler handler)protected org.springframework.messaging.simp.stomp.StompHeadersgetConnectHeaders()intgetPhase()longgetRecoveryInterval()booleanisAutoReceiptEnabled()booleanisAutoStartup()booleanisConnected()booleanisRunning()voidsetApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)voidsetAutoReceipt(boolean autoReceipt)voidsetAutoStartup(boolean autoStartup)voidsetBeanName(java.lang.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()java.lang.StringtoString()
-
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
public void setBeanName(java.lang.String name)- 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
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
doConnect
protected abstract org.springframework.util.concurrent.ListenableFuture<org.springframework.messaging.simp.stomp.StompSession> doConnect(org.springframework.messaging.simp.stomp.StompSessionHandler handler)
-