Class WebSocketConfigProperties

java.lang.Object
net.brabenetz.app.springstompserver.config.WebSocketConfigProperties

@Component @ConfigurationProperties("spring-stomp-server") public class WebSocketConfigProperties extends Object
Additional Websocket Stomp Properties use in the WebSocketConfig.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Gets the cache limit to apply for registrations with the broker.
    int
    Gets the channel PoolSize used to send messages from the application to the message broker.
    int
    Gets the MessageChannel PoolSize used for incoming messages from WebSocket clients.
    See WebSocketMessageBrokerConfigurer.configureClientInboundChannel(org.springframework.messaging.simp.config.ChannelRegistration)
    int
    Gets the MessageChannel PoolSize used for outbound messages to WebSocket clients.
    See WebSocketMessageBrokerConfigurer.configureClientOutboundChannel(org.springframework.messaging.simp.config.ChannelRegistration)
    Gets the Simple Message Broker destination prefixes which are handled by the WebSocket Stomp-Endpoint.
    Gets the WebSocketTransportRegistration messageSizeLimit.
    Gets the WebSocketTransportRegistration sendBufferSizeLimit.
    Gets the WebSocketTransportRegistration sendTimeLimit.
    Gets the WebSocketTransportRegistration timeToFirstMessage.
    Gets the Websocket Endpoint which are handled by the StompEndpointRegistry.
    boolean
    Checks if is activation of SocketJs: Set to true if a SockJs-Supported Endpoint should be registered.
    void
    setBrokerRegistryCacheLimit(int brokerRegistryCacheLimit)
    Sets the cache limit to apply for registrations with the broker.
    void
    setChannelBrokerCorePoolSize(int channelBrokerCorePoolSize)
    Sets the channel PoolSize used to send messages from the application to the message broker.
    void
    setChannelInboundCorePoolSize(int channelInboundCorePoolSize)
    Sets the MessageChannel PoolSize used for incoming messages from WebSocket clients.
    See WebSocketMessageBrokerConfigurer.configureClientInboundChannel(org.springframework.messaging.simp.config.ChannelRegistration)
    void
    setChannelOutboundCorePoolSize(int channelOutboundCorePoolSize)
    Sets the MessageChannel PoolSize used for outbound messages to WebSocket clients.
    See WebSocketMessageBrokerConfigurer.configureClientOutboundChannel(org.springframework.messaging.simp.config.ChannelRegistration)
    void
    setDestinationPrefixes(String... destinationPrefixes)
    Sets the Simple Message Broker destination prefixes which are handled by the WebSocket Stomp-Endpoint.
    void
    setMessageSizeLimit(Integer messageSizeLimit)
    Sets the WebSocketTransportRegistration messageSizeLimit.
    void
    setSendBufferSizeLimit(Integer sendBufferSizeLimit)
    Sets the WebSocketTransportRegistration sendBufferSizeLimit.
    void
    setSendTimeLimit(Integer sendTimeLimit)
    Sets the WebSocketTransportRegistration sendTimeLimit.
    void
    setTimeToFirstMessage(Integer timeToFirstMessage)
    Sets the WebSocketTransportRegistration timeToFirstMessage.
    void
    setWebsocketEndpoints(String... websocketEndpoints)
    Sets the Websocket Endpoint which are handled by the StompEndpointRegistry.
    void
    setWithSockJs(boolean withSockJs)
    Sets the activation of SocketJs: Set to true if a SockJs-Supported Endpoint should be registered.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WebSocketConfigProperties

      public WebSocketConfigProperties()
  • Method Details

    • getDestinationPrefixes

      public String[] getDestinationPrefixes()
      Gets the Simple Message Broker destination prefixes which are handled by the WebSocket Stomp-Endpoint.
      Returns:
      the Simple Message Broker destination prefixes which are handled by the WebSocket Stomp-Endpoint
    • setDestinationPrefixes

      public void setDestinationPrefixes(String... destinationPrefixes)
      Sets the Simple Message Broker destination prefixes which are handled by the WebSocket Stomp-Endpoint.
      Parameters:
      destinationPrefixes - the new Simple Message Broker destination prefixes which are handled by the WebSocket Stomp-Endpoint
    • getWebsocketEndpoints

      public String[] getWebsocketEndpoints()
      Gets the Websocket Endpoint which are handled by the StompEndpointRegistry.

      Both variants with and without sockJs are supported.

      Returns:
      the Websocket Endpoint which are handled by the StompEndpointRegistry
    • setWebsocketEndpoints

      public void setWebsocketEndpoints(String... websocketEndpoints)
      Sets the Websocket Endpoint which are handled by the StompEndpointRegistry.

      Both variants with and without sockJs are supported.

      Parameters:
      websocketEndpoints - the new Websocket Endpoint which are handled by the StompEndpointRegistry
    • getMessageSizeLimit

      public Integer getMessageSizeLimit()
      Gets the WebSocketTransportRegistration messageSizeLimit. Optional, The default value is 64K (i.e. 64 * 1024).
      Returns:
      the WebSocketTransportRegistration messageSizeLimit
    • setMessageSizeLimit

      public void setMessageSizeLimit(Integer messageSizeLimit)
      Sets the WebSocketTransportRegistration messageSizeLimit. Optional, The default value is 64K (i.e. 64 * 1024).
      Parameters:
      messageSizeLimit - the new WebSocketTransportRegistration messageSizeLimit
    • getSendBufferSizeLimit

      public Integer getSendBufferSizeLimit()
      Gets the WebSocketTransportRegistration sendBufferSizeLimit. Optional, The default value is 512K (i.e. 512 * 1024).
      Returns:
      the WebSocketTransportRegistration sendBufferSizeLimit
    • setSendBufferSizeLimit

      public void setSendBufferSizeLimit(Integer sendBufferSizeLimit)
      Sets the WebSocketTransportRegistration sendBufferSizeLimit. Optional, The default value is 512K (i.e. 512 * 1024).
      Parameters:
      sendBufferSizeLimit - the new WebSocketTransportRegistration sendBufferSizeLimit
    • getSendTimeLimit

      public Integer getSendTimeLimit()
      Gets the WebSocketTransportRegistration sendTimeLimit. Optional, The default value is 10 seconds (i.e. 10 * 10000).
      Returns:
      the WebSocketTransportRegistration sendTimeLimit
    • setSendTimeLimit

      public void setSendTimeLimit(Integer sendTimeLimit)
      Sets the WebSocketTransportRegistration sendTimeLimit. Optional, The default value is 10 seconds (i.e. 10 * 10000).
      Parameters:
      sendTimeLimit - the new WebSocketTransportRegistration sendTimeLimit
    • getTimeToFirstMessage

      public Integer getTimeToFirstMessage()
      Gets the WebSocketTransportRegistration timeToFirstMessage. Optional, The default is set to 60,000 (1 minute).
      Returns:
      the WebSocketTransportRegistration timeToFirstMessage
    • setTimeToFirstMessage

      public void setTimeToFirstMessage(Integer timeToFirstMessage)
      Sets the WebSocketTransportRegistration timeToFirstMessage. Optional, The default is set to 60,000 (1 minute).
      Parameters:
      timeToFirstMessage - the new WebSocketTransportRegistration timeToFirstMessage
    • isWithSockJs

      public boolean isWithSockJs()
      Checks if is activation of SocketJs: Set to true if a SockJs-Supported Endpoint should be registered.

      Default is false, because nowadays (2020) all Browsers support Websockets natively.

      Returns:
      the activation of SocketJs: Set to true if a SockJs-Supported Endpoint should be registered
    • setWithSockJs

      public void setWithSockJs(boolean withSockJs)
      Sets the activation of SocketJs: Set to true if a SockJs-Supported Endpoint should be registered.

      Default is false, because nowadays (2020) all Browsers support Websockets natively.

      Parameters:
      withSockJs - the new activation of SocketJs: Set to true if a SockJs-Supported Endpoint should be registered
    • getBrokerRegistryCacheLimit

      public int getBrokerRegistryCacheLimit()
      Gets the cache limit to apply for registrations with the broker.

      This is currently only applied for the destination cache in the subscription registry. The default cache limit there is 1024.

      For performance-testing read https://programmersought.com/article/58855147686/
      .. There is a fatal weakness in SimpleBrokerMessageHandler ..
      .. If the cache size exceeds the cacheLimit value, the original old The data is cleaned up, and when it is read again ..

      Returns:
      the cache limit to apply for registrations with the broker
    • setBrokerRegistryCacheLimit

      public void setBrokerRegistryCacheLimit(int brokerRegistryCacheLimit)
      Sets the cache limit to apply for registrations with the broker.

      This is currently only applied for the destination cache in the subscription registry. The default cache limit there is 1024.

      For performance-testing read https://programmersought.com/article/58855147686/
      .. There is a fatal weakness in SimpleBrokerMessageHandler ..
      .. If the cache size exceeds the cacheLimit value, the original old The data is cleaned up, and when it is read again ..

      Parameters:
      brokerRegistryCacheLimit - the new cache limit to apply for registrations with the broker
    • getChannelInboundCorePoolSize

      public int getChannelInboundCorePoolSize()
      Gets the MessageChannel PoolSize used for incoming messages from WebSocket clients.
      See WebSocketMessageBrokerConfigurer.configureClientInboundChannel(org.springframework.messaging.simp.config.ChannelRegistration)

      By default the channel is backedby a thread pool of size 1.

      Returns:
      the MessageChannel PoolSize used for incoming messages from WebSocket clients
    • setChannelInboundCorePoolSize

      public void setChannelInboundCorePoolSize(int channelInboundCorePoolSize)
      Sets the MessageChannel PoolSize used for incoming messages from WebSocket clients.
      See WebSocketMessageBrokerConfigurer.configureClientInboundChannel(org.springframework.messaging.simp.config.ChannelRegistration)

      By default the channel is backedby a thread pool of size 1.

      Parameters:
      channelInboundCorePoolSize - the new MessageChannel PoolSize used for incoming messages from WebSocket clients
    • getChannelOutboundCorePoolSize

      public int getChannelOutboundCorePoolSize()
      Gets the MessageChannel PoolSize used for outbound messages to WebSocket clients.
      See WebSocketMessageBrokerConfigurer.configureClientOutboundChannel(org.springframework.messaging.simp.config.ChannelRegistration)

      By default the channel is backed by a thread pool of size 1.

      Returns:
      the MessageChannel PoolSize used for outbound messages to WebSocket clients
    • setChannelOutboundCorePoolSize

      public void setChannelOutboundCorePoolSize(int channelOutboundCorePoolSize)
      Sets the MessageChannel PoolSize used for outbound messages to WebSocket clients.
      See WebSocketMessageBrokerConfigurer.configureClientOutboundChannel(org.springframework.messaging.simp.config.ChannelRegistration)

      By default the channel is backed by a thread pool of size 1.

      Parameters:
      channelOutboundCorePoolSize - the new MessageChannel PoolSize used for outbound messages to WebSocket clients
    • getChannelBrokerCorePoolSize

      public int getChannelBrokerCorePoolSize()
      Gets the channel PoolSize used to send messages from the application to the message broker.

      By default, messages from the application to the message broker are sent synchronously, which means application code sending a message will find out if the message cannot be sent through an exception.
      However, this can be changed if the broker channel is configured here with task executor properties.

      Returns:
      the channel PoolSize used to send messages from the application to the message broker
    • setChannelBrokerCorePoolSize

      public void setChannelBrokerCorePoolSize(int channelBrokerCorePoolSize)
      Sets the channel PoolSize used to send messages from the application to the message broker.

      By default, messages from the application to the message broker are sent synchronously, which means application code sending a message will find out if the message cannot be sent through an exception.
      However, this can be changed if the broker channel is configured here with task executor properties.

      Parameters:
      channelBrokerCorePoolSize - the new channel PoolSize used to send messages from the application to the message broker