public class SimpMessagingTemplate extends AbstractMessageSendingTemplate<String> implements SimpMessageSendingOperations
AbstractMessageSendingTemplate
that adds String-based
destinations as a message header.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() |
long |
getSendTimeout() |
String |
getUserDestinationPrefix() |
void |
send(Message<?> message)
Send a message to a default destination.
|
void |
setSendTimeout(long sendTimeout)
Specify the timeout value to use for send operations.
|
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, setMessageConverter
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, send
public SimpMessagingTemplate(MessageChannel messageChannel)
SimpMessagingTemplate
instance.messageChannel
- the message channel (must not be null
)public void setUserDestinationPrefix(String prefix)
The default value is "/user/".
UserDestinationMessageHandler
public String getUserDestinationPrefix()
public MessageChannel getMessageChannel()
public void setSendTimeout(long sendTimeout)
sendTimeout
- the send timeout in millisecondspublic long getSendTimeout()
public void send(Message<?> message)
MessageSendingOperations
send
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
SimpMessageSendingOperations
convertAndSendToUser
in interface SimpMessageSendingOperations
user
- the user that should receive the message.destination
- the destination to send the message to.payload
- the payload to sendMessagingException
public void convertAndSendToUser(String user, String destination, Object payload, Map<String,Object> headers) throws MessagingException
SimpMessageSendingOperations
convertAndSendToUser
in interface SimpMessageSendingOperations
user
- the user that should receive the message.destination
- the destination to send the message to.payload
- the payload to sendheaders
- the message headersMessagingException
public void convertAndSendToUser(String user, String destination, Object payload, 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.payload
- the payload to sendpostProcessor
- a postProcessor to post-process or modify the created messageMessagingException
public void convertAndSendToUser(String user, String destination, Object payload, Map<String,Object> headers, 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.payload
- the payload to sendheaders
- the message headerspostProcessor
- a postProcessor to post-process or modify the created messageMessagingException