我正在使用Spring AMQP与RabbitMQ一起工作.这是我的配置:
<rabbit:connection-factory id="connectionFactory"
host="${queue.host}" port="${queue.port}" />
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory" />
<rabbit:admin connection-factory="connectionFactory" />
<rabbit:queue name="${queue.names}" durable="true"
exclusive="false" />
<rabbit:listener-container
connection-factory="connectionFactory" acknowledge="auto" error-handler="airbrakeHandler" prefetch="1000" >
<rabbit:listener ref="consumer" queue-names="${queue.names}" />
</rabbit:listener-container>
Run Code Online (Sandbox Code Playgroud)
如您所见,prefetchCount为1000.
我想知道预取消息是否在消费者中并行处理; 也就是说,多个线程调用onMessage(消息消息)方法.或者是按顺序处理消息; 也就是说,一个线程迭代预取消息,并以一种有序的方式在每个消息上调用onMessage(消息消息)方法.
我应该注意,处理的顺序对我来说并不重要.只是他们一次处理一个这样的事实.
提前致谢.