D
- the destination typepublic abstract class AbstractDestinationResolvingMessagingTemplate<D> extends AbstractMessagingTemplate<D> implements DestinationResolvingMessageSendingOperations<D>, DestinationResolvingMessageReceivingOperations<D>, DestinationResolvingMessageRequestReplyOperations<D>
AbstractMessagingTemplate
that adds operations for sending
messages to a resolvable destination name. Supports destination resolving as defined by
the following interfaces:
CONVERSION_HINT_HEADER, logger
Constructor and Description |
---|
AbstractDestinationResolvingMessagingTemplate() |
Modifier and Type | Method and Description |
---|---|
<T> void |
convertAndSend(java.lang.String destinationName,
T payload)
Resolve the given destination name to a destination, convert the payload Object
to serialized form, possibly using a
MessageConverter ,
wrap it as a message and send it to the resolved destination. |
<T> void |
convertAndSend(java.lang.String destinationName,
T payload,
java.util.Map<java.lang.String,java.lang.Object> headers)
Resolve the given destination name to a destination, convert the payload
Object to serialized form, possibly using a
MessageConverter ,
wrap it as a message with the given headers and send it to the resolved
destination. |
<T> void |
convertAndSend(java.lang.String destinationName,
T payload,
java.util.Map<java.lang.String,java.lang.Object> headers,
MessagePostProcessor postProcessor)
Resolve the given destination name to a destination, convert the payload
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 resolved destination. |
<T> void |
convertAndSend(java.lang.String destinationName,
T payload,
MessagePostProcessor postProcessor)
Resolve the given destination name to a destination, convert the payload
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 resolved destination. |
<T> T |
convertSendAndReceive(java.lang.String destinationName,
java.lang.Object request,
java.lang.Class<T> targetClass)
Resolve the given destination name, convert the payload request Object
to serialized form, possibly using a
MessageConverter ,
wrap it as a message and send it to the resolved destination, receive a reply
and convert its body to the specified target class. |
<T> T |
convertSendAndReceive(java.lang.String destinationName,
java.lang.Object request,
java.lang.Class<T> targetClass,
MessagePostProcessor postProcessor)
Resolve the given destination name, convert the payload request Object
to serialized form, possibly using a
MessageConverter ,
wrap it as a message, apply the given post process, and send the resulting
message to the resolved destination, then receive a reply and convert its
body to the specified target class. |
<T> T |
convertSendAndReceive(java.lang.String destinationName,
java.lang.Object request,
java.util.Map<java.lang.String,java.lang.Object> headers,
java.lang.Class<T> targetClass)
Resolve the given destination name, convert the payload request Object
to serialized form, possibly using a
MessageConverter ,
wrap it as a message with the given headers and send it to the resolved destination,
receive a reply and convert its body to the specified target class. |
<T> T |
convertSendAndReceive(java.lang.String destinationName,
java.lang.Object request,
java.util.Map<java.lang.String,java.lang.Object> headers,
java.lang.Class<T> targetClass,
MessagePostProcessor postProcessor)
Resolve the given destination name, convert the payload request Object
to serialized form, possibly using a
MessageConverter ,
wrap it as a message with the given headers, apply the given post process,
and send the resulting message to the resolved destination, then receive
a reply and convert its body to the specified target class. |
DestinationResolver<D> |
getDestinationResolver()
Return the configured destination resolver.
|
Message<?> |
receive(java.lang.String destinationName)
Resolve the given destination name and receive a message from it.
|
<T> T |
receiveAndConvert(java.lang.String destinationName,
java.lang.Class<T> targetClass)
Resolve the given destination name, receive a message from it,
convert the payload to the specified target type.
|
protected D |
resolveDestination(java.lang.String destinationName) |
void |
send(java.lang.String destinationName,
Message<?> message)
Resolve the given destination name to a destination and send a message to it.
|
Message<?> |
sendAndReceive(java.lang.String destinationName,
Message<?> requestMessage)
Resolve the given destination name to a destination and send the given message,
receive a reply and return it.
|
void |
setDestinationResolver(DestinationResolver<D> destinationResolver)
Configure the
DestinationResolver to use to resolve String destination
names into actual destinations of type <D> . |
convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, doSendAndReceive, sendAndReceive, sendAndReceive
doConvert, doReceive, receive, receive, receiveAndConvert, receiveAndConvert
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, doConvert, doSend, getDefaultDestination, getMessageConverter, getRequiredDefaultDestination, processHeadersToSend, send, send, setDefaultDestination, setMessageConverter
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, send, send
receive, receive, receiveAndConvert, receiveAndConvert
convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, convertSendAndReceive, sendAndReceive, sendAndReceive
public AbstractDestinationResolvingMessagingTemplate()
public void setDestinationResolver(@Nullable DestinationResolver<D> destinationResolver)
DestinationResolver
to use to resolve String destination
names into actual destinations of type <D>
.
This field does not have a default setting. If not configured, methods that
require resolving a destination name will raise an IllegalArgumentException
.
destinationResolver
- the destination resolver to use@Nullable public DestinationResolver<D> getDestinationResolver()
public void send(java.lang.String destinationName, Message<?> message)
DestinationResolvingMessageSendingOperations
send
in interface DestinationResolvingMessageSendingOperations<D>
destinationName
- the destination name to resolvemessage
- the message to sendprotected final D resolveDestination(java.lang.String destinationName)
public <T> void convertAndSend(java.lang.String destinationName, T payload)
DestinationResolvingMessageSendingOperations
MessageConverter
,
wrap it as a message and send it to the resolved destination.convertAndSend
in interface DestinationResolvingMessageSendingOperations<D>
destinationName
- the destination name to resolvepayload
- the Object to use as payloadpublic <T> void convertAndSend(java.lang.String destinationName, T payload, @Nullable java.util.Map<java.lang.String,java.lang.Object> headers)
DestinationResolvingMessageSendingOperations
MessageConverter
,
wrap it as a message with the given headers and send it to the resolved
destination.convertAndSend
in interface DestinationResolvingMessageSendingOperations<D>
destinationName
- the destination name to resolvepayload
- the Object to use as payloadheaders
- headers for the message to sendpublic <T> void convertAndSend(java.lang.String destinationName, T payload, @Nullable MessagePostProcessor postProcessor)
DestinationResolvingMessageSendingOperations
MessageConverter
,
wrap it as a message, apply the given post processor, and send the resulting
message to the resolved destination.convertAndSend
in interface DestinationResolvingMessageSendingOperations<D>
destinationName
- the destination name to resolvepayload
- the Object to use as payloadpostProcessor
- the post processor to apply to the messagepublic <T> void convertAndSend(java.lang.String destinationName, T payload, @Nullable java.util.Map<java.lang.String,java.lang.Object> headers, @Nullable MessagePostProcessor postProcessor)
DestinationResolvingMessageSendingOperations
MessageConverter
,
wrap it as a message with the given headers, apply the given post processor,
and send the resulting message to the resolved destination.convertAndSend
in interface DestinationResolvingMessageSendingOperations<D>
destinationName
- the destination name to resolvepayload
- the Object to use as payloadheaders
- headers for the message to sendpostProcessor
- the post processor to apply to the message@Nullable public Message<?> receive(java.lang.String destinationName)
DestinationResolvingMessageReceivingOperations
receive
in interface DestinationResolvingMessageReceivingOperations<D>
destinationName
- the destination name to resolve@Nullable public <T> T receiveAndConvert(java.lang.String destinationName, java.lang.Class<T> targetClass)
DestinationResolvingMessageReceivingOperations
receiveAndConvert
in interface DestinationResolvingMessageReceivingOperations<D>
destinationName
- the destination name to resolvetargetClass
- the target class for the converted payload@Nullable public Message<?> sendAndReceive(java.lang.String destinationName, Message<?> requestMessage)
DestinationResolvingMessageRequestReplyOperations
sendAndReceive
in interface DestinationResolvingMessageRequestReplyOperations<D>
destinationName
- the name of the target destinationrequestMessage
- the mesage to sendnull
if the message could not
be received, for example due to a timeout@Nullable public <T> T convertSendAndReceive(java.lang.String destinationName, java.lang.Object request, java.lang.Class<T> targetClass)
DestinationResolvingMessageRequestReplyOperations
MessageConverter
,
wrap it as a message and send it to the resolved destination, receive a reply
and convert its body to the specified target class.convertSendAndReceive
in interface DestinationResolvingMessageRequestReplyOperations<D>
destinationName
- the name of the target destinationrequest
- the payload for the request message to sendtargetClass
- the target class to convert the payload of the reply tonull
if
the message could not be received, for example due to a timeout@Nullable public <T> T convertSendAndReceive(java.lang.String destinationName, java.lang.Object request, @Nullable java.util.Map<java.lang.String,java.lang.Object> headers, java.lang.Class<T> targetClass)
DestinationResolvingMessageRequestReplyOperations
MessageConverter
,
wrap it as a message with the given headers and send it to the resolved destination,
receive a reply and convert its body to the specified target class.convertSendAndReceive
in interface DestinationResolvingMessageRequestReplyOperations<D>
destinationName
- the name of the target destinationrequest
- the payload for the request message to sendheaders
- the headers for the request message to sendtargetClass
- the target class to convert the payload of the reply tonull
if
the message could not be received, for example due to a timeout@Nullable public <T> T convertSendAndReceive(java.lang.String destinationName, java.lang.Object request, java.lang.Class<T> targetClass, @Nullable MessagePostProcessor postProcessor)
DestinationResolvingMessageRequestReplyOperations
MessageConverter
,
wrap it as a message, apply the given post process, and send the resulting
message to the resolved destination, then receive a reply and convert its
body to the specified target class.convertSendAndReceive
in interface DestinationResolvingMessageRequestReplyOperations<D>
destinationName
- the name of the target destinationrequest
- the payload for the request message to sendtargetClass
- the target class to convert the payload of the reply topostProcessor
- post process for the request messagenull
if
the message could not be received, for example due to a timeout@Nullable public <T> T convertSendAndReceive(java.lang.String destinationName, java.lang.Object request, @Nullable java.util.Map<java.lang.String,java.lang.Object> headers, java.lang.Class<T> targetClass, @Nullable MessagePostProcessor postProcessor)
DestinationResolvingMessageRequestReplyOperations
MessageConverter
,
wrap it as a message with the given headers, apply the given post process,
and send the resulting message to the resolved destination, then receive
a reply and convert its body to the specified target class.convertSendAndReceive
in interface DestinationResolvingMessageRequestReplyOperations<D>
destinationName
- the name of the target destinationrequest
- the payload for the request message to sendheaders
- the headers for the request message to sendtargetClass
- the target class to convert the payload of the reply topostProcessor
- post process for the request messagenull
if
the message could not be received, for example due to a timeout