Class AsyncRabbitTemplate

All Implemented Interfaces:
AsyncAmqpTemplate, MessageListener, RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnCallback, RabbitTemplate.ReturnsCallback, ChannelAwareMessageListener, Aware, BeanNameAware, Lifecycle, Phased, SmartLifecycle

Provides asynchronous send and receive operations returning a ListenableFuture allowing the caller to obtain the reply later, using get() or a callback.

When confirms are enabled, the future has a confirm property which is itself a ListenableFuture. If the reply is received before the publisher confirm, the confirm is discarded since the reply implicitly indicates the message was published.

Returned (undeliverable) request messages are presented as a AmqpMessageReturnedException cause of an ExecutionException.

Internally, the template uses a RabbitTemplate and an AbstractMessageListenerContainer either provided or constructed internally (a SimpleMessageListenerContainer). If an external RabbitTemplate is provided and confirms/returns are enabled, it must not previously have had callbacks registered because this object needs to be the callback.

Gary Russell, Artem Bilan