question

Marcin-4719 avatar image
0 Votes"
Marcin-4719 asked ·

Service Bus Topics in many-to-many communication

Hello!

I need to design a communication platform for different services (part of the same application). They will need to exchange particular events in order to maintain consistency. Typically Service Bus Topics with multiple subscriptions are used for that purpose (one-to-many communication). However, it would make my life easier if all components used the same topic to publish events (many-to-many). Then subscriptions could filter out only those events that are important to them. So in the end this will decrease the amount of topics and subscriptions and would help me achieve a simpler design (instead of having one topic per publisher with multiple subscriptions; a single consumer might then have multiple subscriptions if it needs data from multiple publishers).

I have read all Service Bus constraints and limitations in the Microsoft documentation and was not able to find out if multiple components using a single topic is a good idea. Will I hit any limitations or encounter known problems? If two services (A and B) would publish events to that topic, will the order be maintained on the subscribing-side? As far as I understand, sessions are used per publisher, so perhaps this cannot be guaranteed.

I would appreciate if somebody could shed more light on this.

Best regards,
Marcin

azure-service-bus
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

seanfeldman avatar image
1 Vote"
seanfeldman answered ·

The assumption about the topology is correct. Building a topic per subscriber is almost an anti-pattern as it couples publishers and subscribers. Having a single topic solves that problem. In terms of performance, there should not be an issue. The broker team would be explicit about recommending against this type of topology if there'd be severe performance implications.

Regarding ordered messages, the Sessions feature is not for publishers. It's for publishers and consumers. It will have a certain drawback such as no scaled-out processing for sessioned messages processing, but that's an acceptable trade-off given you want messages to be ordered.

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Marcin-4719 avatar image
0 Votes"
Marcin-4719 answered ·

Thank you for a clear explanation. I was not suggesting to create a topic per subscriber, but per publishing service. Nevertheless, now it is more clear that a single topic could be the way to go. Thanks a lot!

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.