In a microservices environment, how do we effectively sort data which is part of two different microservices.
For example, lets say we have two microservices
- Users Service (Has all information related to users)
- Orders Service (Has all information related to orders placed by the user with user id as reference)
Now on Admin UI lets say we have a page where we are displaying orders placed between specific period of time and I need a sorting feature on user display name.
My question is how to achieve this effectively, below are two possible options which can be applied
- Fetch all data from both services and then do an in-memory merge (not efficient)
- Duplicate the data on the other service like adding User Display Name on Orders Service (then we have redundant data and we need to take care of consistency).
Is there any other way to achieve this, would like to know how a situation like this is solved in real world applications
Note: The scenario provided over here is more like hypothetical just want to understand how to solve when things are like this
