public abstract class AbstractMessageReceivingTemplate<D> extends AbstractMessageSendingTemplate<D> implements MessageReceivingOperations<D>
AbstractMessageSendingTemplate
that adds support for
receive style operations as defined by MessageReceivingOperations
.CONVERSION_HINT_HEADER, logger
Constructor and Description |
---|
AbstractMessageReceivingTemplate() |
Modifier and Type | Method and Description |
---|---|
protected <T> T |
doConvert(Message<?> message,
Class<T> targetClass)
Convert from the given message to the given target class.
|
protected abstract Message<?> |
doReceive(D destination)
Actually receive a message from the given destination.
|
Message<?> |
receive()
Receive a message from a default destination.
|
Message<?> |
receive(D destination)
Receive a message from the given destination.
|
<T> T |
receiveAndConvert(Class<T> targetClass)
Receive a message from a default destination and convert its payload to the
specified target class.
|
<T> T |
receiveAndConvert(D destination,
Class<T> targetClass)
Receive a message from the given destination and convert its payload to the
specified target class.
|
convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, doConvert, doSend, getDefaultDestination, getMessageConverter, getRequiredDefaultDestination, processHeadersToSend, send, send, setDefaultDestination, setMessageConverter
public Message<?> receive()
MessageReceivingOperations
receive
in interface MessageReceivingOperations<D>
null
if the message could not
be received, for example due to a timeoutpublic Message<?> receive(D destination)
MessageReceivingOperations
receive
in interface MessageReceivingOperations<D>
destination
- the target destinationnull
if the message could not
be received, for example due to a timeoutprotected abstract Message<?> doReceive(D destination)
destination
- the target destinationnull
if the message could not
be received, for example due to a timeoutpublic <T> T receiveAndConvert(Class<T> targetClass)
MessageReceivingOperations
receiveAndConvert
in interface MessageReceivingOperations<D>
targetClass
- the target class to convert the payload tonull
if
the message could not be received, for example due to a timeoutpublic <T> T receiveAndConvert(D destination, Class<T> targetClass)
MessageReceivingOperations
receiveAndConvert
in interface MessageReceivingOperations<D>
destination
- the target destinationtargetClass
- the target class to convert the payload tonull
if
the message could not be received, for example due to a timeoutprotected <T> T doConvert(Message<?> message, Class<T> targetClass)
message
- the message to converttargetClass
- the target class to convert the payload tonull
)