Changes to 1.2 Since 1.1
RabbitMQ Version
现在,Spring AMQP 默认使用 RabbitMQ 3.1.x(但是仍然兼容早期版本)。已添加弃用部分功能(不再受 RabbitMQ 3.1.x 支持的功能)——联合交换器和 RabbitTemplate
上的 immediate
属性。
Spring AMQP now uses RabbitMQ 3.1.x by default (but retains compatibility with earlier versions).
Certain deprecations have been added for features no longer supported by RabbitMQ 3.1.x — federated exchanges and the immediate
property on the RabbitTemplate
.
Rabbit Admin
现在,RabbitAdmin
提供了一个选项,让交换器、队列和绑定声明在声明失败时继续进行。以前,所有声明都会在发生故障时停止。通过设置 ignore-declaration-exceptions
,此类异常会被记录(在 WARN
级别),但是进一步的声明会继续进行。一个此设置可能派得上用场的示例是,当队列声明由于 ttl
设置稍微不同而失败,进而通常会阻止其他声明继续进行时。
RabbitAdmin
now provides an option to let exchange, queue, and binding declarations continue when a declaration fails.
Previously, all declarations stopped on a failure.
By setting ignore-declaration-exceptions
, such exceptions are logged (at the WARN
level), but further declarations continue.
An example where this might be useful is when a queue declaration fails because of a slightly different ttl
setting that would normally stop other declarations from proceeding.
现在,RabbitAdmin
提供了一个称为 getQueueProperties()
的附加方法。你可以使用此方法确定队列是否存在于代理上(对于不存在的队列,返回 null
)。此外,它会返回队列中的当前消息数以及当前使用者数。
RabbitAdmin
now provides an additional method called getQueueProperties()
.
You can use this determine if a queue exists on the broker (returns null
for a non-existent queue).
In addition, it returns the current number of messages in the queue as well as the current number of consumers.
Rabbit Template
以前,当 …sendAndReceive()
方法与固定回复队列一起使用时,两个自定义标题用于关联数据以及保留和恢复回复队列信息。使用此版本,标准消息属性(correlationId
)默认使用,尽管你可以指定使用一个自定义属性。此外,嵌套的 replyTo
信息现在会保留在模板内部,而不是使用自定义标题。
Previously, when the …sendAndReceive()
methods were used with a fixed reply queue, two custom headers were used for correlation data and to retain and restore reply queue information.
With this release, the standard message property (correlationId
) is used by default, although you can specify a custom property to use instead.
In addition, nested replyTo
information is now retained internally in the template, instead of using a custom header.
immediate
属性已弃用。在使用 RabbitMQ 3.0.x 或更高版本时,不得设置此属性。
The immediate
property is deprecated.
You must not set this property when using RabbitMQ 3.0.x or greater.
JSON Message Converters
现在提供了一个 Jackson 2.x MessageConverter
,以及使用 Jackson 1.x 的现有转换器。
A Jackson 2.x MessageConverter
is now provided, along with the existing converter that uses Jackson 1.x.
Automatic Declaration of Queues and Other Items
以前,在声明队列、交换器和绑定时,无法定义哪个连接工厂用于声明。每个 RabbitAdmin
都使用其连接来声明所有组件。
Previously, when declaring queues, exchanges and bindings, you could not define which connection factory was used for the declarations.
Each RabbitAdmin
declared all components by using its connection.
从这个版本开始,你现在可以将声明限制为特定的 RabbitAdmin
实例。请参阅 Conditional Declaration。
Starting with this release, you can now limit declarations to specific RabbitAdmin
instances.
See Conditional Declaration.
AMQP Remoting
现在提供了使用 Spring 远程调用技术,并通过 AMQP 作为 RPC 调用的传输。有关详细信息,请参见 [remoting]
Facilities are now provided for using Spring remoting techniques, using AMQP as the transport for the RPC calls. For more information see [remoting]
Requested Heart Beats
一些用户希望在 Spring AMQP 的 CachingConnectionFactory
中公开底层的客户端连接工厂的 requestedHeartBeats
属性。现在该属性已可用。以前,必须将 AMQP 客户端工厂配置为单独的 bean,并向 CachingConnectionFactory
提供对该工厂的引用。
Several users have asked for the underlying client connection factory’s requestedHeartBeats
property to be exposed on the Spring AMQP CachingConnectionFactory
.
This is now available.
Previously, it was necessary to configure the AMQP client factory as a separate bean and provide a reference to it in the CachingConnectionFactory
.