arobson / rabbot

Deprecated: Please see https://github.com/Foo-Foo-MQ/foo-foo-mq
MIT License
277 stars 129 forks source link

Disposition of unmatched messages in a subscription #86

Closed djMax closed 6 years ago

djMax commented 7 years ago

I think I'm confused about RabbitMQ/AMQP. I have a topic exchange where all keys are bound to a single queue. I subscribe to that queue with specific types, but it seems that I consume all the messages. Is that by design (such that in theory I should be routing to different queues at the exchange level), and if so where do those consumed-but-not-handled messages go?

arobson commented 6 years ago

@djMax - yeah, so Rabbit/AMQP do not do selective consumer. You can attempt to fake this by rejecting all the messages from a queue you do not want, but you will be "punished" for this in a few ways:

You hit on exactly what you should do instead: use topic filtering or other types of topology tricks to split messages into different queues. You can have queues for message types, for quality of service levels, etc.

Any time you think, "I want selective consume" or "I want priority" - just think, "oh, I need more queues" instead. I've solved all my issues in Rabbit by doing this and it's yet to bite me for the work loads I've ever used it for (including large ones).

HTH!