The aggregator design pattern is a service that receives a request and then makes requests of multiple services. Upon receiving the response, the service will then combine the results and responds to the initiating request.
In the Microservices world we constantly have to call various downstream systems in order to achieve desired functionality. Sometimes you will come across a requirement where you need to provide information to the upstream service, or pass a JSON response to the UI. Since you don’t have the information in your service domain, you will have to call various other downstream systems and cherry pick the required information from the responses, and the pass the JSON they are expecting.
Lets say you want to send a JSON response which has 20 fields. But your service only has 5 fields and in order to get the other 15 fields you have to invoke 3 different services. To address this problem, we need to implement the Aggregator pattern.
Leave a Reply