Package org.springframework.amqp.core
Interface AmqpTemplate
- All Known Subinterfaces:
RabbitOperations
- All Known Implementing Classes:
BatchingRabbitTemplate
,RabbitTemplate
,TestRabbitTemplate
public interface AmqpTemplate
Specifies a basic set of AMQP operations.
Provides synchronous send and receive methods. The
convertAndSend(Object)
and
receiveAndConvert()
methods allow let you send and receive POJO objects.
Implementations are expected to delegate to an instance of
MessageConverter
to perform
conversion to and from AMQP byte[] payload type.- Author:
- Mark Pollack, Mark Fisher, Artem Bilan, Ernest Sadykov, Gary Russell
-
Method Summary
Modifier and TypeMethodDescriptionvoid
convertAndSend
(Object message) Convert a Java object to an AmqpMessage
and send it to a default exchange with a default routing key.void
convertAndSend
(Object message, MessagePostProcessor messagePostProcessor) Convert a Java object to an AmqpMessage
and send it to a default exchange with a default routing key.void
convertAndSend
(String routingKey, Object message) Convert a Java object to an AmqpMessage
and send it to a default exchange with a specific routing key.void
convertAndSend
(String routingKey, Object message, MessagePostProcessor messagePostProcessor) Convert a Java object to an AmqpMessage
and send it to a default exchange with a specific routing key.void
convertAndSend
(String exchange, String routingKey, Object message) Convert a Java object to an AmqpMessage
and send it to a specific exchange with a specific routing key.void
convertAndSend
(String exchange, String routingKey, Object message, MessagePostProcessor messagePostProcessor) Convert a Java object to an AmqpMessage
and send it to a specific exchange with a specific routing key.convertSendAndReceive
(Object message) Basic RPC pattern with conversion.convertSendAndReceive
(Object message, MessagePostProcessor messagePostProcessor) Basic RPC pattern with conversion.convertSendAndReceive
(String routingKey, Object message) Basic RPC pattern with conversion.convertSendAndReceive
(String routingKey, Object message, MessagePostProcessor messagePostProcessor) Basic RPC pattern with conversion.convertSendAndReceive
(String exchange, String routingKey, Object message) Basic RPC pattern with conversion.convertSendAndReceive
(String exchange, String routingKey, Object message, MessagePostProcessor messagePostProcessor) Basic RPC pattern with conversion.<T> T
convertSendAndReceiveAsType
(Object message, MessagePostProcessor messagePostProcessor, ParameterizedTypeReference<T> responseType) Basic RPC pattern with conversion.<T> T
convertSendAndReceiveAsType
(Object message, ParameterizedTypeReference<T> responseType) Basic RPC pattern with conversion.<T> T
convertSendAndReceiveAsType
(String routingKey, Object message, MessagePostProcessor messagePostProcessor, ParameterizedTypeReference<T> responseType) Basic RPC pattern with conversion.<T> T
convertSendAndReceiveAsType
(String routingKey, Object message, ParameterizedTypeReference<T> responseType) Basic RPC pattern with conversion.<T> T
convertSendAndReceiveAsType
(String exchange, String routingKey, Object message, MessagePostProcessor messagePostProcessor, ParameterizedTypeReference<T> responseType) Basic RPC pattern with conversion.<T> T
convertSendAndReceiveAsType
(String exchange, String routingKey, Object message, ParameterizedTypeReference<T> responseType) Basic RPC pattern with conversion.receive()
Receive a message if there is one from a default queue.receive
(long timeoutMillis) Receive a message from a default queue, waiting up to the specified wait time if necessary for a message to become available.Receive a message if there is one from a specific queue.Receive a message from a specific queue, waiting up to the specified wait time if necessary for a message to become available.Receive a message if there is one from a default queue and convert it to a Java object.receiveAndConvert
(long timeoutMillis) Receive a message if there is one from a default queue and convert it to a Java object.<T> T
receiveAndConvert
(long timeoutMillis, ParameterizedTypeReference<T> type) Receive a message if there is one from a default queue and convert it to a Java object.receiveAndConvert
(String queueName) Receive a message if there is one from a specific queue and convert it to a Java object.receiveAndConvert
(String queueName, long timeoutMillis) Receive a message if there is one from a specific queue and convert it to a Java object.<T> T
receiveAndConvert
(String queueName, long timeoutMillis, ParameterizedTypeReference<T> type) Receive a message if there is one from a specific queue and convert it to a Java object.<T> T
receiveAndConvert
(String queueName, ParameterizedTypeReference<T> type) Receive a message if there is one from a specific queue and convert it to a Java object.<T> T
Receive a message if there is one from a default queue and convert it to a Java object.<R,
S> boolean receiveAndReply
(String queueName, ReceiveAndReplyCallback<R, S> callback) Receive a message if there is one from provided queue, invoke providedReceiveAndReplyCallback
and send reply message, if thecallback
returns one, to thereplyTo
Address
fromMessageProperties
or to default exchange and default routingKey.<R,
S> boolean receiveAndReply
(String queueName, ReceiveAndReplyCallback<R, S> callback, String replyExchange, String replyRoutingKey) Receive a message if there is one from provided queue, invoke providedReceiveAndReplyCallback
and send reply message, if thecallback
returns one, to the providedexchange
androutingKey
.<R,
S> boolean receiveAndReply
(String queueName, ReceiveAndReplyCallback<R, S> callback, ReplyToAddressCallback<S> replyToAddressCallback) Receive a message if there is one from provided queue, invoke providedReceiveAndReplyCallback
and send reply message, if thecallback
returns one, to thereplyTo
Address
from result ofReplyToAddressCallback
.<R,
S> boolean receiveAndReply
(ReceiveAndReplyCallback<R, S> callback) Receive a message if there is one from a default queue, invoke providedReceiveAndReplyCallback
and send reply message, if thecallback
returns one, to thereplyTo
Address
fromMessageProperties
or to default exchange and default routingKey.<R,
S> boolean receiveAndReply
(ReceiveAndReplyCallback<R, S> callback, String replyExchange, String replyRoutingKey) Receive a message if there is one from default queue, invoke providedReceiveAndReplyCallback
and send reply message, if thecallback
returns one, to the providedexchange
androutingKey
.<R,
S> boolean receiveAndReply
(ReceiveAndReplyCallback<R, S> callback, ReplyToAddressCallback<S> replyToAddressCallback) Receive a message if there is one from a default queue, invoke providedReceiveAndReplyCallback
and send reply message, if thecallback
returns one, to thereplyTo
Address
from result ofReplyToAddressCallback
.void
Send a message to a specific exchange with a specific routing key.void
Send a message to a default exchange with a specific routing key.void
Send a message to a default exchange with a default routing key.sendAndReceive
(String exchange, String routingKey, Message message) Basic RPC pattern.sendAndReceive
(String routingKey, Message message) Basic RPC pattern.sendAndReceive
(Message message) Basic RPC pattern.
-
Method Details
-
send
Send a message to a default exchange with a default routing key.- Parameters:
message
- a message to send- Throws:
AmqpException
- if there is a problem
-
send
Send a message to a default exchange with a specific routing key.- Parameters:
routingKey
- the routing keymessage
- a message to send- Throws:
AmqpException
- if there is a problem
-
send
Send a message to a specific exchange with a specific routing key.- Parameters:
exchange
- the name of the exchangeroutingKey
- the routing keymessage
- a message to send- Throws:
AmqpException
- if there is a problem
-
convertAndSend
Convert a Java object to an AmqpMessage
and send it to a default exchange with a default routing key.- Parameters:
message
- a message to send- Throws:
AmqpException
- if there is a problem
-
convertAndSend
Convert a Java object to an AmqpMessage
and send it to a default exchange with a specific routing key.- Parameters:
routingKey
- the routing keymessage
- a message to send- Throws:
AmqpException
- if there is a problem
-
convertAndSend
Convert a Java object to an AmqpMessage
and send it to a specific exchange with a specific routing key.- Parameters:
exchange
- the name of the exchangeroutingKey
- the routing keymessage
- a message to send- Throws:
AmqpException
- if there is a problem
-
convertAndSend
Convert a Java object to an AmqpMessage
and send it to a default exchange with a default routing key.- Parameters:
message
- a message to sendmessagePostProcessor
- a processor to apply to the message before it is sent- Throws:
AmqpException
- if there is a problem
-
convertAndSend
void convertAndSend(String routingKey, Object message, MessagePostProcessor messagePostProcessor) throws AmqpException Convert a Java object to an AmqpMessage
and send it to a default exchange with a specific routing key.- Parameters:
routingKey
- the routing keymessage
- a message to sendmessagePostProcessor
- a processor to apply to the message before it is sent- Throws:
AmqpException
- if there is a problem
-
convertAndSend
void convertAndSend(String exchange, String routingKey, Object message, MessagePostProcessor messagePostProcessor) throws AmqpException Convert a Java object to an AmqpMessage
and send it to a specific exchange with a specific routing key.- Parameters:
exchange
- the name of the exchangeroutingKey
- the routing keymessage
- a message to sendmessagePostProcessor
- a processor to apply to the message before it is sent- Throws:
AmqpException
- if there is a problem
-
receive
Receive a message if there is one from a default queue. Returns immediately, possibly with a null value.- Returns:
- a message or null if there is none waiting
- Throws:
AmqpException
- if there is a problem
-
receive
Receive a message if there is one from a specific queue. Returns immediately, possibly with a null value.- Parameters:
queueName
- the name of the queue to poll- Returns:
- a message or null if there is none waiting
- Throws:
AmqpException
- if there is a problem
-
receive
Receive a message from a default queue, waiting up to the specified wait time if necessary for a message to become available.- Parameters:
timeoutMillis
- how long to wait before giving up. Zero value means the method will returnnull
immediately if there is no message available. Negative value makes method wait for a message indefinitely.- Returns:
- a message or null if the time expires
- Throws:
AmqpException
- if there is a problem- Since:
- 1.6
-
receive
Receive a message from a specific queue, waiting up to the specified wait time if necessary for a message to become available.- Parameters:
queueName
- the queue to receive fromtimeoutMillis
- how long to wait before giving up. Zero value means the method will returnnull
immediately if there is no message available. Negative value makes method wait for a message indefinitely.- Returns:
- a message or null if the time expires
- Throws:
AmqpException
- if there is a problem- Since:
- 1.6
-
receiveAndConvert
Receive a message if there is one from a default queue and convert it to a Java object. Returns immediately, possibly with a null value.- Returns:
- a message or null if there is none waiting
- Throws:
AmqpException
- if there is a problem
-
receiveAndConvert
Receive a message if there is one from a specific queue and convert it to a Java object. Returns immediately, possibly with a null value.- Parameters:
queueName
- the name of the queue to poll- Returns:
- a message or null if there is none waiting
- Throws:
AmqpException
- if there is a problem
-
receiveAndConvert
Receive a message if there is one from a default queue and convert it to a Java object. Wait up to the specified wait time if necessary for a message to become available.- Parameters:
timeoutMillis
- how long to wait before giving up. Zero value means the method will returnnull
immediately if there is no message available. Negative value makes method wait for a message indefinitely.- Returns:
- a message or null if the time expires
- Throws:
AmqpException
- if there is a problem- Since:
- 1.6
-
receiveAndConvert
Receive a message if there is one from a specific queue and convert it to a Java object. Wait up to the specified wait time if necessary for a message to become available.- Parameters:
queueName
- the name of the queue to polltimeoutMillis
- how long to wait before giving up. Zero value means the method will returnnull
immediately if there is no message available. Negative value makes method wait for a message indefinitely.- Returns:
- a message or null if the time expires
- Throws:
AmqpException
- if there is a problem- Since:
- 1.6
-
receiveAndConvert
Receive a message if there is one from a default queue and convert it to a Java object. Returns immediately, possibly with a null value. Requires aSmartMessageConverter
.- Type Parameters:
T
- the type.- Parameters:
type
- the type to convert to.- Returns:
- a message or null if there is none waiting.
- Throws:
AmqpException
- if there is a problem.- Since:
- 2.0
-
receiveAndConvert
@Nullable <T> T receiveAndConvert(String queueName, ParameterizedTypeReference<T> type) throws AmqpException Receive a message if there is one from a specific queue and convert it to a Java object. Returns immediately, possibly with a null value. Requires aSmartMessageConverter
.- Type Parameters:
T
- the type.- Parameters:
queueName
- the name of the queue to polltype
- the type to convert to.- Returns:
- a message or null if there is none waiting
- Throws:
AmqpException
- if there is a problem- Since:
- 2.0
-
receiveAndConvert
@Nullable <T> T receiveAndConvert(long timeoutMillis, ParameterizedTypeReference<T> type) throws AmqpException Receive a message if there is one from a default queue and convert it to a Java object. Wait up to the specified wait time if necessary for a message to become available. Requires aSmartMessageConverter
.- Type Parameters:
T
- the type.- Parameters:
timeoutMillis
- how long to wait before giving up. Zero value means the method will returnnull
immediately if there is no message available. Negative value makes method wait for a message indefinitely.type
- the type to convert to.- Returns:
- a message or null if the time expires
- Throws:
AmqpException
- if there is a problem- Since:
- 2.0
-
receiveAndConvert
@Nullable <T> T receiveAndConvert(String queueName, long timeoutMillis, ParameterizedTypeReference<T> type) throws AmqpException Receive a message if there is one from a specific queue and convert it to a Java object. Wait up to the specified wait time if necessary for a message to become available. Requires aSmartMessageConverter
.- Type Parameters:
T
- the type.- Parameters:
queueName
- the name of the queue to polltimeoutMillis
- how long to wait before giving up. Zero value means the method will returnnull
immediately if there is no message available. Negative value makes method wait for a message indefinitely.type
- the type to convert to.- Returns:
- a message or null if the time expires
- Throws:
AmqpException
- if there is a problem- Since:
- 2.0
-
receiveAndReply
Receive a message if there is one from a default queue, invoke providedReceiveAndReplyCallback
and send reply message, if thecallback
returns one, to thereplyTo
Address
fromMessageProperties
or to default exchange and default routingKey.- Type Parameters:
R
- The type of the request after conversion from theMessage
.S
- The type of the response.- Parameters:
callback
- a user-providedReceiveAndReplyCallback
implementation to process received message and return a reply message.- Returns:
true
, if message was received- Throws:
AmqpException
- if there is a problem
-
receiveAndReply
<R,S> boolean receiveAndReply(String queueName, ReceiveAndReplyCallback<R, S> callback) throws AmqpExceptionReceive a message if there is one from provided queue, invoke providedReceiveAndReplyCallback
and send reply message, if thecallback
returns one, to thereplyTo
Address
fromMessageProperties
or to default exchange and default routingKey.- Type Parameters:
R
- The type of the request after conversion from theMessage
.S
- The type of the response.- Parameters:
queueName
- the queue name to receive a message.callback
- a user-providedReceiveAndReplyCallback
implementation to process received message and return a reply message.- Returns:
true
, if message was received.- Throws:
AmqpException
- if there is a problem.
-
receiveAndReply
<R,S> boolean receiveAndReply(ReceiveAndReplyCallback<R, S> callback, String replyExchange, String replyRoutingKey) throws AmqpExceptionReceive a message if there is one from default queue, invoke providedReceiveAndReplyCallback
and send reply message, if thecallback
returns one, to the providedexchange
androutingKey
.- Type Parameters:
R
- The type of the request after conversion from theMessage
.S
- The type of the response.- Parameters:
callback
- a user-providedReceiveAndReplyCallback
implementation to process received message and return a reply message.replyExchange
- the exchange name to send reply message.replyRoutingKey
- the routing key to send reply message.- Returns:
true
, if message was received.- Throws:
AmqpException
- if there is a problem.
-
receiveAndReply
<R,S> boolean receiveAndReply(String queueName, ReceiveAndReplyCallback<R, S> callback, String replyExchange, String replyRoutingKey) throws AmqpExceptionReceive a message if there is one from provided queue, invoke providedReceiveAndReplyCallback
and send reply message, if thecallback
returns one, to the providedexchange
androutingKey
.- Type Parameters:
R
- The type of the request after conversion from theMessage
.S
- The type of the response.- Parameters:
queueName
- the queue name to receive a message.callback
- a user-providedReceiveAndReplyCallback
implementation to process received message and return a reply message.replyExchange
- the exchange name to send reply message.replyRoutingKey
- the routing key to send reply message.- Returns:
true
, if message was received- Throws:
AmqpException
- if there is a problem
-
receiveAndReply
<R,S> boolean receiveAndReply(ReceiveAndReplyCallback<R, S> callback, ReplyToAddressCallback<S> replyToAddressCallback) throws AmqpExceptionReceive a message if there is one from a default queue, invoke providedReceiveAndReplyCallback
and send reply message, if thecallback
returns one, to thereplyTo
Address
from result ofReplyToAddressCallback
.- Type Parameters:
R
- The type of the request after conversion from theMessage
.S
- The type of the response.- Parameters:
callback
- a user-providedReceiveAndReplyCallback
implementation to process received message and return a reply message.replyToAddressCallback
- the callback to determine replyTo address at runtime.- Returns:
true
, if message was received.- Throws:
AmqpException
- if there is a problem.
-
receiveAndReply
<R,S> boolean receiveAndReply(String queueName, ReceiveAndReplyCallback<R, S> callback, ReplyToAddressCallback<S> replyToAddressCallback) throws AmqpExceptionReceive a message if there is one from provided queue, invoke providedReceiveAndReplyCallback
and send reply message, if thecallback
returns one, to thereplyTo
Address
from result ofReplyToAddressCallback
.- Type Parameters:
R
- The type of the request after conversion from theMessage
.S
- The type of the response.- Parameters:
queueName
- the queue name to receive a message.callback
- a user-providedReceiveAndReplyCallback
implementation to process received message and return a reply message.replyToAddressCallback
- the callback to determine replyTo address at runtime.- Returns:
true
, if message was received- Throws:
AmqpException
- if there is a problem
-
sendAndReceive
Basic RPC pattern. Send a message to a default exchange with a default routing key and attempt to receive a response. Implementations will normally set the reply-to header to an exclusive queue and wait up for some time limited by a timeout.- Parameters:
message
- a message to send.- Returns:
- the response; or null if the reply times out.
- Throws:
AmqpException
- if there is a problem.
-
sendAndReceive
Basic RPC pattern. Send a message to a default exchange with a specific routing key and attempt to receive a response. Implementations will normally set the reply-to header to an exclusive queue and wait up for some time limited by a timeout.- Parameters:
routingKey
- the routing key.message
- a message to send.- Returns:
- the response; or null if the reply times out.
- Throws:
AmqpException
- if there is a problem.
-
sendAndReceive
@Nullable Message sendAndReceive(String exchange, String routingKey, Message message) throws AmqpException Basic RPC pattern. Send a message to a specific exchange with a specific routing key and attempt to receive a response. Implementations will normally set the reply-to header to an exclusive queue and wait up for some time limited by a timeout.- Parameters:
exchange
- the name of the exchange.routingKey
- the routing key.message
- a message to send.- Returns:
- the response; or null if the reply times out.
- Throws:
AmqpException
- if there is a problem.
-
convertSendAndReceive
Basic RPC pattern with conversion. Send a Java object converted to a message to a default exchange with a default routing key and attempt to receive a response, converting that to a Java object. Implementations will normally set the reply-to header to an exclusive queue and wait up for some time limited by a timeout.- Parameters:
message
- a message to send.- Returns:
- the response; or null if the reply times out.
- Throws:
AmqpException
- if there is a problem.
-
convertSendAndReceive
Basic RPC pattern with conversion. Send a Java object converted to a message to a default exchange with a specific routing key and attempt to receive a response, converting that to a Java object. Implementations will normally set the reply-to header to an exclusive queue and wait up for some time limited by a timeout.- Parameters:
routingKey
- the routing key.message
- a message to send.- Returns:
- the response; or null if the reply times out.
- Throws:
AmqpException
- if there is a problem.
-
convertSendAndReceive
@Nullable Object convertSendAndReceive(String exchange, String routingKey, Object message) throws AmqpException Basic RPC pattern with conversion. Send a Java object converted to a message to a specific exchange with a specific routing key and attempt to receive a response, converting that to a Java object. Implementations will normally set the reply-to header to an exclusive queue and wait up for some time limited by a timeout.- Parameters:
exchange
- the name of the exchange.routingKey
- the routing key.message
- a message to send.- Returns:
- the response; or null if the reply times out.
- Throws:
AmqpException
- if there is a problem.
-
convertSendAndReceive
@Nullable Object convertSendAndReceive(Object message, MessagePostProcessor messagePostProcessor) throws AmqpException Basic RPC pattern with conversion. Send a Java object converted to a message to a default exchange with a default routing key and attempt to receive a response, converting that to a Java object. Implementations will normally set the reply-to header to an exclusive queue and wait up for some time limited by a timeout.- Parameters:
message
- a message to send.messagePostProcessor
- a processor to apply to the message before it is sent.- Returns:
- the response; or null if the reply times out.
- Throws:
AmqpException
- if there is a problem.
-
convertSendAndReceive
@Nullable Object convertSendAndReceive(String routingKey, Object message, MessagePostProcessor messagePostProcessor) throws AmqpException Basic RPC pattern with conversion. Send a Java object converted to a message to a default exchange with a specific routing key and attempt to receive a response, converting that to a Java object. Implementations will normally set the reply-to header to an exclusive queue and wait up for some time limited by a timeout.- Parameters:
routingKey
- the routing key.message
- a message to send.messagePostProcessor
- a processor to apply to the message before it is sent.- Returns:
- the response; or null if the reply times out.
- Throws:
AmqpException
- if there is a problem.
-
convertSendAndReceive
@Nullable Object convertSendAndReceive(String exchange, String routingKey, Object message, MessagePostProcessor messagePostProcessor) throws AmqpException Basic RPC pattern with conversion. Send a Java object converted to a message to a specific exchange with a specific routing key and attempt to receive a response, converting that to a Java object. Implementations will normally set the reply-to header to an exclusive queue and wait up for some time limited by a timeout.- Parameters:
exchange
- the name of the exchange.routingKey
- the routing key.message
- a message to send.messagePostProcessor
- a processor to apply to the message before it is sent.- Returns:
- the response; or null if the reply times out.
- Throws:
AmqpException
- if there is a problem.
-
convertSendAndReceiveAsType
@Nullable <T> T convertSendAndReceiveAsType(Object message, ParameterizedTypeReference<T> responseType) throws AmqpException Basic RPC pattern with conversion. Send a Java object converted to a message to a default exchange with a default routing key and attempt to receive a response, converting that to a Java object. Implementations will normally set the reply-to header to an exclusive queue and wait up for some time limited by a timeout. Requires aSmartMessageConverter
.- Type Parameters:
T
- the type.- Parameters:
message
- a message to send.responseType
- the type to convert the reply to.- Returns:
- the response; or null if the reply times out.
- Throws:
AmqpException
- if there is a problem.- Since:
- 2.0
-
convertSendAndReceiveAsType
@Nullable <T> T convertSendAndReceiveAsType(String routingKey, Object message, ParameterizedTypeReference<T> responseType) throws AmqpException Basic RPC pattern with conversion. Send a Java object converted to a message to a default exchange with a specific routing key and attempt to receive a response, converting that to a Java object. Implementations will normally set the reply-to header to an exclusive queue and wait up for some time limited by a timeout. Requires aSmartMessageConverter
.- Type Parameters:
T
- the type.- Parameters:
routingKey
- the routing key.message
- a message to send.responseType
- the type to convert the reply to.- Returns:
- the response; or null if the reply times out.
- Throws:
AmqpException
- if there is a problem.- Since:
- 2.0
-
convertSendAndReceiveAsType
@Nullable <T> T convertSendAndReceiveAsType(String exchange, String routingKey, Object message, ParameterizedTypeReference<T> responseType) throws AmqpException Basic RPC pattern with conversion. Send a Java object converted to a message to a specific exchange with a specific routing key and attempt to receive a response, converting that to a Java object. Implementations will normally set the reply-to header to an exclusive queue and wait up for some time limited by a timeout. Requires aSmartMessageConverter
.- Type Parameters:
T
- the type.- Parameters:
exchange
- the name of the exchange.routingKey
- the routing key.message
- a message to send.responseType
- the type to convert the reply to.- Returns:
- the response; or null if the reply times out.
- Throws:
AmqpException
- if there is a problem.- Since:
- 2.0
-
convertSendAndReceiveAsType
@Nullable <T> T convertSendAndReceiveAsType(Object message, MessagePostProcessor messagePostProcessor, ParameterizedTypeReference<T> responseType) throws AmqpException Basic RPC pattern with conversion. Send a Java object converted to a message to a default exchange with a default routing key and attempt to receive a response, converting that to a Java object. Implementations will normally set the reply-to header to an exclusive queue and wait up for some time limited by a timeout. Requires aSmartMessageConverter
.- Type Parameters:
T
- the type.- Parameters:
message
- a message to send.messagePostProcessor
- a processor to apply to the message before it is sent.responseType
- the type to convert the reply to.- Returns:
- the response; or null if the reply times out.
- Throws:
AmqpException
- if there is a problem.- Since:
- 2.0
-
convertSendAndReceiveAsType
@Nullable <T> T convertSendAndReceiveAsType(String routingKey, Object message, MessagePostProcessor messagePostProcessor, ParameterizedTypeReference<T> responseType) throws AmqpException Basic RPC pattern with conversion. Send a Java object converted to a message to a default exchange with a specific routing key and attempt to receive a response, converting that to a Java object. Implementations will normally set the reply-to header to an exclusive queue and wait up for some time limited by a timeout. Requires aSmartMessageConverter
.- Type Parameters:
T
- the type.- Parameters:
routingKey
- the routing key.message
- a message to send.messagePostProcessor
- a processor to apply to the message before it is sent.responseType
- the type to convert the reply to.- Returns:
- the response; or null if the reply times out.
- Throws:
AmqpException
- if there is a problem.- Since:
- 2.0
-
convertSendAndReceiveAsType
@Nullable <T> T convertSendAndReceiveAsType(String exchange, String routingKey, Object message, MessagePostProcessor messagePostProcessor, ParameterizedTypeReference<T> responseType) throws AmqpException Basic RPC pattern with conversion. Send a Java object converted to a message to a specific exchange with a specific routing key and attempt to receive a response, converting that to a Java object. Implementations will normally set the reply-to header to an exclusive queue and wait up for some time limited by a timeout. Requires aSmartMessageConverter
.- Type Parameters:
T
- the type.- Parameters:
exchange
- the name of the exchange.routingKey
- the routing key.message
- a message to send.messagePostProcessor
- a processor to apply to the message before it is sent.responseType
- the type to convert the reply to.- Returns:
- the response; or null if the reply times out.
- Throws:
AmqpException
- if there is a problem.- Since:
- 2.0
-