public class SimpMessagingTemplate extends AbstractMessageSendingTemplate<String> implements SimpMessageSendingOperations
AbstractMessageSendingTemplate that interprets a
 String-based destination as the
 DESTINATION_HEADER
 to be added to the headers of sent messages.
 
 Also provides methods for sending messages to a user. See
 UserDestinationResolver
 for more on user destinations.
logger| Constructor and Description | 
|---|
SimpMessagingTemplate(MessageChannel messageChannel)
Create a new  
SimpMessagingTemplate instance. | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
convertAndSendToUser(String user,
                    String destination,
                    Object payload)
Send a message to a specific user. 
 | 
void | 
convertAndSendToUser(String user,
                    String destination,
                    Object payload,
                    Map<String,Object> headers)
Send a message to a specific user. 
 | 
void | 
convertAndSendToUser(String user,
                    String destination,
                    Object payload,
                    Map<String,Object> headers,
                    MessagePostProcessor postProcessor)
Send a message to a specific user. 
 | 
void | 
convertAndSendToUser(String user,
                    String destination,
                    Object payload,
                    MessagePostProcessor postProcessor)
Send a message to a specific user. 
 | 
protected void | 
doSend(String destination,
      Message<?> message)  | 
MessageChannel | 
getMessageChannel()
Return the configured message channel. 
 | 
long | 
getSendTimeout()
Return the configured send timeout (in milliseconds). 
 | 
String | 
getUserDestinationPrefix()
Return the configured user destination prefix. 
 | 
protected Map<String,Object> | 
processHeadersToSend(Map<String,Object> headers)
Creates a new map and puts the given headers under the key
  
NATIVE_HEADERS. | 
void | 
send(Message<?> message)
Send a message to a default destination. 
 | 
void | 
setSendTimeout(long sendTimeout)
Specify the timeout value to use for send operations (in milliseconds). 
 | 
void | 
setUserDestinationPrefix(String prefix)
Configure the prefix to use for destinations targeting a specific user. 
 | 
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, getDefaultDestination, getMessageConverter, getRequiredDefaultDestination, send, setDefaultDestination, setMessageConverterclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconvertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, sendpublic SimpMessagingTemplate(MessageChannel messageChannel)
SimpMessagingTemplate instance.messageChannel - the message channel (must not be null)public MessageChannel getMessageChannel()
public void setUserDestinationPrefix(String prefix)
The default value is "/user/".
UserDestinationMessageHandlerpublic String getUserDestinationPrefix()
public void setSendTimeout(long sendTimeout)
public long getSendTimeout()
public void send(Message<?> message)
MessageSendingOperationssend in interface MessageSendingOperations<String>send in class AbstractMessageSendingTemplate<String>message - the message to sendprotected void doSend(String destination, Message<?> message)
doSend in class AbstractMessageSendingTemplate<String>public void convertAndSendToUser(String user, String destination, Object payload) throws MessagingException
SimpMessageSendingOperationsconvertAndSendToUser in interface SimpMessageSendingOperationsuser - the user that should receive the message.destination - the destination to send the message to.payload - the payload to sendMessagingExceptionpublic void convertAndSendToUser(String user, String destination, Object payload, Map<String,Object> headers) throws MessagingException
SimpMessageSendingOperationsconvertAndSendToUser in interface SimpMessageSendingOperationsuser - the user that should receive the message.destination - the destination to send the message to.payload - the payload to sendheaders - the message headersMessagingExceptionpublic void convertAndSendToUser(String user, String destination, Object payload, MessagePostProcessor postProcessor) throws MessagingException
SimpMessageSendingOperationsconvertAndSendToUser in interface SimpMessageSendingOperationsuser - the user that should receive the message.destination - the destination to send the message to.payload - the payload to sendpostProcessor - a postProcessor to post-process or modify the created messageMessagingExceptionpublic void convertAndSendToUser(String user, String destination, Object payload, Map<String,Object> headers, MessagePostProcessor postProcessor) throws MessagingException
SimpMessageSendingOperationsconvertAndSendToUser in interface SimpMessageSendingOperationsuser - the user that should receive the message.destination - the destination to send the message to.payload - the payload to sendheaders - the message headerspostProcessor - a postProcessor to post-process or modify the created messageMessagingExceptionprotected Map<String,Object> processHeadersToSend(Map<String,Object> headers)
NATIVE_HEADERS.
 Effectively this treats all given headers as headers to be sent out to the
 external source.
 If the given headers already contain the key
 NATIVE_HEADERS
 then the same header map is returned (i.e. without any changes).
processHeadersToSend in class AbstractMessageSendingTemplate<String>headers - the headers to send or nullnull