Rabbit Spring Boot属性

时间:2018-09-20 23:15:56

标签: spring-boot rabbitmq spring-cloud-dataflow spring-rabbit

以下属性之间的主要区别是什么?

1)spring.rabbitmq.listener.direct.prefetch =#单个请求中要处理的消息数。该值应大于或等于交易规模(如果使用)。

2)spring.rabbitmq.listener.simple.prefetch =#单个请求中要处理的消息数。该值应大于或等于交易规模(如果使用)。

2 个答案:

答案 0 :(得分:3)

对于Spring AMQP 1.7.x和更早版本(引导1.5.x使用该版本),只有一个侦听器容器(SimpleMessageListenerContainer)。

Spring AMQP引入了一个新的侦听器容器(DirectMessageListenerContainer);因此,boot现在具有2组属性,具体取决于您选择的属性。

实际上,...direct...属性的帮助不正确,因为该容器不支持事务大小。

prefetch表示每个使用者允许多少未确认的消息。简单容器的transaction-size表示在提交事务之前处理了多少消息;它还表示发送ack之前要处理多少消息。

请参见the Spring AMQP documentation for more information about these properties

答案 1 :(得分:0)

看起来这些属性适用于旧版本的Spring Boot 当我使用特定于版本的文档时 https://docs.spring.io/spring-boot/docs/1.5.3.RELEASE/reference/html/common-application-properties.html 那么只有此属性可用: spring.rabbitmq.listener.prefetch =#单个请求中要处理的消息数。该值应大于或等于交易规模(如果使用)。