Is it possible to publish multiple messages at once using the RabbitMQ client for C #?

At the moment, our publication code for a large number of posts looks like this:

foreach (var message in messages) { publisher.Publish(message); } 

Is it possible to send several messages at once on the channel?

 publisher.Publish(messages); 

or so if we buy

 var chunks = messages.Chunk(100); foreach (var chunk in chunks) { publisher.Publish(chunk); } 
+7
c # rabbitmq
source share
1 answer

For RabbitMQ, the AMQP protocol is asynchronous for production and consumption operations, so it is not clear how to capitalize on the endpoint endpoint given from the box.

What you can do is create endpoints for fragmented messages and process them inside the workflow if you can speed up operations. Thus, one solution would, for example, be to include a batch component in front of the publisher class and send special messages.

0
source share

All Articles