Merge pull request #788 from fangjian0423/master

[Sentinel] Upgrade Sentinel 1.6.3
pull/798/head
format 6 years ago committed by GitHub
commit 7a9b8a73e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -18,7 +18,7 @@
<description>Spring Cloud Alibaba Dependencies</description>
<properties>
<sentinel.version>1.6.2</sentinel.version>
<sentinel.version>1.6.3</sentinel.version>
<oss.version>3.1.0</oss.version>
<seata.version>0.7.1</seata.version>
<nacos.client.version>1.1.1</nacos.client.version>

@ -37,5 +37,7 @@ spring:
mode: response
response-status: 444
response-body: 1234
scg:
order: -100
management.endpoints.web.exposure.include: "*"

@ -22,6 +22,7 @@ package com.alibaba.cloud.sentinel.gateway;
public interface ConfigConstants {
String APP_TYPE_ZUUL_GATEWAY = "12";
String APP_TYPE_SCG_GATEWAY = "11";
String ZUUl_PREFIX = "spring.cloud.sentinel.zuul";

@ -18,6 +18,7 @@ package com.alibaba.cloud.sentinel.gateway.scg;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import org.springframework.core.Ordered;
import com.alibaba.cloud.sentinel.gateway.ConfigConstants;
import com.alibaba.cloud.sentinel.gateway.FallbackProperties;
@ -31,6 +32,8 @@ public class SentinelGatewayProperties {
@NestedConfigurationProperty
private FallbackProperties fallback;
private Integer order = Ordered.HIGHEST_PRECEDENCE;
public FallbackProperties getFallback() {
return fallback;
}
@ -40,4 +43,11 @@ public class SentinelGatewayProperties {
return this;
}
public Integer getOrder() {
return order;
}
public void setOrder(Integer order) {
this.order = order;
}
}

@ -45,7 +45,6 @@ import org.springframework.web.server.ServerWebExchange;
import com.alibaba.cloud.sentinel.gateway.ConfigConstants;
import com.alibaba.cloud.sentinel.gateway.FallbackProperties;
import com.alibaba.csp.sentinel.adapter.gateway.common.SentinelGatewayConstants;
import com.alibaba.csp.sentinel.adapter.gateway.sc.SentinelGatewayFilter;
import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.BlockRequestHandler;
import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.GatewayCallbackManager;
@ -94,7 +93,7 @@ public class SentinelSCGAutoConfiguration {
private void initAppType() {
System.setProperty(SentinelConfig.APP_TYPE,
String.valueOf(SentinelGatewayConstants.APP_TYPE_GATEWAY));
String.valueOf(ConfigConstants.APP_TYPE_SCG_GATEWAY));
}
private void initFallback() {
@ -149,8 +148,10 @@ public class SentinelSCGAutoConfiguration {
@Order(-1)
@ConditionalOnMissingBean
public SentinelGatewayFilter sentinelGatewayFilter() {
logger.info("[Sentinel SpringCloudGateway] register SentinelGatewayFilter");
return new SentinelGatewayFilter();
logger.info(
"[Sentinel SpringCloudGateway] register SentinelGatewayFilter with order: {}",
gatewayProperties.getOrder());
return new SentinelGatewayFilter(gatewayProperties.getOrder());
}
}

Loading…
Cancel
Save