Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unique Messages per Queue in AMQP?

Tags:

rabbitmq

amqp

This is similar to this other question but with a bit of a twist: I read in the specification that the message-id for AMQP messages should be set by the application itself, so in theory I could use that to guarantee a certain degree of uniqueness, right?

My main question is now: In what scope is that message-id garantueed to be unique? For the messages currently enqueued inside a specific queue? Over all queues? Over the universe? :-)

And is this behaviour standardized? I plan to use RabbitMQ here, but it would be nice to have something not vendor specifc :-)

Thanks.

like image 809
Horst Gutmann Avatar asked Oct 29 '09 08:10

Horst Gutmann


1 Answers

Another suggestion is according to the dump pipes - smart endpoints school of thought.

You could handle uniqueness in your application, using some sort of shared state.

We had the same problem when switching from Gearman to RabbitMQ. We use memcached to keep track of unique message ID's posted and consumers drop messages for which the message ID is already stored in memcache (duplicates). You could also check memcache before putting it on the queue altogether.

This frees you from using this feature in your message bus layer (so you can more easily switch between brokers, also those who do not guarantee uniqueness)

like image 138
Joost Pastoor Avatar answered Sep 29 '22 06:09

Joost Pastoor