Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Concurrency Limit work in MassTransit RabbitMQ?

I am reading about Concurrency Limit in MassTransit RabbitMQ, but I am still not understanding how it really works.

Supposing I have 4 consumers and I configure the queues with concurrency limit to 1 config.UseConcurrencyLimit(1);. When a producer dispatch 4 messages at the same time, what will happen? Just one message will be consumed in just one consumer and all other 3 messages will be discarted?

Could someone explain me how does it work?

like image 545
Alan Nunes Avatar asked Sep 12 '25 21:09

Alan Nunes


1 Answers

The concurrency limit setting applies to the concurrency filter in GreenPipes. It sets a limit on a single consume pipe, which is a pipe for a single consumer type.

It basically tells MassTransit how many (competing) consumers of the same type it can instantiate to handle messages of the same type in parallel.

As rightfully mentioned in the question comments, there's no such thing as "discarding messages" in queueing. Even if you set the limit to one and publish 1000 messages, they will be processed, in this case, one by one.

like image 61
Alexey Zimarev Avatar answered Sep 14 '25 09:09

Alexey Zimarev