I have micro service architecture application. One of the services contains all user related information. Another service contains a set of business objects. The Angular UI calls rest APIs of user-service and business-service to perform operations like user management, business management. The tables in the business-service contain user ID from user-service for example owner of a business object. Since they are different databases, there is no referential constraint.
I want to display a list of business objects in UI. I want to be able to filter the results by the owner's first name. Note that the business-service does not know user's details except user ID.
What is the best way to query data belonging to multiple services ?
Some options in mind
- store redundant data in business service - but this could go out of sync. May have to run a cron job to keep it in sync with user-service. But the solution is ugly.
- First, get list of user ID's matching the user's first name. Pass those IDs to the business service to get the list of business objects there by achieving filtering.
Both solutions don't seem to be clean...