Consumer limited to specific routing key

133 views
Skip to first unread message

Arturo Nigro

unread,
Mar 22, 2023, 5:01:38 AM3/22/23
to rabbitmq-discuss
Hi all, 
I wonder if following scenario can work:

I have a direct exchange where are published two kind of messages, each associated to a different routing key, let's say "short" (very frequent) and "long" (once a day).
One queue binded to both routing key.

Now I've 10 concurrent consumers listening on that queue.
I would like that all consumers consume "short" messages.
But only 5 of them should consume "long" messages.

Is it possible ?

The reason is to have always maximum 10 concurrent message processing and process "short" messages as quick as possible.

Splitting routing keys on two different queues will reduce the processing rate for "short" messages (only 5 consumers for example) and leave idle consumers for "long" message, since is at daily basis. 

Thanks in advance for helping.

Arturo

pvladMQ

unread,
Jul 7, 2023, 7:03:27 PM7/7/23
to rabbitmq-discuss
Technically speaking, it is possible, but it doesn't really make sense. 
Have a look at the accepted answer here https://stackoverflow.com/questions/34809946/rabbit-mq-filtering , it's very clear why it is not a good idea to do what you're proposing. 
Reply all
Reply to author
Forward
0 new messages