public class SimpMessagingTemplate extends AbstractMessageSendingTemplate<java.lang.String> implements SimpMessageSendingOperations
AbstractMessageSendingTemplate
that adds String-based
destinations as a message header.Modifier and Type | Field and Description |
---|---|
private MessageChannel |
messageChannel |
private long |
sendTimeout |
private java.lang.String |
userDestinationPrefix |
logger
Constructor and Description |
---|
SimpMessagingTemplate(MessageChannel messageChannel) |
Modifier and Type | Method and Description |
---|---|
<T> void |
convertAndSendToUser(java.lang.String user,
java.lang.String destination,
T message)
Send a message to a specific user.
|
<T> void |
convertAndSendToUser(java.lang.String user,
java.lang.String destination,
T message,
MessagePostProcessor postProcessor)
Send a message to a specific user.
|
protected void |
doSend(java.lang.String destination,
Message<?> message) |
MessageChannel |
getMessageChannel() |
long |
getSendTimeout() |
java.lang.String |
getUserDestinationPrefix() |
<P> void |
send(Message<P> message) |
void |
setSendTimeout(long sendTimeout)
Specify the timeout value to use for send operations.
|
void |
setUserDestinationPrefix(java.lang.String prefix)
Configure the prefix to use for destinations targeting a specific user.
|
convertAndSend, convertAndSend, convertAndSend, convertAndSend, getConverter, getDefaultDestination, getRequiredDefaultDestination, send, setConverter, setDefaultDestination, setMessageConverter
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
convertAndSend, convertAndSend, convertAndSend, convertAndSend, send
private final MessageChannel messageChannel
private java.lang.String userDestinationPrefix
private volatile long sendTimeout
public SimpMessagingTemplate(MessageChannel messageChannel)
public void setUserDestinationPrefix(java.lang.String prefix)
The default value is "/user/".
UserDestinationMessageHandler
public java.lang.String getUserDestinationPrefix()
public MessageChannel getMessageChannel()
public void setSendTimeout(long sendTimeout)
sendTimeout
- the send timeout in millisecondspublic long getSendTimeout()
public <P> void send(Message<P> message)
send
in interface MessageSendingOperations<java.lang.String>
send
in class AbstractMessageSendingTemplate<java.lang.String>
protected void doSend(java.lang.String destination, Message<?> message)
doSend
in class AbstractMessageSendingTemplate<java.lang.String>
public <T> void convertAndSendToUser(java.lang.String user, java.lang.String destination, T message) throws MessagingException
SimpMessageSendingOperations
convertAndSendToUser
in interface SimpMessageSendingOperations
user
- the user that should receive the message.destination
- the destination to send the message to.message
- the message to sendMessagingException
public <T> void convertAndSendToUser(java.lang.String user, java.lang.String destination, T message, MessagePostProcessor postProcessor) throws MessagingException
SimpMessageSendingOperations
convertAndSendToUser
in interface SimpMessageSendingOperations
user
- the user that should receive the message.destination
- the destination to send the message to.message
- the message to sendpostProcessor
- a postProcessor to post-process or modify the created messageMessagingException