MessageHandler that broker messages to
registered subscribers.
| Modifier and Type | Class and Description |
|---|---|
| private class | AbstractBrokerMessageHandler.
Detect unsent DISCONNECT messages and process them anyway. |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private final BrokerAvailabilityEvent | |
| private final AtomicBoolean | |
| private final SubscribableChannel | |
| private final SubscribableChannel | |
| private final MessageChannel | |
| private final Collection | |
| private ApplicationEventPublisher | |
| private final Object | |
| protected final Log | |
| private final BrokerAvailabilityEvent | |
| private Integer | |
| private boolean | |
| private volatile boolean | |
| private final ChannelInterceptor | |
| private Predicate |
| Access | Constructor and Description |
|---|---|
| public | AbstractBrokerMessageHandler(SubscribableChannel
the channel for receiving messages from clients (e.g. WebSocket clients) inboundChannel, MessageChannel the channel for sending messages to clients (e.g. WebSocket clients) outboundChannel, SubscribableChannel the channel for the application to send messages to the broker brokerChannel)Constructor with no destination prefixes (matches all destinations). |
| public | AbstractBrokerMessageHandler(SubscribableChannel
the channel for receiving messages from clients (e.g. WebSocket clients) inboundChannel, MessageChannel the channel for sending messages to clients (e.g. WebSocket clients) outboundChannel, SubscribableChannel the channel for the application to send messages to the broker brokerChannel, Collection<String> prefixes to use to filter out messages destinationPrefixes)Constructor with destination prefixes to match to destinations of messages. |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | Returns: whether to process (true) or skip (false) the destinationthe destination to check destination)Whether a message with the given destination should be processed. |
| public ApplicationEventPublisher | |
| public SubscribableChannel | |
| public SubscribableChannel | |
| public MessageChannel | |
| protected MessageChannel | getClientOutboundChannelForSession(String sessionId)
Get the MessageChannel to use for sending messages to clients, possibly
a per-session wrapper when |
| public Collection | getDestinationPrefixes()
Return destination prefixes to use to filter messages to forward to the broker. |
| public int | getPhase()
Overrides default org. Return the phase that this lifecycle object is supposed to run in. The default implementation returns |
| public void | handleMessage(Message<?>
the message to be handled message)Implements org. Handle the given message. |
| protected abstract void | |
| public boolean | isAutoStartup()
Overrides default org. Returns |
| public boolean | |
| public boolean | |
| public final boolean | isRunning()
Implements org. Check whether this message handler is currently running. |
| private boolean | |
| protected void | |
| protected void | |
| public void | setApplicationEventPublisher(ApplicationEventPublisher
event publisher to be used by this object publisher)Implements org. Set the ApplicationEventPublisher that this object runs in. Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. |
| public void | |
| public void | setPhase(int phase)
Set the phase that this handler should run in. By default, this is |
| public void | setPreservePublishOrder(boolean
whether to publish in order preservePublishOrder)Whether the client must receive messages in the order of publication. |
| public void | setUserDestinationPredicate(Predicate<String>
the predicate to identify user messages with a non-null
destination as messages with a user destinations. predicate)Configure a Predicate to identify messages with a user destination. |
| public void | |
| protected void | |
| public void | stop()
Implements org. Stop this component, typically in a synchronous fashion, such that the component is fully stopped upon return of this method. |
| public final void | stop(Runnable callback)
Overrides default org. Indicates that a Lifecycle component must stop if it is currently running. |
| protected void |
| autoStartup | back to summary |
|---|---|
| private boolean autoStartup | |
| availableEvent | back to summary |
|---|---|
| private final BrokerAvailabilityEvent availableEvent | |
| brokerAvailable | back to summary |
|---|---|
| private final AtomicBoolean brokerAvailable | |
| brokerChannel | back to summary |
|---|---|
| private final SubscribableChannel brokerChannel | |
| clientInboundChannel | back to summary |
|---|---|
| private final SubscribableChannel clientInboundChannel | |
| clientOutboundChannel | back to summary |
|---|---|
| private final MessageChannel clientOutboundChannel | |
| destinationPrefixes | back to summary |
|---|---|
| private final Collection<String> destinationPrefixes | |
| eventPublisher | back to summary |
|---|---|
| private ApplicationEventPublisher eventPublisher
| |
| lifecycleMonitor | back to summary |
|---|---|
| private final Object lifecycleMonitor | |
| logger | back to summary |
|---|---|
| protected final Log logger | |
| notAvailableEvent | back to summary |
|---|---|
| private final BrokerAvailabilityEvent notAvailableEvent | |
| phase | back to summary |
|---|---|
| private Integer phase
| |
| preservePublishOrder | back to summary |
|---|---|
| private boolean preservePublishOrder | |
| running | back to summary |
|---|---|
| private volatile boolean running | |
| unsentDisconnectInterceptor | back to summary |
|---|---|
| private final ChannelInterceptor unsentDisconnectInterceptor | |
| userDestinationPredicate | back to summary |
|---|---|
| private Predicate<String> userDestinationPredicate
| |
| AbstractBrokerMessageHandler | back to summary |
|---|---|
| public AbstractBrokerMessageHandler(SubscribableChannel inboundChannel, MessageChannel outboundChannel, SubscribableChannel brokerChannel) Constructor with no destination prefixes (matches all destinations).
| |
| AbstractBrokerMessageHandler | back to summary |
|---|---|
| public AbstractBrokerMessageHandler(SubscribableChannel inboundChannel, MessageChannel outboundChannel, SubscribableChannel brokerChannel, Collection<String> destinationPrefixes) Constructor with destination prefixes to match to destinations of messages.
| |
| checkDestinationPrefix | back to summary |
|---|---|
| protected boolean checkDestinationPrefix(String destination) Whether a message with the given destination should be processed. This is the case if one of the following conditions is true:
| |
| getApplicationEventPublisher | back to summary |
|---|---|
public ApplicationEventPublisher getApplicationEventPublisher()
| |
| getBrokerChannel | back to summary |
|---|---|
| public SubscribableChannel getBrokerChannel() | |
| getClientInboundChannel | back to summary |
|---|---|
| public SubscribableChannel getClientInboundChannel() | |
| getClientOutboundChannel | back to summary |
|---|---|
| public MessageChannel getClientOutboundChannel() | |
| getClientOutboundChannelForSession | back to summary |
|---|---|
| protected MessageChannel getClientOutboundChannelForSession(String sessionId) Get the MessageChannel to use for sending messages to clients, possibly
a per-session wrapper when
| |
| getDestinationPrefixes | back to summary |
|---|---|
| public Collection Return destination prefixes to use to filter messages to forward to the broker. Messages that have a destination and where the destination doesn't match are ignored. By default this is not set. | |
| getPhase | back to summary |
|---|---|
| public int getPhase() Overrides default org. Doc from org. Return the phase that this lifecycle object is supposed to run in. The default implementation returns
| |
| handleMessage | back to summary |
|---|---|
| public void handleMessage(Message<?> message) Implements org. Doc from org. Handle the given message. | |
| handleMessageInternal | back to summary |
|---|---|
| protected abstract void handleMessageInternal(Message<?> message) | |
| isAutoStartup | back to summary |
|---|---|
| public boolean isAutoStartup() Overrides default org. Doc from org. Returns A value of The default implementation returns
| |
| isBrokerAvailable | back to summary |
|---|---|
| public boolean isBrokerAvailable() Whether the message broker is currently available and able to process messages. Note that this is in addition to the Application components may implement
| |
| isPreservePublishOrder | back to summary |
|---|---|
| public boolean isPreservePublishOrder() Whether to ensure messages are received in the order of publication.
| |
| isRunning | back to summary |
|---|---|
| public final boolean isRunning() Implements org. Check whether this message handler is currently running. Note that even when this message handler is running the
| |
| isUserDestination | back to summary |
|---|---|
| private boolean isUserDestination(String destination) | |
| publishBrokerAvailableEvent | back to summary |
|---|---|
| protected void publishBrokerAvailableEvent() | |
| publishBrokerUnavailableEvent | back to summary |
|---|---|
| protected void publishBrokerUnavailableEvent() | |
| setApplicationEventPublisher | back to summary |
|---|---|
| public void setApplicationEventPublisher(ApplicationEventPublisher publisher) Implements org. Doc from org. Set the ApplicationEventPublisher that this object runs in. Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. Invoked before ApplicationContextAware's setApplicationContext.
| |
| setAutoStartup | back to summary |
|---|---|
| public void setAutoStartup(boolean autoStartup) | |
| setPhase | back to summary |
|---|---|
| public void setPhase(int phase) Set the phase that this handler should run in. By default, this is
| |
| setPreservePublishOrder | back to summary |
|---|---|
| public void setPreservePublishOrder(boolean preservePublishOrder) Whether the client must receive messages in the order of publication. By default messages sent to the When this flag is set to
| |
| setUserDestinationPredicate | back to summary |
|---|---|
| public void setUserDestinationPredicate(Predicate<String> predicate) Configure a Predicate to identify messages with a user destination. When
no | |
| start | back to summary |
|---|---|
| public void start() Implements org. Doc from org. Start this component. Should not throw an exception if the component is already running. In the case of a container, this will propagate the start signal to all components that apply.
| |
| startInternal | back to summary |
|---|---|
| protected void startInternal() | |
| stop | back to summary |
|---|---|
| public void stop() Implements org. Doc from org. Stop this component, typically in a synchronous fashion, such that the component is
fully stopped upon return of this method. Consider implementing Note that this stop notification is not guaranteed to come before destruction:
On regular shutdown, Should not throw an exception if the component is not running (not started yet). In the case of a container, this will propagate the stop signal to all components that apply.
| |
| stop | back to summary |
|---|---|
| public final void stop(Runnable callback) Overrides default org. Doc from org. Indicates that a Lifecycle component must stop if it is currently running. The provided callback is used by the The The default implementation delegates to
| |
| stopInternal | back to summary |
|---|---|
| protected void stopInternal() | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterSendCompletion(Message<?> message, MessageChannel channel, boolean sent, Exception ex)
Overrides default org. Invoked after the completion of a send regardless of any exception that have been raised thus allowing for proper resource cleanup. |
| UnsentDisconnectChannelInterceptor | back to summary |
|---|---|
| private UnsentDisconnectChannelInterceptor() | |
| afterSendCompletion | back to summary |
|---|---|
| public void afterSendCompletion(Message<?> message, MessageChannel channel, boolean sent, Exception ex) Overrides default org. Doc from org. Invoked after the completion of a send regardless of any exception that have been raised thus allowing for proper resource cleanup. Note that this will be invoked only if
| |