spring-cloud-gateway

Spring cloud gateway gives connection closed prematurely

放肆的年华 提交于 2021-01-27 05:43:31
问题 I am using spring cloud gateway as API gateway in my micro service setup with consul as service discovery. In some case when API of some microservice take more then 2 minutes, gateway throws below error: java.io.IOException: Connection closed prematurely at reactor.ipc.netty.http.client.HttpClientOperations.onInboundClose(HttpClientOperations.java:269) at reactor.ipc.netty.channel.ChannelOperationsHandler.channelInactive(ChannelOperationsHandler.java:113) at io.netty.channel

Spring cloud gateway gives connection closed prematurely

僤鯓⒐⒋嵵緔 提交于 2021-01-27 05:42:15
问题 I am using spring cloud gateway as API gateway in my micro service setup with consul as service discovery. In some case when API of some microservice take more then 2 minutes, gateway throws below error: java.io.IOException: Connection closed prematurely at reactor.ipc.netty.http.client.HttpClientOperations.onInboundClose(HttpClientOperations.java:269) at reactor.ipc.netty.channel.ChannelOperationsHandler.channelInactive(ChannelOperationsHandler.java:113) at io.netty.channel

Spring Cloud Gateway Routing Based On Content of the Request Body

China☆狼群 提交于 2021-01-24 08:13:27
问题 I need to create a reverse proxy that takes incoming request and based on the content of the request body, route the request to specific URI. This is for a routing micro service that acts like a reverse proxy and does routing based on some information from each request body. This means for each request I need to parse the request body and get the "username" field and then make a JDBC connection to fetch additional information from the database. Based on that information in database, it would

Spring Cloud Gateway Routing Based On Content of the Request Body

我的梦境 提交于 2021-01-24 08:12:39
问题 I need to create a reverse proxy that takes incoming request and based on the content of the request body, route the request to specific URI. This is for a routing micro service that acts like a reverse proxy and does routing based on some information from each request body. This means for each request I need to parse the request body and get the "username" field and then make a JDBC connection to fetch additional information from the database. Based on that information in database, it would

Spring cloud gateway with Spring cache and caffeine

試著忘記壹切 提交于 2021-01-07 01:23:09
问题 I have a spring cloud gateway which forwards the API rest requests to some microservices. I would like to cache the response for specific requests. For this reason I wrote this Filter @Component @Slf4j public class CacheResponseGatewayFilterFactory extends AbstractGatewayFilterFactory<CacheResponseGatewayFilterFactory.Config> { private final CacheManager cacheManager; public CacheResponseGatewayFilterFactory(CacheManager cacheManager) { super(CacheResponseGatewayFilterFactory.Config.class);

Spring cloud gateway with Spring cache and caffeine

橙三吉。 提交于 2021-01-07 01:23:00
问题 I have a spring cloud gateway which forwards the API rest requests to some microservices. I would like to cache the response for specific requests. For this reason I wrote this Filter @Component @Slf4j public class CacheResponseGatewayFilterFactory extends AbstractGatewayFilterFactory<CacheResponseGatewayFilterFactory.Config> { private final CacheManager cacheManager; public CacheResponseGatewayFilterFactory(CacheManager cacheManager) { super(CacheResponseGatewayFilterFactory.Config.class);

Spring cloud gateway with Spring cache and caffeine

北城余情 提交于 2021-01-07 01:22:35
问题 I have a spring cloud gateway which forwards the API rest requests to some microservices. I would like to cache the response for specific requests. For this reason I wrote this Filter @Component @Slf4j public class CacheResponseGatewayFilterFactory extends AbstractGatewayFilterFactory<CacheResponseGatewayFilterFactory.Config> { private final CacheManager cacheManager; public CacheResponseGatewayFilterFactory(CacheManager cacheManager) { super(CacheResponseGatewayFilterFactory.Config.class);

How to get response body in Spring Gateway

假如想象 提交于 2020-12-15 03:47:43
问题 I'm working with spring cloud gateway filters and need to get response body to log it. I understand that it's problematic, as spring gateway is built on spring reactor, but nevertheless I'm looking for any way to do this. Have global filter, code: import org.reactivestreams.Publisher; import org.reactivestreams.Subscriber; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.gateway.filter.GatewayFilter; import org.springframework.cloud.gateway

How to get response body in Spring Gateway

▼魔方 西西 提交于 2020-12-15 03:45:19
问题 I'm working with spring cloud gateway filters and need to get response body to log it. I understand that it's problematic, as spring gateway is built on spring reactor, but nevertheless I'm looking for any way to do this. Have global filter, code: import org.reactivestreams.Publisher; import org.reactivestreams.Subscriber; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.gateway.filter.GatewayFilter; import org.springframework.cloud.gateway

Spring Cloud Gate Request Timeout Not working for path

百般思念 提交于 2020-11-29 19:10:37
问题 In Spring cloud Gateway request timeout for path in not working as expected. I tried to specify global timeout, but its not working as expected. I am trying to call a microservice A. In A microservice I have added an delay to 5 sec. Now in path if I add response timeout as more than 5s, it should wait for the response, but currently circuit breaker is opened and currently its returning the fallback message in 1000ms I have configured resilience4j circuit breaker in gateway. I am not able to