类 StompBrokerRelayMessageHandler

    • 构造器详细资料

      • StompBrokerRelayMessageHandler

        public StompBrokerRelayMessageHandler​(SubscribableChannel inboundChannel,
                                              MessageChannel outboundChannel,
                                              SubscribableChannel brokerChannel,
                                              Collection<String> destinationPrefixes)
        Create a StompBrokerRelayMessageHandler instance with the given message channels and destination prefixes.
        参数:
        inboundChannel - the channel for receiving messages from clients (e.g. WebSocket clients)
        outboundChannel - the channel for sending messages to clients (e.g. WebSocket clients)
        brokerChannel - the channel for the application to send messages to the broker
        destinationPrefixes - the broker supported destination prefixes; destinations that do not match the given prefix are ignored.
    • 方法详细资料

      • setRelayHost

        public void setRelayHost​(String relayHost)
        Set the STOMP message broker host.
      • setRelayPort

        public void setRelayPort​(int relayPort)
        Set the STOMP message broker port.
      • getRelayPort

        public int getRelayPort()
        Return the STOMP message broker port.
      • setClientLogin

        public void setClientLogin​(String clientLogin)
        Set the login to use when creating connections to the STOMP broker on behalf of connected clients.

        By default this is set to "guest".

        另请参阅:
        setSystemLogin(String)
      • setSystemLogin

        public void setSystemLogin​(String systemLogin)
        Set the login for the shared "system" connection used to send messages to the STOMP broker from within the application, i.e. messages not associated with a specific client session (e.g. REST/HTTP request handling method).

        By default this is set to "guest".

      • getSystemLogin

        public String getSystemLogin()
        Return the login used for the shared "system" connection to the STOMP broker.
      • setSystemPasscode

        public void setSystemPasscode​(String systemPasscode)
        Set the passcode for the shared "system" connection used to send messages to the STOMP broker from within the application, i.e. messages not associated with a specific client session (e.g. REST/HTTP request handling method).

        By default this is set to "guest".

      • getSystemPasscode

        public String getSystemPasscode()
        Return the passcode used for the shared "system" connection to the STOMP broker.
      • setSystemHeartbeatSendInterval

        public void setSystemHeartbeatSendInterval​(long systemHeartbeatSendInterval)
        Set the interval, in milliseconds, at which the "system" connection will, in the absence of any other data being sent, send a heartbeat to the STOMP broker. A value of zero will prevent heartbeats from being sent to the broker.

        The default value is 10000.

        See class-level documentation for more information on the "system" connection.

      • getSystemHeartbeatSendInterval

        public long getSystemHeartbeatSendInterval()
        Return the interval, in milliseconds, at which the "system" connection will send heartbeats to the STOMP broker.
      • setSystemHeartbeatReceiveInterval

        public void setSystemHeartbeatReceiveInterval​(long heartbeatReceiveInterval)
        Set the maximum interval, in milliseconds, at which the "system" connection expects, in the absence of any other data, to receive a heartbeat from the STOMP broker. A value of zero will configure the connection to expect not to receive heartbeats from the broker.

        The default value is 10000.

        See class-level documentation for more information on the "system" connection.

      • getSystemHeartbeatReceiveInterval

        public long getSystemHeartbeatReceiveInterval()
        Return the interval, in milliseconds, at which the "system" connection expects to receive heartbeats from the STOMP broker.
      • setSystemSubscriptions

        public void setSystemSubscriptions​(Map<String,​MessageHandler> subscriptions)
        Configure one more destinations to subscribe to on the shared "system" connection along with MessageHandler's to handle received messages.

        This is for internal use in a multi-application server scenario where servers forward messages to each other (e.g. unresolved user destinations).

        参数:
        subscriptions - the destinations to subscribe to.
      • setVirtualHost

        public void setVirtualHost​(String virtualHost)
        Set the value of the "host" header to use in STOMP CONNECT frames. When this property is configured, a "host" header will be added to every STOMP frame sent to the STOMP broker. This may be useful for example in a cloud environment where the actual host to which the TCP connection is established is different from the host providing the cloud-based STOMP service.

        By default this property is not set.

      • setTcpClient

        public void setTcpClient​(TcpOperations<byte[]> tcpClient)
        Configure a TCP client for managing TCP connections to the STOMP broker. By default Reactor2TcpClient is used.

        Note: when this property is used, any host or port specified are effectively ignored.

      • getTcpClient

        public TcpOperations<byte[]> getTcpClient()
        Get the configured TCP client (never null unless not configured invoked and this method is invoked before the handler is started and hence a default implementation initialized).
      • getStatsInfo

        public String getStatsInfo()
        Return a String describing internal state and counters.
      • getConnectionCount

        public int getConnectionCount()
        Return the current count of TCP connection to the broker.