Create a SimpleBrokerMessageHandler instance with the given message channels and destination prefixes. @param clientInboundChannel the channel for receiving messages from clients (e.g. WebSocket clients) @param clientOutboundChannel the channel for sending messages to clients (e.g. WebSocket clients) @param brokerChannel the channel for the application to send messages to the broker @param destinationPrefixes prefixes to use to filter out messages
Return the configured header initializer. @since 4.1
The configured value for the heart-beat settings. @since 4.2
When configured, the specified cache limit is passed down to the underlying SubscriptionRegistry, overriding any default there. <p>With a standard {@link DefaultSubscriptionRegistry}, the default cache limit is 1024. @since 4.3.2 @see #setSubscriptionRegistry @see DefaultSubscriptionRegistry#setCacheLimit @see DefaultSubscriptionRegistry#DEFAULT_CACHE_LIMIT
Configure a {@link MessageHeaderInitializer} to apply to the headers of all messages sent to the client outbound channel. <p>By default this property is not set. @since 4.1
Configure the value for the heart-beat settings. The first number represents how often the server will write or send a heartbeat. The second is how often the client should write. 0 means no heartbeats. <p>By default this is set to "0, 0" unless the {@link #setTaskScheduler taskScheduler} in which case the default becomes "10000,10000" (in milliseconds). @since 4.2
When configured, the given PathMatcher is passed down to the underlying SubscriptionRegistry to use for matching destination to subscriptions. <p>Default is a standard {@link hunt.framework.util.AntPathMatcher}. @since 4.1 @see #setSubscriptionRegistry @see DefaultSubscriptionRegistry#setPathMatcher @see hunt.framework.util.AntPathMatcher
Configure the name of a header that a subscription message can have for the purpose of filtering messages matched to the subscription. The header value is expected to be a Spring EL expression to be applied to the headers of messages matched to the subscription. <p>For example: <pre> headers.foo == 'bar' </pre> <p>By default this is set to "selector". You can set it to a different name, or to {@code null} to turn off support for a selector header. @param selectorHeaderName the name to use for a selector header @since 4.3.17 @see #setSubscriptionRegistry @see DefaultSubscriptionRegistry#setSelectorHeaderName(string)
Configure a custom SubscriptionRegistry to use for storing subscriptions. <p><strong>Note</strong> that when a custom PathMatcher is configured via {@link #setPathMatcher}, if the custom registry is not an instance of {@link DefaultSubscriptionRegistry}, the provided PathMatcher is not used and must be configured directly on the custom registry.
Whether the client must receive messages in the order of publication. <p>By default messages sent to the {@code "clientOutboundChannel"} may not be processed in the same order because the channel is backed by a ThreadPoolExecutor that in turn does not guarantee processing in order. <p>When this flag is set to {@code true} messages within the same session will be sent to the {@code "clientOutboundChannel"} one at a time in order to preserve the order of publication. Enable this only if needed since there is some performance overhead to keep messages in order. @param preservePublishOrder whether to publish in order @since 5.1
Whether to ensure messages are received in the order of publication. @since 5.1
Check whether this message handler is currently running. <p>Note that even when this message handler is running the {@link #isBrokerAvailable()} flag may still independently alternate between being on and off depending on the concrete sub-class implementation.
Whether the message broker is currently available and able to process messages. <p>Note that this is in addition to the {@link #isRunning()} flag, which indicates whether this message handler is running. In other words the message handler must first be running and then the {@code #isBrokerAvailable()} flag may still independently alternate between being on and off depending on the concrete sub-class implementation. <p>Application components may implement {@code hunt.framework.context.ApplicationListener<BrokerAvailabilityEvent>} to receive notifications when broker becomes available and unavailable.
Get the MessageChannel to use for sending messages to clients, possibly a per-session wrapper when {@code preservePublishOrder=true}. @since 5.1
A "simple" message broker that recognizes the message types defined in {@link SimpMessageType}, keeps track of subscriptions with the help of a {@link SubscriptionRegistry} and sends messages to subscribers.
@author Rossen Stoyanchev @author Juergen Hoeller @since 4.0