0

The setup: I have a set of Spring Boot based microservices that are fronted by Spring Cloud Gateway, meaning every request that comes from UI or external API client first comes to Spring Cloud Gateway and is then forwarded to appropriate microservice.

The routes are configured in Consul, and Spring Cloud Gateway communicates with Consul to get the routes accordingly.

Requirement: There is a need of some microservices communicating with each other with REST APIs. I would prefer this communication to happen via the Spring Cloud Gateway as well. This will help in reducing multiple services going to Consul for getting other service's details.

This means every service should know Gateway's detail at least. And there can be multiple instances of Gateways as well. How is this dealt with in bigger architectures?

Any example that I look up contains one service using Consul, or Gateway using the consul with one microservice. Couldn't understand how to extrapolate that design to a bigger system.

Mubin
  • 4,192
  • 3
  • 26
  • 45
  • All Services should be registered with consul which allows gateway to route the request. Using consul will allow them to communicate with each other without putting additional load on gateway. As Gateway is your client facing, where you won't want to put additional load. Additionally, Spring Consul makes it very easy to communicate with other services. – Nitishkumar Singh Feb 13 '19 at 10:00
  • @NitishkumarSingh The reason that I want the service-service calls go through gateway is that there will be some processing done and some headers added to the request in gateway and I want that to happen for every call, irrespective of where it comes from. – Mubin Feb 13 '19 at 10:19
  • so will those headers will be in the caller service, if yes then can't you add them in the request for called service too? – Nitishkumar Singh Feb 13 '19 at 10:41
  • " can't you add them in the request for called service too" - that is what I want to avoid. – Mubin Feb 13 '19 at 11:25
  • the usage doesn't change much (at all) with multiple microservices. To use multiple instances of the gateway you need to do one of a few things: use ribbon and a static list of gateways, use dns round robbin or use a platform load balancer (ELB or equivalent). – spencergibb Feb 13 '19 at 16:25

0 Answers0