RabbitMQ: handling preloaded messages

I am using Spring AMQP to work with RabbitMQ. Here is my configuration:

<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>

As you can see, prefetchCount is 1000.

I was wondering if preprogrammed messages are being processed in parallel at the consumer; that is, several threads calling the onMessage (Message message) method. Or messages are rather processed sequentially; that is, one thread that iterates over pre-programmed messages and calls each message onMessage (Message message) method individually.

I should note that the processing order is not important to me. Just the fact that they are processed one at a time.

Thanks in advance.

+4
1

SimpleMessageListenerContainer concurrency :

concurrency: The number of concurrent consumers to start for each listener.

"1" - :

<rabbit:listener-container ... prefetch="1000" concurrency="1">
    <rabbit:listener ref="consumer" queue-names="${queue.names}" />
</rabbit:listener-container>

Spring Docs javadoc SimpleMessageListenerContainer.

+1

All Articles