Changes in 1.6 Since 1.5

Testing Support

A new testing support library is now provided. See Testing Support for more information.

Builder

Builders that provide a fluent API for configuring Queue and Exchange objects are now available. See Builder API for Queues and Exchanges for more information.

Namespace Changes

Connection Factory

You can now add a thread-factory to a connection factory bean declaration — for example, to name the threads created by the amqp-client library. See Connection and Resource Management for more information.

When you use CacheMode.CONNECTION, you can now limit the total number of connections allowed. See Connection and Resource Management for more information.

Queue Definitions

You can now provide a naming strategy for anonymous queues. See AnonymousQueue for more information.

Listener Container Changes

Idle Message Listener Detection

You can now configure listener containers to publish ApplicationEvent instances when idle. See Detecting Idle Asynchronous Consumers for more information.

Mismatched Queue Detection

By default, when a listener container starts, if queues with mismatched properties or arguments are detected, the container logs the exception but continues to listen. The container now has a property called mismatchedQueuesFatal, which prevents the container (and context) from starting if the problem is detected during startup. It also stops the container if the problem is detected later, such as after recovering from a connection failure. See Message Listener Container Configuration for more information.

Listener Container Logging

Now, listener container provides its beanName to the internal SimpleAsyncTaskExecutor as a threadNamePrefix. It is useful for logs analysis.

Default Error Handler

The default error handler (ConditionalRejectingErrorHandler) now considers irrecoverable @RabbitListener exceptions as fatal. See Exception Handling for more information.

AutoDeclare and RabbitAdmin Instances

See Message Listener Container Configuration (autoDeclare) for some changes to the semantics of that option with respect to the use of RabbitAdmin instances in the application context.

AmqpTemplate: Receive with Timeout

A number of new receive() methods with timeout have been introduced for the AmqpTemplate and its RabbitTemplate implementation. See Polling Consumer for more information.

Using AsyncRabbitTemplate

A new AsyncRabbitTemplate has been introduced. This template provides a number of send and receive methods, where the return value is a ListenableFuture, which can be used later to obtain the result either synchronously or asynchronously. See Async Rabbit Template for more information.

RabbitTemplate Changes

1.4.1 introduced the ability to use direct reply-to when the broker supports it. It is more efficient than using a temporary queue for each reply. This version lets you override this default behavior and use a temporary queue by setting the useTemporaryReplyQueues property to true. See RabbitMQ Direct reply-to for more information.

The RabbitTemplate now supports a user-id-expression (userIdExpression when using Java configuration). See Validated User-ID RabbitMQ documentation and Validated User Id for more information.

Message Properties

Using CorrelationId

The correlationId message property can now be a String. See Message Properties Converters for more information.

Long String Headers

Previously, the DefaultMessagePropertiesConverter “converted” headers longer than the long string limit (default 1024) to a DataInputStream (actually, it referenced the LongString instance’s DataInputStream). On output, this header was not converted (except to a String — for example, java.io.DataInputStream@1d057a39 by calling toString() on the stream).

With this release, long LongString instances are now left as LongString instances by default. You can access the contents by using the getBytes[], toString(), or getStream() methods. A large incoming LongString is now correctly “converted” on output too.

See Message Properties Converters for more information.

Inbound Delivery Mode

The deliveryMode property is no longer mapped to the MessageProperties.deliveryMode. This change avoids unintended propagation if the the same MessageProperties object is used to send an outbound message. Instead, the inbound deliveryMode header is mapped to MessageProperties.receivedDeliveryMode.

See Message Properties Converters for more information.

When using annotated endpoints, the header is provided in the header named AmqpHeaders.RECEIVED_DELIVERY_MODE.

See Annotated Endpoint Method Signature for more information.

Inbound User ID

The user_id property is no longer mapped to the MessageProperties.userId. This change avoids unintended propagation if the the same MessageProperties object is used to send an outbound message. Instead, the inbound userId header is mapped to MessageProperties.receivedUserId.

See Message Properties Converters for more information.

When you use annotated endpoints, the header is provided in the header named AmqpHeaders.RECEIVED_USER_ID.

See Annotated Endpoint Method Signature for more information.

RabbitAdmin Changes

Declaration Failures

Previously, the ignoreDeclarationFailures flag took effect only for IOException on the channel (such as mis-matched arguments). It now takes effect for any exception (such as TimeoutException). In addition, a DeclarationExceptionEvent is now published whenever a declaration fails. The RabbitAdmin last declaration event is also available as a property lastDeclarationExceptionEvent. See Configuring the Broker for more information.

@RabbitListener Changes

Multiple Containers for Each Bean

When you use Java 8 or later, you can now add multiple @RabbitListener annotations to @Bean classes or their methods. When using Java 7 or earlier, you can use the @RabbitListeners container annotation to provide the same functionality. See @Repeatable @RabbitListener for more information.

@SendTo SpEL Expressions

@SendTo for routing replies with no replyTo property can now be SpEL expressions evaluated against the request/reply. See Reply Management for more information.

@QueueBinding Improvements

You can now specify arguments for queues, exchanges, and bindings in @QueueBinding annotations. Header exchanges are now supported by @QueueBinding. See Annotation-driven Listener Endpoints for more information.

Delayed Message Exchange

Spring AMQP now has first class support for the RabbitMQ Delayed Message Exchange plugin. See Delayed Message Exchange for more information.

Exchange Internal Flag

Any Exchange definitions can now be marked as internal, and RabbitAdmin passes the value to the broker when declaring the exchange. See Configuring the Broker for more information.

CachingConnectionFactory Changes

CachingConnectionFactory Cache Statistics

The CachingConnectionFactory now provides cache properties at runtime and over JMX. See Runtime Cache Properties for more information.

Accessing the Underlying RabbitMQ Connection Factory

A new getter has been added to provide access to the underlying factory. You can use this getter, for example, to add custom connection properties. See Adding Custom Client Connection Properties for more information.

Channel Cache

The default channel cache size has been increased from 1 to 25. See Connection and Resource Management for more information.

In addition, the SimpleMessageListenerContainer no longer adjusts the cache size to be at least as large as the number of concurrentConsumers — this was superfluous, since the container consumer channels are never cached.

Using RabbitConnectionFactoryBean

The factory bean now exposes a property to add client connection properties to connections made by the resulting factory.

Java Deserialization

You can now configure a “allowed list” of allowable classes when you use Java deserialization. You should consider creating an allowed list if you accept messages with serialized java objects from untrusted sources. See Java Deserialization for more information.

JSON MessageConverter

Improvements to the JSON message converter now allow the consumption of messages that do not have type information in message headers. See Message Conversion for Annotated Methods and [json-message-converter] for more information.

Logging Appenders

Log4j 2

A log4j 2 appender has been added, and the appenders can now be configured with an addresses property to connect to a broker cluster.

Client Connection Properties

You can now add custom client connection properties to RabbitMQ connections.

See Logging Subsystem AMQP Appenders for more information.