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
HandlerMethodReturnValueHandler s
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
HandlerMethodReturnValueHandler
s
that send messages from controller return values.
By default this property is not set.
public MessageHeaderInitializer getHeaderInitializer()
public int getPhase()
Phased
public boolean isAutoStartup()
SmartLifecycle
isAutoStartup
in interface SmartLifecycle
public final boolean isRunning()
Lifecycle
In the case of a container, this will return true
only if all components that apply are currently running.
public final void start()
Lifecycle
In the case of a container, this will propagate the start signal to all components that apply.
public final void stop()
Lifecycle
SmartLifecycle
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 Lifecycle
SmartLifecycle.stop(Runnable)
public final void stop(Runnable callback)
SmartLifecycle
The 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 SmartLifecycle
public void handleMessage(Message<?> message) throws MessagingException
MessageHandler
handleMessage
in interface MessageHandler
message
- the message to be handledMessagingException