API Gateway Pattern vs Aggregator Pattern (In the context of microservices)

Viewed 3282

I am trying to wrap my head around the differences between an API gateway and the aggregator pattern for microservices.

At the moment From my understanding the aggregator pattern functions by collecting pieces of data from various microservices and returns an aggregate for processing.

Now the API gateway is the single entry point that aggregates the calls to the individual microservices. While this may sound very similar to the Aggregator Pattern, there are some distinct features. Most importantly, this new service does not store data but instead becomes responsible for API composition, request routing, and new features such as authentication

I would really like to understand if my reasoning is correct here.

Thank you in advance!

1 Answers

Yes, your understanding is correct. I would add a few ideas:

  • The API Gateway usually is entry-point of the system, while an aggregator microservice can be somewhere in the middle-layer.
  • The API Gateway may store partial responses from other microservices, while it waits for other ones to respond (similarly to an aggregator)
  • There is also a pattern which mixes them, known as a gateway aggregation pattern
Related