diff --git a/src/reference/docbook/amqp.xml b/src/reference/docbook/amqp.xml index ef7d9411..260efc01 100644 --- a/src/reference/docbook/amqp.xml +++ b/src/reference/docbook/amqp.xml @@ -311,6 +311,30 @@ Connection connection = connectionFactory.createConnection();]]>]]> + + + Publisher Confirms and Returns + + Confirmed and returned messages are supported by setting the + CachingConnectionFactory's publisherConfirms + and publisherReturns properties to 'true' respectively. + + When these options are set, Channels created by + the factory are wrapped in an PublisherCallbackChannel + which is used to facilitate the callbacks. When such a channel is obtained, the + client can register a PublisherCallbackChannel.Listener + with the Channel. The + PublisherCallbackChannel implementation contains logic + to route a confirm/return to the appropriate listener. + + These features are explained further in the following sections. + + + For some more background information, please see the following blog + post by the RabbitMQ team titled + Introducing Publisher Confirms. + +
@@ -338,6 +362,48 @@ Connection connection = connectionFactory.createConnection();]]> + + + Publisher Confirms and Returns + + The RabbitTemplate implementation of AmqpTemplate + supports Publisher Confirms and Returns. + + + For returned messages, the template's + mandatory property must be set to 'true', and it requires + a CachingConnectionFactory that has its + publisherReturns property set to true. Returns are sent to + to the client by it registering a RabbitTemplate.ReturnCallback + by calling setReturnCallback(ReturnCallback callback). The callback + must implement this method: + + + + Only one ReturnCallback is supported by each + RabbitTemplate. + + + For Publisher Confirms (aka Publisher Acknowledgements), the template requires + a CachingConnectionFactory that has its + publisherConfirms property set to true. Confirms are sent to + to the client by it registering a RabbitTemplate.ConfirmCallback + by calling setConfirmCallback(ConfirmCallback callback). The callback + must implement this method: + + + + The CorrelationData is an object supplied by the client when sending the + original message. This is described further in the next section. + + + Only one ConfirmCallback is supported by a + RabbitTemplate. + +
@@ -407,7 +473,24 @@ template.send("queue.helloWorld", new Message("Hello World".getBytes(), someProp template.setRoutingKey("queue.helloWorld"); // but we'll always send to this Queue template.send(new Message("Hello World".getBytes(), someProperties));]]> - + + Publisher Confirms + + With the RabbitTemplate implementation of AmqpTemplate, + each of the send() methods has an overloaded version that takes an + additional CorrelationData object. When publisher confirms + are enabled, this object is returned in the callback described in + . This allows the sender to correlate + a confirm (ack or nack) with the sent message. + + + + Publisher Returns + + When the template's mandatory property is 'true' returned messages are provided + by the callback described in . + +
@@ -810,7 +893,7 @@ Object receiveAndConvert(String queueName) throws AmqpException;]]> - + Queues can be configured with additional arguments, for example, 'x-message-ttl' or 'x-ha-policy'. Using the namespace support, they are provided in the form of a Map of argument name/argument value pairs, using the