public abstract class AbstractStompSessionManager extends Object implements StompSessionManager, ApplicationEventPublisherAware, SmartLifecycle, DisposableBean, BeanNameAware
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.
Modifier and Type | Field and Description |
---|---|
protected Log |
logger |
protected StompClientSupport |
stompClient |
DEFAULT_PHASE
Constructor and Description |
---|
AbstractStompSessionManager(StompClientSupport stompClient) |
Modifier and Type | Method and 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() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
stop
protected final Log logger
protected final StompClientSupport stompClient
public AbstractStompSessionManager(StompClientSupport stompClient)
public void setConnectHeaders(StompHeaders connectHeaders)
public void setAutoReceipt(boolean autoReceipt)
public boolean isAutoReceiptEnabled()
isAutoReceiptEnabled
in interface StompSessionManager
public boolean isConnected()
isConnected
in interface StompSessionManager
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher
in interface ApplicationEventPublisherAware
public void setBeanName(String name)
setBeanName
in interface BeanNameAware
public void setRecoveryInterval(int recoveryInterval)
recoveryInterval
- the reconnect interval in milliseconds in case of lost connection.public void setAutoStartup(boolean autoStartup)
public void setPhase(int phase)
public long getRecoveryInterval()
public boolean isAutoStartup()
isAutoStartup
in interface SmartLifecycle
public int getPhase()
getPhase
in interface Phased
getPhase
in interface SmartLifecycle
public void destroy()
destroy
in interface DisposableBean
public void connect(StompSessionHandler handler)
connect
in interface StompSessionManager
public void disconnect(StompSessionHandler handler)
disconnect
in interface StompSessionManager
protected StompHeaders getConnectHeaders()
protected abstract ListenableFuture<StompSession> doConnect(StompSessionHandler handler)