8 Service routing with Spring Cloud Gateway
This chapter covers
- Using a service gateway with your microservices
- Implementing a service gateway using Spring Cloud API Gateway
- Mapping microservice routes in the gateway
- Building filters to use correlation ID and tracking
In a distributed architecture like a microservices one, there will come the point where we’ll need to ensure that critical behaviors such as security, logging, and tracking of users across multiple service calls occur. To implement this functionality, we’ll want these attributes to be consistently enforced across all of our services without the need for each individual development team to build their own solutions. While it’s possible to use a common library or framework to assist with building these capabilities directly in an individual service, doing so has three implications.
First, it’s challenging to implement these capabilities in each service consistently. Developers are focused on delivering functionality, and in the whirlwind of day-to-day activity, they can easily forget to implement service logging or tracking unless they work in a regulated industry where it’s required.