0

I have an online service hosted on Azure, that asynchronously sends data to on-premise clients. Each client is identified by an unique code.

Actually there is a single topic, with a subscription for each client which has a filter on the unique code, that is sent as a parameter in the message. No message will ever be broadcasted to all the clients.

I feel that using topic this way is wrong. The alternative that comes to my mind is to use a dedicated queue for each client, that is created on first contact

Could this be a better approach?

Thanks

Kiske1
  • 408
  • 3
  • 15

2 Answers2

1

In my opinion using Topics and Subscriptions is the right way to go. Here's the reason why:

Currently the routing logic (which message needs to go to which subscription) is handled by Azure Service Bus based on the rules you have configured. If you go with queues, the routing logic will need to come to your hosted service. You'll need to ensure that the queue exists before sending each message. I think it will increase the complexity at your service level somehow.

Furthermore, topics and subscriptions would enable you to do build an audit trail kind of functionality (not sure if you're looking for this kind of functionality). You can create a separate subscription that has a rule to deliver all messages (True SQL Rule) to that subscription along with client specific subscription.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • Having only one topic with many filtered subscriptions (like it is as of now), doesen't mean that all the messages are delivered to all the clients, and then at client level filtered out? This seems like a lot of unnecessary traffic and a potential security issue, as a client should not see other's messages. Or are you telling that the messages are physically sent sent only to the subscriptions who matches the rule? If that's the case, I agree that topic/subscription is the way to go. – Kiske1 Feb 20 '19 at 13:26
  • 1
    That is correct. A message will be delivered to a subscription if the rule matches. – Gaurav Mantri Feb 20 '19 at 14:02
0

Creating a separate Queue for each client is not advisable. This is the problem solved by Topics.

If you have separate Queue for each client, then you need to send messages to multiple Queues from Server. This will become tedious when the number of clients increases.

Having a single Topic and multiple Subscriptions is easy to manage as the message will be sent only to a single Topic from Server.

Arunprabhu
  • 1,454
  • 9
  • 15