mardi 14 novembre 2023

Business validation rules and microservices

We have a microservice architecture, with one of those services being a user service, and another being a calendar service. The problem I am being faced with is this. We have users, and users have products and features. Products are simply bags of features and all of this information is stored in the user service. When selecting a user to display as a potential candidate to place on the calendar, we need to determine if the person being selected has a specific feature turned on. For this, the UI queries the user service and asks for this information and all is well. The trouble in my head comes when we then submit a post request to the calendar service to add the individual to the calendar. How should the calendar service verify that the person who was selected has the specified feature enabled? Should it call directly to the user service and ask, which would introduce coupling but centralize the logic in the service that owns the data? Or should I leverage our service bus and use event carried state transfer to make the user, product, and feature information available to the calendar service? We have several services like this, and it seems like that would be very inefficient for every service to need a copy of the user table and all of their associated products and features, but that seems to be the path of least coupling. Any thoughts or ideas?

Aucun commentaire:

Enregistrer un commentaire