I have a service architecture composed of services that service common areas of the application. Examples of services would be:
- AccountService (manages client accounts in the system)
- BillingService (bills clients for products that are configured)
- UserService (manages user and groups under a given client)
- NotificationService (sends notifications via email/SMS/push/any method when certain events happen)
I have an ActiveMQ cluster where I push events to act on...which leads to the question...
Where is the right place to put a message listener that reacts to an event for the purposes of sending a notification? A simple example would be: "I want to notify the account owner via e-mail when a new user is added to their account."
Should this listener be in NotificationService (which is intended to be highly generic), or in UserService (where the action is being performed), or in a separate service entirely which acts as a sort of router?