Reputation: 613
I have a bunch of nodes producing data, and I want to send all this data to be held by a central server. I am planning on using RabbitMQ to do this. All of the messages will be of a similar type, but it will matter to me which client it came from for how I store it.
My question is, what is the suggested pattern to do this? Should I have a single queue or multiple queues for each client? And if all the messages are coming out of a single queue, how can I keep track of where they come from?
Upvotes: 0
Views: 352
Reputation: 7624
RabbitMQ works with exchange as well as queues. The producers can all send to the same exchange and they will be queued and the read by the client. The question is what are you trying to achieve?
There are options here:
There are positives and negatives with each. If you know how many clients (and their names) you will have and this is unlikely to change then (2) might be better. If you want something dynamic then you will need to use (1) as it is much easier rather than writing a new consumer each time you have a new client. If you want the parallelism of (2) but the simplicity of (1) then use a work queue set up for the consumer (server) side. http://www.rabbitmq.com/tutorials/tutorial-two-python.html Here you will have multiple consumers reading from the same queue to divide up the work.
Upvotes: 1