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 StompSessionHandler
s.
This AbstractStompSessionManager.CompositeStompSessionHandler
is used for the
StompSession
connection.
- Since:
- 4.2
- Author:
- Artem Bilan, Gary Russell, Christian Tzolov
-
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
connect
(StompSessionHandler handler) void
destroy()
void
disconnect
(StompSessionHandler handler) protected abstract CompletableFuture<StompSession>
doConnect
(StompSessionHandler handler) protected StompHeaders
int
getPhase()
long
boolean
boolean
boolean
boolean
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()
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.context.SmartLifecycle
stop
-
Field Details
-
logger
-
stompClient
-
-
Constructor Details
-
AbstractStompSessionManager
-
-
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
-