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.Log logger  
    protected org.springframework.messaging.simp.stomp.StompClientSupport stompClient  

    Fields inherited from interface org.springframework.context.SmartLifecycle

    DEFAULT_PHASE
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractStompSessionManager​(org.springframework.messaging.simp.stomp.StompClientSupport stompClient)  
  • Method Summary

    Modifier and Type Method Description
    void connect​(org.springframework.messaging.simp.stomp.StompSessionHandler handler)  
    void destroy()  
    void disconnect​(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.StompHeaders getConnectHeaders()  
    int getPhase()  
    long getRecoveryInterval()  
    boolean isAutoReceiptEnabled()  
    boolean isAutoStartup()  
    boolean isConnected()  
    boolean isRunning()  
    void setApplicationEventPublisher​(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)  
    void setAutoReceipt​(boolean autoReceipt)  
    void setAutoStartup​(boolean autoStartup)  
    void setBeanName​(java.lang.String name)  
    void setConnectHeaders​(org.springframework.messaging.simp.stomp.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()  
    java.lang.String 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

      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:
      isAutoReceiptEnabled in interface StompSessionManager
    • isConnected

      public boolean isConnected()
      Specified by:
      isConnected in interface StompSessionManager
    • setApplicationEventPublisher

      public void setApplicationEventPublisher​(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
      Specified by:
      setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAware
    • setBeanName

      public void setBeanName​(java.lang.String name)
      Specified by:
      setBeanName in interface org.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:
      isAutoStartup in interface org.springframework.context.SmartLifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface org.springframework.context.Lifecycle
    • getPhase

      public int getPhase()
      Specified by:
      getPhase in interface org.springframework.context.Phased
      Specified by:
      getPhase in interface org.springframework.context.SmartLifecycle
    • destroy

      public void destroy()
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
    • start

      public void start()
      Specified by:
      start in interface org.springframework.context.Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface org.springframework.context.Lifecycle
    • connect

      public void connect​(org.springframework.messaging.simp.stomp.StompSessionHandler handler)
      Specified by:
      connect in interface StompSessionManager
    • disconnect

      public void disconnect​(org.springframework.messaging.simp.stomp.StompSessionHandler handler)
      Specified by:
      disconnect in interface StompSessionManager
    • getConnectHeaders

      protected org.springframework.messaging.simp.stomp.StompHeaders getConnectHeaders()
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • doConnect

      protected abstract org.springframework.util.concurrent.ListenableFuture<org.springframework.messaging.simp.stomp.StompSession> doConnect​(org.springframework.messaging.simp.stomp.StompSessionHandler handler)