We use Spring Cloud Gateway (Spring Boot 2.0) to route(POST) request to different external customer REST endpoint (along with filters).
Most of the time routing is ok in production, only certain times we are facing an exception (PrematureCloseException) in POST in case where there is a long gap (say 30 min plus) between messages (for a customer/route that uses spring OAuth2 filter for token before submission).
Tried multiple attempts to replicate scenario locally/lower env, still no success.
To look for possible config change/fix (maxIdleTime etc), trying to understand how Http connection management works in Spring Cloud Gateway, which in turn uses Reactor Netty Client? As per documentation (https://projectreactor.io/docs/netty/1.1.19/reference/index.html) Netty Client uses connection pool (with defaults config until overridden), so when different request/messages are being posted to Spring Cloud Gateway for routing, are separate http connection opened and managed in pool for each “routes”, to be used again for next message to be routed to same configured “route” and so on?
For Example If we have 3 routes defined in Spring Cloud Gateway for 3 customers
- Route 1 – Customer 1 – endpoint 1 (abc.com/submit)
- Route 2 – Customer 2 – endpoint 2 (xyz.com/submit)
- Route 3 – Customer 3 – endpoint 3 (123.com/submit)
In this case, will Netty Client maintain 3 unique sets of “connection” in pool for each customer/route to serve incoming next set of messages ?
Any help/explanation will help in resolving the issue. Thanks