API Gateway pattern components

The API Gateway pattern is based on calling API services using a proxy. The API Gateway proxy service has mainly four types of filters. These filters intercept the HTTP requests coming from the client applications. You can also add your own custom filters for a specific URL pattern. Let's see the following diagram that displays API Gateway's components:

API Gateway has mainly four filters as follows:

  • Pre filter: These filters will be invoked before the HTTP request is routed
  • Post filter: These filters will be invoked after the HTTP request has been routed
  • Route filter: These filters will be used to route the HTTP request
  • Error filter: These filters will be invoked when an error occurs while handling the HTTP request

As per the preceding diagram, the Client Applications send the HTTP request to the API Gateway service, the pre filter intercepts the HTTP request coming from the client applications and forwards it to the route filter to route these requests to the internal individual microservices, such as Account Microservice and Customer Microservice. The microservices send a response to the post filter, and finally, the post filter forwards the HTTP Response to the Client Applications.

We have discussed the API Gateway pattern in the microservices architecture. Let's implement this pattern using Spring Cloud's Netflix Zuul API in your microservice application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset