Terry C
Terry C

Reputation: 99

RabbitMQ Pub/Sub setup with large number of disconnected clients...

This is a new area for me so hopefully my question makes sense.

In my program I have a large number of clients which are windows services running on laptops - that are often disconnected. Occasionally they come on line and I want them to receive updates based on user profiles. There are many types of notifications that require the client to perform some work on the local application (i.e. the laptop).

I realize that I could do this with a series of restful database queries, but since there are so many clients (upwards to 10,000) and there are lots of different notification types, I was curious if perhaps this was not a problem better suited for a messaging product like RabbitMQ or even 0MQ.

But how would one set this up. (let's assume in RabbitMQ?

Would each user be assigned their own queue? Or is it preferable to have each queue be a distinct notification type and you would use some combination of direct exchanges or filtering messages based on a routing key, where the routing key could be a username.

Since each user may potentially have a different set of notifications based on their user profile, I am thinking that each client/consumer would have a specific message for each notification sitting on a queue waiting for them to come online and process it.

Is this the right way of thinking about the problem? Thanks in advance.

Upvotes: 0

Views: 127

Answers (1)

Daniil Fedotov
Daniil Fedotov

Reputation: 381

It will be easier for you to balance a lot of queues than filter long ones, so it's better to use queue per consumer. Messages can have arbitrary headers and body so it is the right place for notification types. Since you will be using long-living queues, waiting for consumers on disk - you better use lazy queues https://www.rabbitmq.com/lazy-queues.html (it's available since version 3.6.0)

Upvotes: 1

Related Questions