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 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 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(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 String toString()
      Overrides:
      toString in class Object
    • doConnect

      protected abstract CompletableFuture<org.springframework.messaging.simp.stomp.StompSession> doConnect(org.springframework.messaging.simp.stomp.StompSessionHandler handler)