Changes in 1.7 Since 1.6

AMQP Client library

Spring AMPQ 现使用 RabbitMQ 团队提供的 amqp-client 库的新版 4.0.x。此客户端默认配置了自动恢复。参见 RabbitMQ Automatic Connection/Topology recovery

Spring AMQP now uses the new 4.0.x version of the amqp-client library provided by the RabbitMQ team. This client has auto-recovery configured by default. See RabbitMQ Automatic Connection/Topology recovery.

4.0.x 客户端默认启用自动恢复。Spring AMQP 与此功能兼容,但有自己的恢复机制,通常不需要客户端恢复功能。我们建议禁用 amqp-client 自动恢复,以避免在代理可用但连接尚未恢复时获取 AutoRecoverConnectionNotCurrentlyOpenException 实例。从版本 1.7.1 开始,Spring AMQP 会禁用它,除非您显式创建自己的 RabbitMQ 连接工厂并将其提供给 CachingConnectionFactory。由 RabbitConnectionFactoryBean 创建的 RabbitMQ ConnectionFactory 实例的选项在默认情况下也处于禁用状态。

The 4.0.x client enables automatic recovery by default. While compatible with this feature, Spring AMQP has its own recovery mechanisms, and the client recovery feature generally is not needed. We recommend disabling amqp-client automatic recovery, to avoid getting AutoRecoverConnectionNotCurrentlyOpenException instances when the broker is available but the connection has not yet recovered. Starting with version 1.7.1, Spring AMQP disables it unless you explicitly create your own RabbitMQ connection factory and provide it to the CachingConnectionFactory. RabbitMQ ConnectionFactory instances created by the RabbitConnectionFactoryBean also have the option disabled by default.

Log4j 2 upgrade

AmqpAppender 的最小 Log4j 2 版本现在是 2.7。该框架不再与以前的版本兼容。有关更多信息,请参见 Logging Subsystem AMQP Appenders

The minimum Log4j 2 version (for the AmqpAppender) is now 2.7. The framework is no longer compatible with previous versions. See Logging Subsystem AMQP Appenders for more information.

Logback Appender

默认情况下,此追加器不再捕获调用者数据(方法、行号)。你可以通过设置 includeCallerData 配置选项重新启用它。有关可用的日志追加器的信息,请参见 Logging Subsystem AMQP Appenders

This appender no longer captures caller data (method, line number) by default. You can re-enable it by setting the includeCallerData configuration option. See Logging Subsystem AMQP Appenders for information about the available log appenders.

Spring Retry Upgrade

最低 Spring Retry 版本现在为 1.2。该框架不再与以前的版本兼容。

The minimum Spring Retry version is now 1.2. The framework is no longer compatible with previous versions.

Shutdown Behavior

你现在可以将 forceCloseChannel 设置为 true,这样,如果容器线程未在 shutdownTimeout 内响应关闭,则通道将强制关闭,导致任何未确认消息重新排队。有关更多信息,请参见 Message Listener Container Configuration

You can now set forceCloseChannel to true so that, if the container threads do not respond to a shutdown within shutdownTimeout, the channels are forced closed, causing any unacked messages to be re-queued. See Message Listener Container Configuration for more information.

FasterXML Jackson upgrade

最低 Jackson 版本现在为 2.8。该框架不再与以前的版本兼容。

The minimum Jackson version is now 2.8. The framework is no longer compatible with previous versions.

JUnit @Rules

框架以前在内部使用的规则现在在一个名为 spring-rabbit-junit 的单独 JAR 中提供。有关详细信息,请参阅 JUnit @Rules

Rules that have previously been used internally by the framework have now been made available in a separate jar called spring-rabbit-junit. See JUnit @Rules for more information.

Container Conditional Rollback

当您使用外部事务管理器(例如 JDBC)时,现在支持基于规则的回滚,当您为容器提供事务属性时。现在,当您使用事务建议时,它也更灵活了。

When you use an external transaction manager (such as JDBC), rule-based rollback is now supported when you provide the container with a transaction attribute. It is also now more flexible when you use a transaction advice.

Connection Naming Strategy

现在提供了一个新的 ConnectionNameStrategy 以从 AbstractConnectionFactory 填充目标 RabbitMQ 连接的应用特定标识。有关更多信息,请参见 Connection and Resource Management

A new ConnectionNameStrategy is now provided to populate the application-specific identification of the target RabbitMQ connection from the AbstractConnectionFactory. See Connection and Resource Management for more information.

Listener Container Changes

Transaction Rollback Behavior

您现在可以配置消息重新入队的预留事务回滚一致,无论是否配置了事务管理器。参见 A note on Rollback of Received Messages 了解更多信息。

You can now configure message re-queue on transaction rollback to be consistent, regardless of whether or not a transaction manager is configured. See A note on Rollback of Received Messages for more information.