I'm looking into using Azure Service Bus for publishing/delivering messages between different services in our application, and are trying to find a decent design for the topic and subscriptions within a Service Bus namespace.
The intent of the system is for service-a
to publish a message with type service-a.test-event
to a bus, and have any service listening on that event type get the message delivered. It will be a fairly low volume
I'm a bit torn on which of the following designs to use:
- The Service Bus namespace has one topic
events
where all messages from all services are delivered. Any service subscribing to events from any other service create a subscription in this topic using filters to get the message types they want - one subscription per message type (eg.service-b-service-a-test-event
). - The Service Bus namespace has one topic per publisher (eg.
events-service-a
). Any subscribing service to events from this service create a subscription in the topic using filters to get the message types they want - one subscription per message type (eg.service-b-test-event
).
Service Bus seems to have a limit of 2000 subscriptions per topic, which as far as I can tell will be sufficient for us. If I had suspicions otherwise, option #2 would probably be the best choice (as I can have 10.000 topics per namespace). None of the other limitations of Service Bus, as far as I can tell, really impacts which of these options I should go for.
One additional requirement is that I want to have a service subscribing to any event from any service for recording reasons. If I went for option #1, that'd be very simple to implement. For option #2 however, that service needs to somehow make sure it has a subscription within any event topic in the namespace - and reconfigure itself once new topics are added and old topics are removed. That's outside the scope of this question, but a requirement for the design none the less.