public class UserDestinationMessageHandler extends Object implements MessageHandler, SmartLifecycle
See UserDestinationResolver for more details and examples.
| Constructor and Description |
|---|
UserDestinationMessageHandler(SubscribableChannel clientInChannel,
SubscribableChannel brokerChannel,
UserDestinationResolver userDestinationResolver)
Create an instance of the handler with the given messaging template and a
user destination resolver.
|
| Modifier and Type | Method and Description |
|---|---|
MessageSendingOperations<String> |
getBrokerMessagingTemplate()
Return the configured messaging template for sending messages with
translated destinations.
|
MessageHeaderInitializer |
getHeaderInitializer() |
int |
getPhase()
Return the phase value of this object.
|
UserDestinationResolver |
getUserDestinationResolver()
Return the configured
UserDestinationResolver. |
void |
handleMessage(Message<?> message)
Handle the given message.
|
boolean |
isAutoStartup()
Return whether this Lifecycle component should be started automatically
by the container when the ApplicationContext is refreshed.
|
boolean |
isRunning()
Check whether this component is currently running.
|
void |
setHeaderInitializer(MessageHeaderInitializer headerInitializer)
Configure a
MessageHeaderInitializer to pass on to
HandlerMethodReturnValueHandlers
that send messages from controller return values. |
void |
start()
Start this component.
|
void |
stop()
Stop this component, typically in a synchronous fashion, such that
the component is fully stopped upon return of this method.
|
void |
stop(Runnable callback)
Indicates that a Lifecycle component must stop if it is currently running.
|
String |
toString() |
public UserDestinationMessageHandler(SubscribableChannel clientInChannel, SubscribableChannel brokerChannel, UserDestinationResolver userDestinationResolver)
clientInChannel - the channel for receiving messages from clients (e.g. WebSocket clients)brokerChannel - the channel for sending messages with translated user destinationsuserDestinationResolver - the resolver to use to find queue suffixes for a userpublic MessageSendingOperations<String> getBrokerMessagingTemplate()
public UserDestinationResolver getUserDestinationResolver()
UserDestinationResolver.public void setHeaderInitializer(MessageHeaderInitializer headerInitializer)
MessageHeaderInitializer to pass on to
HandlerMethodReturnValueHandlers
that send messages from controller return values.
By default this property is not set.
public MessageHeaderInitializer getHeaderInitializer()
public int getPhase()
Phasedpublic boolean isAutoStartup()
SmartLifecycleisAutoStartup in interface SmartLifecyclepublic final boolean isRunning()
LifecycleIn the case of a container, this will return true
only if all components that apply are currently running.
public final void start()
LifecycleIn the case of a container, this will propagate the start signal to all components that apply.
public final void stop()
LifecycleSmartLifecycle and its stop(Runnable)
variant in cases where asynchronous stop behavior is necessary.
Should not throw an exception if the component isn't started yet.
In the case of a container, this will propagate the stop signal to all components that apply.
stop in interface LifecycleSmartLifecycle.stop(Runnable)public final void stop(Runnable callback)
SmartLifecycleThe provided callback is used by the LifecycleProcessor to support an
ordered, and potentially concurrent, shutdown of all components having a
common shutdown order value. The callback must be executed after
the SmartLifecycle component does indeed stop.
The LifecycleProcessor will call only this variant of the
stop method; i.e. Lifecycle.stop() will not be called for
SmartLifecycle implementations unless explicitly delegated to within
this method.
stop in interface SmartLifecyclepublic void handleMessage(Message<?> message) throws MessagingException
MessageHandlerhandleMessage in interface MessageHandlermessage - the message to be handledMessagingException