public interface AmqpTemplate
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.Modifier and Type | Method and Description |
---|---|
void |
convertAndSend(Object message)
Convert a Java object to an Amqp
Message and send it to a default exchange with a default routing key. |
void |
convertAndSend(Object message,
MessagePostProcessor messagePostProcessor)
Convert a Java object to an Amqp
Message and send it to a default exchange with a default routing key. |
void |
convertAndSend(String routingKey,
Object message)
Convert a Java object to an Amqp
Message 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 Amqp
Message 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 Amqp
Message 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 Amqp
Message and send it to a specific exchange with a specific routing key. |
Object |
convertSendAndReceive(Object message)
Basic RPC pattern with conversion.
|
Object |
convertSendAndReceive(Object message,
MessagePostProcessor messagePostProcessor)
Basic RPC pattern with conversion.
|
Object |
convertSendAndReceive(String routingKey,
Object message)
Basic RPC pattern with conversion.
|
Object |
convertSendAndReceive(String routingKey,
Object message,
MessagePostProcessor messagePostProcessor)
Basic RPC pattern with conversion.
|
Object |
convertSendAndReceive(String exchange,
String routingKey,
Object message)
Basic RPC pattern with conversion.
|
Object |
convertSendAndReceive(String exchange,
String routingKey,
Object message,
MessagePostProcessor messagePostProcessor)
Basic RPC pattern with conversion.
|
Message |
receive()
Receive a message if there is one from a default queue.
|
Message |
receive(String queueName)
Receive a message if there is one from a specific queue.
|
Object |
receiveAndConvert()
Receive a message if there is one from a default queue and convert it to a Java object.
|
Object |
receiveAndConvert(String queueName)
Receive a message if there is one from a specific queue and convert it to a Java object.
|
<R,S> boolean |
receiveAndReply(ReceiveAndReplyCallback<R,S> callback)
Receive a message if there is one from a default queue, invoke provided
ReceiveAndReplyCallback
and send reply message, if the callback returns one,
to the replyTo Address
from MessageProperties
or to default exchange and default routingKey. |
<R,S> boolean |
receiveAndReply(ReceiveAndReplyCallback<R,S> callback,
ReplyToAddressCallback<S> replyToAddressCallback)
Receive a message if there is one from a default queue, invoke provided
ReceiveAndReplyCallback
and send reply message, if the callback returns one,
to the replyTo Address
from result of ReplyToAddressCallback . |
<R,S> boolean |
receiveAndReply(ReceiveAndReplyCallback<R,S> callback,
String replyExchange,
String replyRoutingKey)
Receive a message if there is one from default queue, invoke provided
ReceiveAndReplyCallback
and send reply message, if the callback returns one,
to the provided exchange and routingKey . |
<R,S> boolean |
receiveAndReply(String queueName,
ReceiveAndReplyCallback<R,S> callback)
Receive a message if there is one from provided queue, invoke provided
ReceiveAndReplyCallback
and send reply message, if the callback returns one,
to the replyTo Address
from MessageProperties
or to default exchange and default routingKey. |
<R,S> boolean |
receiveAndReply(String queueName,
ReceiveAndReplyCallback<R,S> callback,
ReplyToAddressCallback<S> replyToAddressCallback)
Receive a message if there is one from provided queue, invoke provided
ReceiveAndReplyCallback
and send reply message, if the callback returns one,
to the replyTo Address
from result of ReplyToAddressCallback . |
<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 provided
ReceiveAndReplyCallback
and send reply message, if the callback returns one,
to the provided exchange and routingKey . |
void |
send(Message message)
Send a message to a default exchange with a default routing key.
|
void |
send(String routingKey,
Message message)
Send a message to a default exchange with a specific routing key.
|
void |
send(String exchange,
String routingKey,
Message message)
Send a message to a specific exchange with a specific routing key.
|
Message |
sendAndReceive(Message message)
Basic RPC pattern.
|
Message |
sendAndReceive(String routingKey,
Message message)
Basic RPC pattern.
|
Message |
sendAndReceive(String exchange,
String routingKey,
Message message)
Basic RPC pattern.
|
void send(Message message) throws AmqpException
message
- a message to sendAmqpException
- if there is a problemvoid send(String routingKey, Message message) throws AmqpException
routingKey
- the routing keymessage
- a message to sendAmqpException
- if there is a problemvoid send(String exchange, String routingKey, Message message) throws AmqpException
exchange
- the name of the exchangeroutingKey
- the routing keymessage
- a message to sendAmqpException
- if there is a problemvoid convertAndSend(Object message) throws AmqpException
Message
and send it to a default exchange with a default routing key.message
- a message to sendAmqpException
- if there is a problemvoid convertAndSend(String routingKey, Object message) throws AmqpException
Message
and send it to a default exchange with a specific routing key.routingKey
- the routing keymessage
- a message to sendAmqpException
- if there is a problemvoid convertAndSend(String exchange, String routingKey, Object message) throws AmqpException
Message
and send it to a specific exchange with a specific routing key.exchange
- the name of the exchangeroutingKey
- the routing keymessage
- a message to sendAmqpException
- if there is a problemvoid convertAndSend(Object message, MessagePostProcessor messagePostProcessor) throws AmqpException
Message
and send it to a default exchange with a default routing key.message
- a message to sendmessagePostProcessor
- a processor to apply to the message before it is sentAmqpException
- if there is a problemvoid convertAndSend(String routingKey, Object message, MessagePostProcessor messagePostProcessor) throws AmqpException
Message
and send it to a default exchange with a specific routing key.routingKey
- the routing keymessage
- a message to sendmessagePostProcessor
- a processor to apply to the message before it is sentAmqpException
- if there is a problemvoid convertAndSend(String exchange, String routingKey, Object message, MessagePostProcessor messagePostProcessor) throws AmqpException
Message
and send it to a specific exchange with a specific routing key.exchange
- the name of the exchangeroutingKey
- the routing keymessage
- a message to sendmessagePostProcessor
- a processor to apply to the message before it is sentAmqpException
- if there is a problemMessage receive() throws AmqpException
AmqpException
- if there is a problemMessage receive(String queueName) throws AmqpException
queueName
- the name of the queue to pollAmqpException
- if there is a problemObject receiveAndConvert() throws AmqpException
AmqpException
- if there is a problemObject receiveAndConvert(String queueName) throws AmqpException
queueName
- the name of the queue to pollAmqpException
- if there is a problem<R,S> boolean receiveAndReply(ReceiveAndReplyCallback<R,S> callback) throws AmqpException
ReceiveAndReplyCallback
and send reply message, if the callback
returns one,
to the replyTo
Address
from MessageProperties
or to default exchange and default routingKey.R
- The type of the request after conversion from the Message
.S
- The type of the response.callback
- a user-provided ReceiveAndReplyCallback
implementation to process received message
and return a reply message.true
, if message was receivedAmqpException
- if there is a problem<R,S> boolean receiveAndReply(String queueName, ReceiveAndReplyCallback<R,S> callback) throws AmqpException
ReceiveAndReplyCallback
and send reply message, if the callback
returns one,
to the replyTo
Address
from MessageProperties
or to default exchange and default routingKey.R
- The type of the request after conversion from the Message
.S
- The type of the response.queueName
- the queue name to receive a message.callback
- a user-provided ReceiveAndReplyCallback
implementation to process received message
and return a reply message.true
, if message was received.AmqpException
- if there is a problem.<R,S> boolean receiveAndReply(ReceiveAndReplyCallback<R,S> callback, String replyExchange, String replyRoutingKey) throws AmqpException
ReceiveAndReplyCallback
and send reply message, if the callback
returns one,
to the provided exchange
and routingKey
.R
- The type of the request after conversion from the Message
.S
- The type of the response.callback
- a user-provided ReceiveAndReplyCallback
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.true
, if message was received.AmqpException
- if there is a problem.<R,S> boolean receiveAndReply(String queueName, ReceiveAndReplyCallback<R,S> callback, String replyExchange, String replyRoutingKey) throws AmqpException
ReceiveAndReplyCallback
and send reply message, if the callback
returns one,
to the provided exchange
and routingKey
.R
- The type of the request after conversion from the Message
.S
- The type of the response.queueName
- the queue name to receive a message.callback
- a user-provided ReceiveAndReplyCallback
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.true
, if message was receivedAmqpException
- if there is a problem<R,S> boolean receiveAndReply(ReceiveAndReplyCallback<R,S> callback, ReplyToAddressCallback<S> replyToAddressCallback) throws AmqpException
ReceiveAndReplyCallback
and send reply message, if the callback
returns one,
to the replyTo
Address
from result of ReplyToAddressCallback
.R
- The type of the request after conversion from the Message
.S
- The type of the response.callback
- a user-provided ReceiveAndReplyCallback
implementation to process received message
and return a reply message.replyToAddressCallback
- the callback to determine replyTo address at runtime.true
, if message was received.AmqpException
- if there is a problem.<R,S> boolean receiveAndReply(String queueName, ReceiveAndReplyCallback<R,S> callback, ReplyToAddressCallback<S> replyToAddressCallback) throws AmqpException
ReceiveAndReplyCallback
and send reply message, if the callback
returns one,
to the replyTo
Address
from result of ReplyToAddressCallback
.R
- The type of the request after conversion from the Message
.S
- The type of the response.queueName
- the queue name to receive a message.callback
- a user-provided ReceiveAndReplyCallback
implementation to process received message
and return a reply message.replyToAddressCallback
- the callback to determine replyTo address at runtime.true
, if message was receivedAmqpException
- if there is a problemMessage sendAndReceive(Message message) throws AmqpException
message
- a message to sendAmqpException
- if there is a problemMessage sendAndReceive(String routingKey, Message message) throws AmqpException
routingKey
- the routing keymessage
- a message to sendAmqpException
- if there is a problemMessage sendAndReceive(String exchange, String routingKey, Message message) throws AmqpException
exchange
- the name of the exchangeroutingKey
- the routing keymessage
- a message to sendAmqpException
- if there is a problemObject convertSendAndReceive(Object message) throws AmqpException
message
- a message to sendAmqpException
- if there is a problemObject convertSendAndReceive(String routingKey, Object message) throws AmqpException
routingKey
- the routing keymessage
- a message to sendAmqpException
- if there is a problemObject convertSendAndReceive(String exchange, String routingKey, Object message) throws AmqpException
exchange
- the name of the exchangeroutingKey
- the routing keymessage
- a message to sendAmqpException
- if there is a problemObject convertSendAndReceive(Object message, MessagePostProcessor messagePostProcessor) throws AmqpException
message
- a message to sendmessagePostProcessor
- a processor to apply to the message before it is sentAmqpException
- if there is a problemObject convertSendAndReceive(String routingKey, Object message, MessagePostProcessor messagePostProcessor) throws AmqpException
routingKey
- the routing keymessage
- a message to sendmessagePostProcessor
- a processor to apply to the message before it is sentAmqpException
- if there is a problemObject convertSendAndReceive(String exchange, String routingKey, Object message, MessagePostProcessor messagePostProcessor) throws AmqpException
exchange
- the name of the exchangeroutingKey
- the routing keymessage
- a message to sendmessagePostProcessor
- a processor to apply to the message before it is sentAmqpException
- if there is a problem