You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Question about the order of SentinelGatewayFilter in Spring Cloud Gatewayย #764
// LoadBalancerClientFilter#filterif (instance == null) {
throwNotFoundException.create(properties.isUse404(),
"Unable to find instance for " + url.getHost());
}
The order of LoadBalancerClientFilter is higher than SentinelGatewayFilter. So it won't invoke SentinelGatewayFilter after LoadBalancerClientFilter throw NotFoundException if there is no healthy instance.
Is it necessary to set the higher order for SentinelGatewayFilter?
There is another case:
Spring Cloud Gateway will using NoLoadBalancerClientFilter to replace of LoadBalancerClientFilter if there is no xx-discovery-starter in pom.
Yes, the order of the filters should be well arranged. In the demo we set the order of SentinelGatewayFilter to -1. Maybe we can put it ahead (the highest precedence?).
@sczyh30
I copy the SentinelGatewayFilter and Ordered before my filters,bu even though the sentinel limit the flow ,my filters would excute ,then it throws exception of Blocked by Sentinel?
How could i modify the SentinelGatewayFilter.java ?
Activity
sczyh30 commentedon May 16, 2019
Yes, the order of the filters should be well arranged. In the demo we set the order of
SentinelGatewayFilterto -1. Maybe we can put it ahead (the highest precedence?).fangjian0423 commentedon May 16, 2019
@sczyh30
It seems we should implement
org.springframework.core.Orderedinterface, not theorg.springframework.core.annotation.Orderannotation.cui1100 commentedon Jun 13, 2019
@sczyh30
I copy the SentinelGatewayFilter and Ordered before my filters,bu even though the sentinel limit the flow ,my filters would excute ,then it throws exception of Blocked by Sentinel?
How could i modify the SentinelGatewayFilter.java ?
evilester commentedon Jun 26, 2019
spring-cloud-gateway-starter-ahas-sentinel:1.0.1
SentinelGatewayAutoConfiguration.java
@bean
@order(-1)
public GlobalFilter sentinelGatewayFilter() {
return new SentinelGatewayFilter();
}
Odrer is invalid here
FilteringWebHandler.java
public Mono handle(ServerWebExchange exchange) {
Route route = exchange.getRequiredAttribute(GATEWAY_ROUTE_ATTR);
List gatewayFilters = route.getFilters();
Maybe SentinelGatewayFilter need the delegation of OrderedGatewayFilter and SentinelGatewayFilter should implement org.springframework.core.Ordered