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 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 StompSessionHandler
s.
This AbstractStompSessionManager.CompositeStompSessionHandler
is used for the
StompSession
connection.
- Since:
- 4.2
- Author:
- Artem Bilan, Gary Russell
-
Field Summary
Fields Modifier and Type Field Description protected Log
logger
protected StompClientSupport
stompClient
-
Constructor Summary
Constructors Constructor Description AbstractStompSessionManager(StompClientSupport stompClient)
-
Method Summary
Modifier and Type Method Description void
connect(StompSessionHandler handler)
void
destroy()
void
disconnect(StompSessionHandler handler)
protected abstract ListenableFuture<StompSession>
doConnect(StompSessionHandler handler)
protected StompHeaders
getConnectHeaders()
int
getPhase()
long
getRecoveryInterval()
boolean
isAutoReceiptEnabled()
boolean
isAutoStartup()
boolean
isConnected()
boolean
isRunning()
void
setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
void
setAutoReceipt(boolean autoReceipt)
void
setAutoStartup(boolean autoStartup)
void
setBeanName(String name)
void
setConnectHeaders(StompHeaders connectHeaders)
void
setPhase(int phase)
void
setRecoveryInterval(int recoveryInterval)
Specify a reconnect interval in milliseconds in case of lost connection.void
start()
void
stop()
String
toString()
-
Field Details
-
Constructor Details
-
Method Details
-
setConnectHeaders
-
setAutoReceipt
public void setAutoReceipt(boolean autoReceipt) -
isAutoReceiptEnabled
public boolean isAutoReceiptEnabled()- Specified by:
isAutoReceiptEnabled
in interfaceStompSessionManager
-
isConnected
public boolean isConnected()- Specified by:
isConnected
in interfaceStompSessionManager
-
setApplicationEventPublisher
- Specified by:
setApplicationEventPublisher
in interfaceApplicationEventPublisherAware
-
setBeanName
- Specified by:
setBeanName
in 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:
isAutoStartup
in interfaceSmartLifecycle
-
isRunning
public boolean isRunning() -
getPhase
public int getPhase()- Specified by:
getPhase
in interfacePhased
- Specified by:
getPhase
in interfaceSmartLifecycle
-
destroy
public void destroy()- Specified by:
destroy
in interfaceDisposableBean
-
start
public void start() -
stop
public void stop() -
connect
- Specified by:
connect
in interfaceStompSessionManager
-
disconnect
- Specified by:
disconnect
in interfaceStompSessionManager
-
getConnectHeaders
-
toString
-
doConnect
-