We have started using a "micro service" architecture and we have multiple services. Each service owns the data and the business logic for a domain and only entity ids are shared across services.
Everything was perfect until 1 requirement came in...
On the UI, when a user is about to delete an entity, a warning listing where this entity is used must be displayed.
An fictitious example, let's say you have a billing service
and a user service
.
If a manager is about to delete a user, the UI has to display the list of active subscriptions for this user.
The user service
doesn't know where the user id is referenced and it's probably in multiple services.
How can we achieve this?
Obviously the user service
or the UI can't ask each service to return all entities related to this user id. That means every service would have to provide an endpoint for each entity and it would be very clumsy.
That means every service would have to provide an endpoint for each entity
-- No, that's not true. Each service would need the ability to respond to a question, like "do you have any subscriptions for this user id?" – Robert Harvey Jul 02 '19 at 14:33