全面使用nacos,舍弃zookeeper

pull/1/head
tanghc 5 years ago
parent d2fab766c4
commit 90d6823693
  1. 2
      sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/gateway/route/GatewayRouteRepository.java
  2. 12
      sop-example/sop-story/sop-story-web/src/main/resources/application-dev.properties

@ -4,6 +4,7 @@ import com.gitee.sop.gatewaycommon.bean.GatewayRouteDefinition;
import com.gitee.sop.gatewaycommon.bean.TargetRoute; import com.gitee.sop.gatewaycommon.bean.TargetRoute;
import com.gitee.sop.gatewaycommon.manager.RouteRepository; import com.gitee.sop.gatewaycommon.manager.RouteRepository;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.cloud.gateway.event.PredicateArgsEvent; import org.springframework.cloud.gateway.event.PredicateArgsEvent;
import org.springframework.cloud.gateway.event.RefreshRoutesEvent; import org.springframework.cloud.gateway.event.RefreshRoutesEvent;
import org.springframework.cloud.gateway.route.RouteDefinition; import org.springframework.cloud.gateway.route.RouteDefinition;
@ -100,6 +101,7 @@ public class GatewayRouteRepository implements ApplicationEventPublisherAware,
@Override @Override
public void deleteAll(String serviceId) { public void deleteAll(String serviceId) {
List<String> idList = this.routes.values().stream() List<String> idList = this.routes.values().stream()
.filter(zuulTargetRoute -> StringUtils.equalsIgnoreCase(serviceId, zuulTargetRoute.getServiceRouteInfo().getServiceId()))
.map(zuulTargetRoute -> zuulTargetRoute.getRouteDefinition().getId()) .map(zuulTargetRoute -> zuulTargetRoute.getRouteDefinition().getId())
.collect(Collectors.toList()); .collect(Collectors.toList());

@ -15,9 +15,9 @@ dubbo.registry.address=N/A
dubbo.scan.base-packages=com.gitee.sop.storyweb.service dubbo.scan.base-packages=com.gitee.sop.storyweb.service
# zipkin服务跟踪 # zipkin服务跟踪
spring.zipkin.base-url=http://127.0.0.1:9411/ #spring.zipkin.base-url=http://127.0.0.1:9411/
# 设置sleuth收集信息的比率,默认0.1,最大是1,数字越大越耗性能 ## 设置sleuth收集信息的比率,默认0.1,最大是1,数字越大越耗性能
spring.sleuth.sampler.probability=1 #spring.sleuth.sampler.probability=1
# dubbo使用zipkin过滤器 ## dubbo使用zipkin过滤器
dubbo.provider.filter=tracing #dubbo.provider.filter=tracing
dubbo.consumer.filter=tracing #dubbo.consumer.filter=tracing

Loading…
Cancel
Save