Pand005
Pand005

Reputation: 1175

Multi-threaded consumer configuration in RabbitMQ server using spring amqp?

We are implementing RabbitMQ using Spring-AMQP and our requirement is to run consumer in multiple threads to consume messages from single queue. Is there any server(RabbitMQ) side scripting need to be done or any other ways we can run the multiple threads at consumer level for single queue?

Thanks in advance!

Upvotes: 2

Views: 6853

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121177

I guess, it is your answer:

<rabbit:listener-container id="container1" connection-factory="connectionFactory" acknowledge="manual" concurrency="5">
    <rabbit:listener id="testListener" queue-names="foo, #{bar.name}" ref="testBean" method="handle"/>
</rabbit:listener-container>

Pay attention to the concurrency attribute. Here is a manual

Upvotes: 5

Related Questions