I'm building an infrastructural service with my team. We are building a service that will help other teams in our org send out a notifications to end users when certain events occur. We are currently having an issue agreeing on which service should be listening to occurrences of these events to then trigger a corresponding notification. Maybe I can give an example using Instagram (IG) for relevancy.
Imagine the scenario where one person A follows person B in IG. The requirement here would be to notify person B of this event via a notification. Most likely, there is some sort of "Follower" service that exists as a source of truth for this information. So my question here is, whom should listen in to the "person A followed person" event?
Option 1. One perspective is let the Follower service listen in on its own event and then trigger a side effect by calling the notification service to tell it to explicitly notify person B. The Follower service is aware of the domain event and its the domain that should dictate whom should be notified.
Option 2. Another perspective is to allow the notification service to listen on these events and to send out the notification itself. It would be responsible for interpreting the event and understand whom should be the person that should be reached.
Which of the two perspectives do you think makes sense for scalability?