Class WebSocketMessageBrokerStats

java.lang.Object
org.springframework.web.socket.config.WebSocketMessageBrokerStats
All Implemented Interfaces:
org.springframework.beans.factory.SmartInitializingSingleton

public class WebSocketMessageBrokerStats extends Object implements org.springframework.beans.factory.SmartInitializingSingleton
A central class for aggregating information about internal state and counters from key infrastructure components of the setup that comes with @EnableWebSocketMessageBroker for Java config and <websocket:message-broker> for XML.

By default aggregated information is logged every 30 minutes at INFO level. The frequency of logging can be changed via setLoggingPeriod(long).

This class is declared as a Spring bean by the above configuration with the name "webSocketMessageBrokerStats" and can be easily exported to JMX, for example, with the MBeanExporter.

Since:
4.1
Author:
Rossen Stoyanchev, Sam Brannen, Brian Clozel
  • Constructor Details

    • WebSocketMessageBrokerStats

      public WebSocketMessageBrokerStats()
  • Method Details

    • setSubProtocolWebSocketHandler

      public void setSubProtocolWebSocketHandler(SubProtocolWebSocketHandler webSocketHandler)
    • setStompBrokerRelay

      public void setStompBrokerRelay(org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler stompBrokerRelay)
    • setInboundChannelExecutor

      public void setInboundChannelExecutor(org.springframework.core.task.TaskExecutor inboundChannelExecutor)
    • setOutboundChannelExecutor

      public void setOutboundChannelExecutor(org.springframework.core.task.TaskExecutor outboundChannelExecutor)
    • setSockJsTaskScheduler

      public void setSockJsTaskScheduler(org.springframework.scheduling.TaskScheduler sockJsTaskScheduler)
    • setLoggingPeriod

      public void setLoggingPeriod(long period)
      Set the frequency for logging information at INFO level in milliseconds. If set 0 or less than 0, the logging task is cancelled.

      By default this property is set to 30 minutes (30 * 60 * 1000).

    • getLoggingPeriod

      public long getLoggingPeriod()
      Return the configured logging period frequency in milliseconds.
    • afterSingletonsInstantiated

      public void afterSingletonsInstantiated()
      Specified by:
      afterSingletonsInstantiated in interface org.springframework.beans.factory.SmartInitializingSingleton
    • getWebSocketSessionStatsInfo

      @Deprecated(since="6.2", forRemoval=true) public String getWebSocketSessionStatsInfo()
      Deprecated, for removal: This API element is subject to removal in a future version.
      as of 6.2 in favor of getWebSocketSessionStats().
      Get stats about WebSocket sessions.
    • getWebSocketSessionStats

      @Nullable public SubProtocolWebSocketHandler.Stats getWebSocketSessionStats()
      Get stats about WebSocket sessions. Can return null if no WebSocket handler is configured.
      Since:
      6.2
    • getStompSubProtocolStatsInfo

      @Deprecated(since="6.2", forRemoval=true) public String getStompSubProtocolStatsInfo()
      Deprecated, for removal: This API element is subject to removal in a future version.
      as of 6.2 in favor of getStompSubProtocolStats().
      Get stats about STOMP-related WebSocket message processing.
    • getStompSubProtocolStats

      @Nullable public StompSubProtocolHandler.Stats getStompSubProtocolStats()
      Get stats about STOMP-related WebSocket message processing. Can return null if no SubProtocolHandler was found.
      Since:
      6.2
    • getStompBrokerRelayStatsInfo

      @Deprecated(since="6.2", forRemoval=true) public String getStompBrokerRelayStatsInfo()
      Deprecated, for removal: This API element is subject to removal in a future version.
      as of 6.2 in favor of getStompBrokerRelayStats().
      Get stats about STOMP broker relay (when using a full-featured STOMP broker).
    • getStompBrokerRelayStats

      @Nullable public org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler.Stats getStompBrokerRelayStats()
      Get stats about STOMP broker relay (when using a full-featured STOMP broker). Can return null if no STOMP broker relay is configured.
      Since:
      6.2
    • getClientInboundExecutorStatsInfo

      public String getClientInboundExecutorStatsInfo()
      Get stats about the executor processing incoming messages from WebSocket clients.
    • getClientOutboundExecutorStatsInfo

      public String getClientOutboundExecutorStatsInfo()
      Get stats about the executor processing outgoing messages to WebSocket clients.
    • getSockJsTaskSchedulerStatsInfo

      public String getSockJsTaskSchedulerStatsInfo()
      Get stats about the SockJS task scheduler.
    • toString

      public String toString()
      Overrides:
      toString in class Object