public abstract class AbstractMessageSendingTemplate<D> extends Object implements MessageSendingOperations<D>
MessageSendingOperations.| Constructor and Description |
|---|
AbstractMessageSendingTemplate() |
| Modifier and Type | Method and Description |
|---|---|
void |
convertAndSend(D destination,
Object payload)
Convert the given Object to serialized form, possibly using a
MessageConverter,
wrap it as a message and send it to the given destination. |
void |
convertAndSend(D destination,
Object payload,
Map<String,Object> headers)
Convert the given Object to serialized form, possibly using a
MessageConverter,
wrap it as a message with the given headers and send it to
a default destination. |
void |
convertAndSend(D destination,
Object payload,
Map<String,Object> headers,
MessagePostProcessor postProcessor)
Convert the given Object to serialized form, possibly using a
MessageConverter,
wrap it as a message with the given headers, apply the given post processor,
and send the resulting message to the given destination. |
void |
convertAndSend(D destination,
Object payload,
MessagePostProcessor postProcessor)
Convert the given Object to serialized form, possibly using a
MessageConverter,
wrap it as a message, apply the given post processor, and send
the resulting message to the given destination. |
void |
convertAndSend(Object payload)
Convert the given Object to serialized form, possibly using a
MessageConverter,
wrap it as a message and send it to a default destination. |
void |
convertAndSend(Object payload,
MessagePostProcessor postProcessor)
Convert the given Object to serialized form, possibly using a
MessageConverter,
wrap it as a message, apply the given post processor, and send
the resulting message to a default destination. |
protected abstract void |
doSend(D destination,
Message<?> message) |
D |
getDefaultDestination()
Return the configured default destination.
|
MessageConverter |
getMessageConverter()
Return the configured
MessageConverter. |
protected D |
getRequiredDefaultDestination() |
protected Map<String,Object> |
processHeadersToSend(Map<String,Object> headers)
Provides access to the map of headers before a send operation.
|
void |
send(D destination,
Message<?> message)
Send a message to the given destination.
|
void |
send(Message<?> message)
Send a message to a default destination.
|
void |
setDefaultDestination(D defaultDestination)
Configure the default destination to use in send methods that don't have
a destination argument.
|
void |
setMessageConverter(MessageConverter messageConverter)
Set the
MessageConverter to use in convertAndSend methods. |
protected final Log logger
public void setDefaultDestination(D defaultDestination)
public D getDefaultDestination()
public void setMessageConverter(MessageConverter messageConverter)
MessageConverter to use in convertAndSend methods.
By default, SimpleMessageConverter is used.
messageConverter - the message converter to usepublic MessageConverter getMessageConverter()
MessageConverter.public void send(Message<?> message)
MessageSendingOperationssend in interface MessageSendingOperations<D>message - the message to sendprotected final D getRequiredDefaultDestination()
public void send(D destination, Message<?> message)
MessageSendingOperationssend in interface MessageSendingOperations<D>destination - the target destinationmessage - the message to sendpublic void convertAndSend(Object payload) throws MessagingException
MessageSendingOperationsMessageConverter,
wrap it as a message and send it to a default destination.convertAndSend in interface MessageSendingOperations<D>payload - the Object to use as payloadMessagingExceptionpublic void convertAndSend(D destination, Object payload) throws MessagingException
MessageSendingOperationsMessageConverter,
wrap it as a message and send it to the given destination.convertAndSend in interface MessageSendingOperations<D>destination - the target destinationpayload - the Object to use as payloadMessagingExceptionpublic void convertAndSend(D destination, Object payload, Map<String,Object> headers) throws MessagingException
MessageSendingOperationsMessageConverter,
wrap it as a message with the given headers and send it to
a default destination.convertAndSend in interface MessageSendingOperations<D>destination - the target destinationpayload - the Object to use as payloadheaders - headers for the message to sendMessagingExceptionpublic void convertAndSend(Object payload, MessagePostProcessor postProcessor) throws MessagingException
MessageSendingOperationsMessageConverter,
wrap it as a message, apply the given post processor, and send
the resulting message to a default destination.convertAndSend in interface MessageSendingOperations<D>payload - the Object to use as payloadpostProcessor - the post processor to apply to the messageMessagingExceptionpublic void convertAndSend(D destination, Object payload, MessagePostProcessor postProcessor) throws MessagingException
MessageSendingOperationsMessageConverter,
wrap it as a message, apply the given post processor, and send
the resulting message to the given destination.convertAndSend in interface MessageSendingOperations<D>destination - the target destinationpayload - the Object to use as payloadpostProcessor - the post processor to apply to the messageMessagingExceptionpublic void convertAndSend(D destination, Object payload, Map<String,Object> headers, MessagePostProcessor postProcessor) throws MessagingException
MessageSendingOperationsMessageConverter,
wrap it as a message with the given headers, apply the given post processor,
and send the resulting message to the given destination.convertAndSend in interface MessageSendingOperations<D>destination - the target destinationpayload - the Object to use as payloadheaders - headers for the message to sendpostProcessor - the post processor to apply to the messageMessagingExceptionprotected Map<String,Object> processHeadersToSend(Map<String,Object> headers)
headers - the headers to send, possibly null