Top Description Fields Constructors Methods
org.springframework.messaging.core

public abstract Class AbstractMessageReceivingTemplate<D>

extends AbstractMessageSendingTemplate<D>
implements MessageReceivingOperations<D>
Class Inheritance
All Implemented Interfaces
org.springframework.messaging.core.MessageReceivingOperations
Known Direct Subclasses
org.springframework.messaging.core.AbstractMessagingTemplate
Type Parameters
<D>
the destination type
Imports
org.springframework.lang.Nullable, org.springframework.messaging.Message, org.springframework.messaging.converter.MessageConversionException, .MessageConverter

An extension of AbstractMessageSendingTemplate that adds support for receive style operations as defined by MessageReceivingOperations.
Authors
Mark Fisher, Rossen Stoyanchev, Stephane Nicoll
Since
4.1

Field Summary

Inherited from org.springframework.messaging.core.AbstractMessageSendingTemplate:
CONVERSION_HINT_HEADERlogger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected <T> T

Returns:

the converted payload of the reply message (never null)
doConvert
(Message<?>
the message to convert
message
,
Class<T>
the target class to convert the payload to
targetClass
)

Convert from the given message to the given target class.

protected abstract Message<?>

Returns:

the received message, possibly null if the message could not be received, for example due to a timeout
doReceive
(D
the target destination
destination
)

Actually receive a message from the given destination.

public Message<?>
receive()

Implements org.springframework.messaging.core.MessageReceivingOperations.receive.

Receive a message from a default destination.
public Message<?>
receive(D
the target destination
destination
)

Implements org.springframework.messaging.core.MessageReceivingOperations.receive.

Receive a message from the given destination.
public <T> T
receiveAndConvert(Class<T>
the target class to convert the payload to
targetClass
)

Implements org.springframework.messaging.core.MessageReceivingOperations.receiveAndConvert.

Receive a message from a default destination and convert its payload to the specified target class.
public <T> T
receiveAndConvert(D
the target destination
destination
,
Class<T>
the target class to convert the payload to
targetClass
)

Implements org.springframework.messaging.core.MessageReceivingOperations.receiveAndConvert.

Receive a message from the given destination and convert its payload to the specified target class.
Inherited from org.springframework.messaging.core.AbstractMessageSendingTemplate:
convertAndSendconvertAndSendconvertAndSendconvertAndSendconvertAndSendconvertAndSenddoConvertdoSendgetDefaultDestinationgetMessageConvertergetRequiredDefaultDestinationprocessHeadersToSendsendsendsetDefaultDestinationsetMessageConverter

Constructor Detail

AbstractMessageReceivingTemplateback to summary
public AbstractMessageReceivingTemplate()

Method Detail

doConvertback to summary
protected <T> T doConvert(Message<?> message, Class<T> targetClass)

Convert from the given message to the given target class.

Parameters
message:Message<?>

the message to convert

targetClass:Class<T>

the target class to convert the payload to

Returns:T

the converted payload of the reply message (never null)

Annotations
@SuppressWarnings:unchecked
@Nullable
doReceiveback to summary
protected abstract Message<?> doReceive(D destination)

Actually receive a message from the given destination.

Parameters
destination:D

the target destination

Returns:Message<?>

the received message, possibly null if the message could not be received, for example due to a timeout

Annotations
@Nullable
receiveback to summary
public Message<?> receive()

Implements org.springframework.messaging.core.MessageReceivingOperations.receive.

Doc from org.springframework.messaging.core.MessageReceivingOperations.receive.

Receive a message from a default destination.

Returns:Message<?>

the received message, possibly null if the message could not be received, for example due to a timeout

Annotations
@Override
@Nullable
receiveback to summary
public Message<?> receive(D destination)

Implements org.springframework.messaging.core.MessageReceivingOperations.receive.

Doc from org.springframework.messaging.core.MessageReceivingOperations.receive.

Receive a message from the given destination.

Parameters
destination:D

the target destination

Returns:Message<?>

the received message, possibly null if the message could not be received, for example due to a timeout

Annotations
@Override
@Nullable
receiveAndConvertback to summary
public <T> T receiveAndConvert(Class<T> targetClass)

Implements org.springframework.messaging.core.MessageReceivingOperations.receiveAndConvert.

Doc from org.springframework.messaging.core.MessageReceivingOperations.receiveAndConvert.

Receive a message from a default destination and convert its payload to the specified target class.

Parameters
targetClass:Class<T>

the target class to convert the payload to

Returns:T

the converted payload of the reply message, possibly null if the message could not be received, for example due to a timeout

Annotations
@Override
@Nullable
receiveAndConvertback to summary
public <T> T receiveAndConvert(D destination, Class<T> targetClass)

Implements org.springframework.messaging.core.MessageReceivingOperations.receiveAndConvert.

Doc from org.springframework.messaging.core.MessageReceivingOperations.receiveAndConvert.

Receive a message from the given destination and convert its payload to the specified target class.

Parameters
destination:D

the target destination

targetClass:Class<T>

the target class to convert the payload to

Returns:T

the converted payload of the reply message, possibly null if the message could not be received, for example due to a timeout

Annotations
@Override
@Nullable