Changes in 3.0 Since 2.4
-
弃用远程功能
-
集成 Micrometer 观察
-
支持创建本机图像
-
将 AsyncRabbitTemplate 升级为返回 CompletableFuture
-
增强 RabbitMQ 流支持
-
扩展 @RabbitListener 批量侦听能力
-
通过 MessageConverter 支持 null 值
-
通过容器工厂配置 ReplyPostProcessor
-
支持 Kotlin 协程 @RabbitListener 方法
-
故障后为异步侦听器调用 RabbitListenerErrorHandler
-
调整 AbstractConnectionFactory 中的默认 addressShuffleMode 为 RANDOM
Java 17, Spring Framework 6.0
此版本需要 Spring Framework 6.0 和 Java 17
This version requires Spring Framework 6.0 and Java 17
Observation
现在支持使用 Micrometer 启用计时器和跟踪的观察。有关更多信息,请参见 Micrometer Observation。
Enabling observation for timers and tracing using Micrometer is now supported. See Micrometer Observation for more information.
Native Images
提供了创建原生映像的支持。有关更多信息,请参见 Native Images。
Support for creating native images is provided. See Native Images for more information.
AsyncRabbitTemplate
现在,返回的是而不是。有关详细信息,请参阅。
The AsyncRabbitTemplate
now returns CompletableFuture
s instead of ListenableFuture
s.
See Async Rabbit Template for more information.
Stream Support Changes
和方法现在返回而不是。
RabbitStreamOperations
and RabbitStreamTemplate
methods now return CompletableFuture
instead of ListenableFuture
.
现在支持超级流和单个活动使用者。
Super streams and single active consumers thereon are now supported.
涉及更多信息,请参阅 Using the RabbitMQ Stream Plugin。
See Using the RabbitMQ Stream Plugin for more information.
@RabbitListener
Changes
批量监听器现在可以消耗 Collection<?>`和 `List<?>
。批量消息适配器现在可确保该方法适合于消耗批量。将容器工厂 consumerBatchEnabled`设置为 `true`时,`batchListener`属性也会设置为 `true
。有关更多信息,请参阅 @RabbitListener with Batching。
Batch listeners can now consume Collection<?>
as well as List<?>
.
The batch messaging adapter now ensures that the method is suitable for consuming batches.
When setting the container factory consumerBatchEnabled
to true
, the batchListener
property is also set to true
.
See @RabbitListener with Batching for more information.
MessageConverter`现在可以为 null 值返回 `Optional.empty()
;此操作目前由 Jackson2JsonMessageConverter`实现。有关更多信息,请参见 Converting from a `Message
。
MessageConverter
s can now return Optional.empty()
for a null value; this is currently implemented by the Jackson2JsonMessageConverter
.
See Converting from a Message
for more information
现在可以通过容器工厂配置 ReplyPostProcessor
,而不是通过 `@RabbitListener`中的属性配置。有关更多信息,请参阅 Reply Management。
You can now configure a ReplyPostProcessor
via the container factory rather than via a property on @RabbitListener
.
See Reply Management for more information.
@RabbitListener
(和 @RabbitHandler
)的方法现在可以被声明为 Kotlin suspend`函数。有关更多信息,请参阅 Asynchronous `@RabbitListener
Return Types。
The @RabbitListener
(and @RabbitHandler
) methods can now be declared as Kotlin suspend
functions.
See Asynchronous @RabbitListener
Return Types for more information.
从版本 3.0.5 开始,具有异步返回类型(包括 Kotlin 挂起函数)的侦听器将在发生故障后调用 RabbitListenerErrorHandler
(如果已配置)。以前,错误处理程序仅与同步调用一起调用。
Starting with version 3.0.5, listeners with async return types (including Kotlin suspend functions) invoke the RabbitListenerErrorHandler
(if configured) after a failure.
Previously, the error handler was only invoked with synchronous invocations.
Connection Factory Changes
现在,AbstractConnectionFactory`中 `addressShuffleMode`的默认值为 `RANDOM
。当提供多个地址时,这会导致连接到随机主机。有关更多信息,请参见 Connecting to a Cluster。
The default addressShuffleMode
in AbstractConnectionFactory
is now RANDOM
.
This results in connecting to a random host when multiple addresses are provided.
See Connecting to a Cluster for more information.
LocalizedQueueConnectionFactory`不再使用 RabbitMQ `http-client`库来确定哪个节点是队列的领导者。有关更多信息,请参见 Queue Affinity and the `LocalizedQueueConnectionFactory
。
The LocalizedQueueConnectionFactory
no longer uses the RabbitMQ http-client
library to determine which node is the leader for a queue.
See Queue Affinity and the LocalizedQueueConnectionFactory
for more information.