Search code examples
c#asp.net-coremicroservicespublish-subscribeazure-servicebus-topics

Can a Single Microservice be a Subscriber for 2 or More Services in Azure Service Bus


I have a Microservice as Notification which is a (Subscriber) Service. And I have 2 other Publisher services as

  1. File Upload and 2) Login Service.

So, I want to send Notifications from Notification Service when :

  1. When a File has been upload from File Upload Service (Publisher).
  2. When New User logs in to the the Application using Login Service (Publisher).

I'm using Azure Service bus for Service to Service Communication in ASP NET Core WEB API. So, Shall I use 2 Topics and 2 Subscriptions or 1 Topic and 2 Subscriptions.

In Azure Service Bus


Solution

  • How you design your topology depends on how you see it growing in the future. With this number of entities, two topics could be unnecessary and a single topic with 2 subscriptions would suffice. This still works well when the number of events grows in the system. And the beneficial part is that the only point of coupling becomes a single topic name rather than a topic name per event type.