I'm facing an issue with my Spring Cloud Gateway setup where a GET endpoint, configured to traverse multiple services, is not waiting for responses from downstream services. Specifically, I have a Spring Cloud Gateway service, registered with Consul as a discovery client, that routes requests to a portfolio-service. This portfolio-service then makes use of a Feign Client to call an endpoint in the risk-profiler-service.
below predicate I'm using for routing.
routes:
- id: portfolioservice
uri: lb://portfolioservice
predicates:
- Path=${gateway-prefix}/v1/riskManagers/**
filters:
- RewritePath=${gateway-prefix}/(?<path>.*), ${gateway-prefix}/$\{path}
- name: CircuitBreaker
args:
name: portfolioServiceFallback
fallbackuri: forward:/fallback/portfolioServiceFallback
also, I added the below properties in the application.yml file
spring:
cloud:
openfeign:
client:
config:
default:
readTimeout: 600000
connectTimeout: 600000
How can I ensure that the Spring Cloud Gateway waits for responses from nested services, especially when using a Feign Client within a service?
Any insights, recommendations, or examples on how to properly configure such a setup would be greatly appreciated.
You can add response timeout in gateway like so