Search code examples
rabbitmqspring-rabbit

Spring - Rabbit template - Bulk operation


Anyone knows if it is possible to send a collection of messages to a queue using Rabbit template?

Obviously I can send them one at a time, but I want to do it in a single bulk operation (to gain performance).

Thanks!


Solution

  • See Reference Manual about batching support:

    Starting with version 1.4.2, the BatchingRabbitTemplate has been introduced. This is a subclass of RabbitTemplate with an overridden send method that batches messages according to the BatchingStrategy; only when a batch is complete is the message sent to RabbitMQ.