6
votes

What is the simplest approach to achieve strongly typed message based routing with Azure Service Bus.

Assuming we only have one consumer and are using Service Bus Queues, is it easier to create a queue per message type (in our case, Event messages), or simply create a single queue for all messages and handle the routing on the consumer?

If we have more than one consumer and want to do pub-sub messaging, should we create a topic per message type and a subscription per consumer per message type, or just one topic for all messages and then handle the routing on the consumer?

1
I don't think that this is an easy question to answer. it is too open and too opinion based. there will be many relevant considerations around the capabilities of the clients, the volumes of messages, resiliency required, etc.Yossi Dahan
Fair enough, I've updated my question to ask for the "simplest" approach.Ben Foster
I have to agree with Yossi. It depends mostly on the architectural approach you want to take. But using a topic with subscriptions per message type makes a lot of sense. This way, it's easy for the publisher (client, mostly?) to push all of its messages to the same endpoints, where you can easily extend and add extra message types and filtersSam Vanhoutte

1 Answers

4
votes

For the Pub-sub messaging case: the right way is to create a Topic per messageType (use BrokeredMessage.ContentType property for this) and then create a Subscription per messageType.

How many Topics, or Queues to Create should really be driven by the Scale you are looking at.

Sree