You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Host.RabbitMq] Multiple consumers with varying concurrency #205
Did you try the provided suggestion (with ConsumerDispatchConcurrency setting)?
Sounds like you've taken another route, can you explain what you mean several buses for one consumer?
Thanks
Apologies, I wrote this under the wrong issue; it should have been under https://github.com/zarusz/SlimMessageBus/issues/205
I need 2 or more consumers. I have one producer, one exchange, and three queues for three different consumers. When publishing a message, the target queue is determined via the routingKey.
One of the consumers performs a resource-intensive operation, so it needs to be limited to processing only 2 messages in parallel. The other consumers can handle more messages simultaneously.
I would like to configure the number of messages that can be processed concurrently per consumer, similar to how it works in MemoryMessageBus. Currently, messages are processed based on the ConsumerDispatchConcurrency setting, which applies globally to all consumers.
changed the title [-] Concurrently processed messages for RabbitMq transport[/-][+][Host.RabbitMq] Multiple consumers with varrying concurrency[/+]on Dec 19, 2024
changed the title [-][Host.RabbitMq] Multiple consumers with varrying concurrency[/-][+][Host.RabbitMq] Multiple consumers with varying concurrency[/+]on Dec 19, 2024
services.AddSlimMessageBus(mbb =>{mbb.Produce<PingMessage>(x =>x.Exchange("exchange",exchangeType:ExchangeType.Direct).RoutingKeyProvider((m,p)=>m.Label));// messages with blue routing key will get 1 concurrencymbb.Consume<PingMessage>(x =>x.Queue("queue",autoDelete:false).ExchangeBinding("orders",routingKey:"blue").Instances(1));// messages with red routing key will get 10 concurrencymbb.Consume<PingMessage>(x =>x.Queue("queue",autoDelete:false).ExchangeBinding("orders",routingKey:"red").Instances(10));});
Activity
zarusz commentedon Jan 9, 2024
hello @robert94p ,
By default, the underlying RabbitMq net driver uses a concurrency of 1.
Following this it can be adjusted on the
ConnectionFactoryobject.For example, try to set this via SMB like so:
Please let me know if this worked for you.
robert94p commentedon Jan 11, 2024
registered several buses for one consumer. While it works
zarusz commentedon Jan 11, 2024
Did you try the provided suggestion (with
ConsumerDispatchConcurrencysetting)?Sounds like you've taken another route, can you explain what you mean several buses for one consumer?
Thanks
Concurrently processed messages for RabbitMq transport #205
Concurrently processed messages for RabbitMq transport #205
Concurrently processed messages for RabbitMq transport #205
Concurrently processed messages for RabbitMq transport #205
zarusz commentedon Jan 14, 2024
As part of #207 I have updated the docs to include information on how to increase concurrency.
If you run into any problems, please re-open the issue and let me know.
Thanks!
zarusz commentedon Dec 19, 2024
Moving the following from @robert94p #310 (comment):
[-] Concurrently processed messages for RabbitMq transport[/-][+][Host.RabbitMq] Multiple consumers with varrying concurrency[/+][-][Host.RabbitMq] Multiple consumers with varrying concurrency[/-][+][Host.RabbitMq] Multiple consumers with varying concurrency[/+]zarusz commentedon Dec 19, 2024
@robert94p I believe this is a good example of what you are trying to achieve, correct?
https://www.rabbitmq.com/tutorials/tutorial-four-dotnet
Here is the preview release to try out:
https://www.nuget.org/packages/SlimMessageBus.Host.RabbitMQ/2.6.2-rc10
Here is a pseudo sample:
Let me know if that works for you.
zarusz commentedon Dec 23, 2024
I just pushed a refined version:
https://www.nuget.org/packages/SlimMessageBus.Host.RabbitMQ/2.6.2-rc12
With that, the overall concurrency should be improved.