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(java.lang.Object message)
Convert a Java object to an Amqp
Message and send it to a default exchange
with a default routing key. |
void |
convertAndSend(java.lang.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(java.lang.String routingKey,
java.lang.Object message)
Convert a Java object to an Amqp
Message and send it to a default exchange
with a specific routing key. |
void |
convertAndSend(java.lang.String routingKey,
java.lang.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(java.lang.String exchange,
java.lang.String routingKey,
java.lang.Object message)
Convert a Java object to an Amqp
Message and send it to a specific exchange
with a specific routing key. |
void |
convertAndSend(java.lang.String exchange,
java.lang.String routingKey,
java.lang.Object message,
MessagePostProcessor messagePostProcessor)
Convert a Java object to an Amqp
Message and send it to a specific exchange
with a specific routing key. |
java.lang.Object |
convertSendAndReceive(java.lang.Object message)
Basic RPC pattern with conversion.
|
java.lang.Object |
convertSendAndReceive(java.lang.Object message,
MessagePostProcessor messagePostProcessor)
Basic RPC pattern with conversion.
|
java.lang.Object |
convertSendAndReceive(java.lang.String routingKey,
java.lang.Object message)
Basic RPC pattern with conversion.
|
java.lang.Object |
convertSendAndReceive(java.lang.String routingKey,
java.lang.Object message,
MessagePostProcessor messagePostProcessor)
Basic RPC pattern with conversion.
|
java.lang.Object |
convertSendAndReceive(java.lang.String exchange,
java.lang.String routingKey,
java.lang.Object message)
Basic RPC pattern with conversion.
|
java.lang.Object |
convertSendAndReceive(java.lang.String exchange,
java.lang.String routingKey,
java.lang.Object message,
MessagePostProcessor messagePostProcessor)
Basic RPC pattern with conversion.
|
<T> T |
convertSendAndReceiveAsType(java.lang.Object message,
MessagePostProcessor messagePostProcessor,
org.springframework.core.ParameterizedTypeReference<T> responseType)
Basic RPC pattern with conversion.
|
<T> T |
convertSendAndReceiveAsType(java.lang.Object message,
org.springframework.core.ParameterizedTypeReference<T> responseType)
Basic RPC pattern with conversion.
|
<T> T |
convertSendAndReceiveAsType(java.lang.String routingKey,
java.lang.Object message,
MessagePostProcessor messagePostProcessor,
org.springframework.core.ParameterizedTypeReference<T> responseType)
Basic RPC pattern with conversion.
|
<T> T |
convertSendAndReceiveAsType(java.lang.String routingKey,
java.lang.Object message,
org.springframework.core.ParameterizedTypeReference<T> responseType)
Basic RPC pattern with conversion.
|
<T> T |
convertSendAndReceiveAsType(java.lang.String exchange,
java.lang.String routingKey,
java.lang.Object message,
MessagePostProcessor messagePostProcessor,
org.springframework.core.ParameterizedTypeReference<T> responseType)
Basic RPC pattern with conversion.
|
<T> T |
convertSendAndReceiveAsType(java.lang.String exchange,
java.lang.String routingKey,
java.lang.Object message,
org.springframework.core.ParameterizedTypeReference<T> responseType)
Basic RPC pattern with conversion.
|
Message |
receive()
Receive a message if there is one from a default queue.
|
Message |
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.
|
Message |
receive(java.lang.String queueName)
Receive a message if there is one from a specific queue.
|
Message |
receive(java.lang.String queueName,
long timeoutMillis)
Receive a message from a specific queue, waiting up to the specified wait time if
necessary for a message to become available.
|
java.lang.Object |
receiveAndConvert()
Receive a message if there is one from a default queue and convert it to a Java
object.
|
java.lang.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,
org.springframework.core.ParameterizedTypeReference<T> type)
Receive a message if there is one from a default queue and convert it to a Java
object.
|
<T> T |
receiveAndConvert(org.springframework.core.ParameterizedTypeReference<T> type)
Receive a message if there is one from a default queue and convert it to a Java
object.
|
java.lang.Object |
receiveAndConvert(java.lang.String queueName)
Receive a message if there is one from a specific queue and convert it to a Java
object.
|
java.lang.Object |
receiveAndConvert(java.lang.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(java.lang.String queueName,
long timeoutMillis,
org.springframework.core.ParameterizedTypeReference<T> type)
Receive a message if there is one from a specific queue and convert it to a Java
object.
|
<T> T |
receiveAndConvert(java.lang.String queueName,
org.springframework.core.ParameterizedTypeReference<T> type)
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,
java.lang.String replyExchange,
java.lang.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(java.lang.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(java.lang.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(java.lang.String queueName,
ReceiveAndReplyCallback<R,S> callback,
java.lang.String replyExchange,
java.lang.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(java.lang.String routingKey,
Message message)
Send a message to a default exchange with a specific routing key.
|
void |
send(java.lang.String exchange,
java.lang.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(java.lang.String routingKey,
Message message)
Basic RPC pattern.
|
Message |
sendAndReceive(java.lang.String exchange,
java.lang.String routingKey,
Message message)
Basic RPC pattern.
|
void send(Message message) throws AmqpException
message
- a message to sendAmqpException
- if there is a problemvoid send(java.lang.String routingKey, Message message) throws AmqpException
routingKey
- the routing keymessage
- a message to sendAmqpException
- if there is a problemvoid send(java.lang.String exchange, java.lang.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(java.lang.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(java.lang.String routingKey, java.lang.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(java.lang.String exchange, java.lang.String routingKey, java.lang.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(java.lang.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(java.lang.String routingKey, java.lang.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(java.lang.String exchange, java.lang.String routingKey, java.lang.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(java.lang.String queueName) throws AmqpException
queueName
- the name of the queue to pollAmqpException
- if there is a problemMessage receive(long timeoutMillis) throws AmqpException
timeoutMillis
- how long to wait before giving up. Zero value means the method
will return null
immediately if there is no message available. Negative
value makes method wait for a message indefinitely.AmqpException
- if there is a problemMessage receive(java.lang.String queueName, long timeoutMillis) throws AmqpException
queueName
- the queue to receive fromtimeoutMillis
- how long to wait before giving up. Zero value means the method
will return null
immediately if there is no message available. Negative
value makes method wait for a message indefinitely.AmqpException
- if there is a problemjava.lang.Object receiveAndConvert() throws AmqpException
AmqpException
- if there is a problemjava.lang.Object receiveAndConvert(java.lang.String queueName) throws AmqpException
queueName
- the name of the queue to pollAmqpException
- if there is a problemjava.lang.Object receiveAndConvert(long timeoutMillis) throws AmqpException
timeoutMillis
- how long to wait before giving up. Zero value means the method
will return null
immediately if there is no message available. Negative
value makes method wait for a message indefinitely.AmqpException
- if there is a problemjava.lang.Object receiveAndConvert(java.lang.String queueName, long timeoutMillis) throws AmqpException
queueName
- the name of the queue to polltimeoutMillis
- how long to wait before giving up. Zero value means the method
will return null
immediately if there is no message available. Negative
value makes method wait for a message indefinitely.AmqpException
- if there is a problem<T> T receiveAndConvert(org.springframework.core.ParameterizedTypeReference<T> type) throws AmqpException
SmartMessageConverter
.T
- the type.type
- the type to convert to.AmqpException
- if there is a problem.<T> T receiveAndConvert(java.lang.String queueName, org.springframework.core.ParameterizedTypeReference<T> type) throws AmqpException
SmartMessageConverter
.T
- the type.queueName
- the name of the queue to polltype
- the type to convert to.AmqpException
- if there is a problem<T> T receiveAndConvert(long timeoutMillis, org.springframework.core.ParameterizedTypeReference<T> type) throws AmqpException
SmartMessageConverter
.T
- the type.timeoutMillis
- how long to wait before giving up. Zero value means the method
will return null
immediately if there is no message available. Negative
value makes method wait for a message indefinitely.type
- the type to convert to.AmqpException
- if there is a problem<T> T receiveAndConvert(java.lang.String queueName, long timeoutMillis, org.springframework.core.ParameterizedTypeReference<T> type) throws AmqpException
SmartMessageConverter
.T
- the type.queueName
- the name of the queue to polltimeoutMillis
- how long to wait before giving up. Zero value means the method
will return null
immediately if there is no message available. Negative
value makes method wait for a message indefinitely.type
- the type to convert to.AmqpException
- 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(java.lang.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, java.lang.String replyExchange, java.lang.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(java.lang.String queueName, ReceiveAndReplyCallback<R,S> callback, java.lang.String replyExchange, java.lang.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(java.lang.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(java.lang.String routingKey, Message message) throws AmqpException
routingKey
- the routing keymessage
- a message to sendAmqpException
- if there is a problemMessage sendAndReceive(java.lang.String exchange, java.lang.String routingKey, Message message) throws AmqpException
exchange
- the name of the exchangeroutingKey
- the routing keymessage
- a message to sendAmqpException
- if there is a problemjava.lang.Object convertSendAndReceive(java.lang.Object message) throws AmqpException
message
- a message to sendAmqpException
- if there is a problemjava.lang.Object convertSendAndReceive(java.lang.String routingKey, java.lang.Object message) throws AmqpException
routingKey
- the routing keymessage
- a message to sendAmqpException
- if there is a problemjava.lang.Object convertSendAndReceive(java.lang.String exchange, java.lang.String routingKey, java.lang.Object message) throws AmqpException
exchange
- the name of the exchangeroutingKey
- the routing keymessage
- a message to sendAmqpException
- if there is a problemjava.lang.Object convertSendAndReceive(java.lang.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 problemjava.lang.Object convertSendAndReceive(java.lang.String routingKey, java.lang.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 problemjava.lang.Object convertSendAndReceive(java.lang.String exchange, java.lang.String routingKey, java.lang.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<T> T convertSendAndReceiveAsType(java.lang.Object message, org.springframework.core.ParameterizedTypeReference<T> responseType) throws AmqpException
SmartMessageConverter
.T
- the type.message
- a message to send.responseType
- the type to convert the reply to.AmqpException
- if there is a problem.<T> T convertSendAndReceiveAsType(java.lang.String routingKey, java.lang.Object message, org.springframework.core.ParameterizedTypeReference<T> responseType) throws AmqpException
SmartMessageConverter
.T
- the type.routingKey
- the routing keymessage
- a message to sendresponseType
- the type to convert the reply to.AmqpException
- if there is a problem<T> T convertSendAndReceiveAsType(java.lang.String exchange, java.lang.String routingKey, java.lang.Object message, org.springframework.core.ParameterizedTypeReference<T> responseType) throws AmqpException
SmartMessageConverter
.T
- the type.exchange
- the name of the exchangeroutingKey
- the routing keymessage
- a message to sendresponseType
- the type to convert the reply to.AmqpException
- if there is a problem<T> T convertSendAndReceiveAsType(java.lang.Object message, MessagePostProcessor messagePostProcessor, org.springframework.core.ParameterizedTypeReference<T> responseType) throws AmqpException
SmartMessageConverter
.T
- the type.message
- a message to sendmessagePostProcessor
- a processor to apply to the message before it is sentresponseType
- the type to convert the reply to.AmqpException
- if there is a problem<T> T convertSendAndReceiveAsType(java.lang.String routingKey, java.lang.Object message, MessagePostProcessor messagePostProcessor, org.springframework.core.ParameterizedTypeReference<T> responseType) throws AmqpException
SmartMessageConverter
.T
- the type.routingKey
- the routing keymessage
- a message to sendmessagePostProcessor
- a processor to apply to the message before it is sentresponseType
- the type to convert the reply to.AmqpException
- if there is a problem<T> T convertSendAndReceiveAsType(java.lang.String exchange, java.lang.String routingKey, java.lang.Object message, MessagePostProcessor messagePostProcessor, org.springframework.core.ParameterizedTypeReference<T> responseType) throws AmqpException
SmartMessageConverter
.T
- the type.exchange
- the name of the exchangeroutingKey
- the routing keymessage
- a message to sendmessagePostProcessor
- a processor to apply to the message before it is sentresponseType
- the type to convert the reply to.AmqpException
- if there is a problem