|
|
@ -27,14 +27,10 @@ import static java.util.Collections.synchronizedMap; |
|
|
|
* @author tanghc |
|
|
|
* @author tanghc |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@Slf4j |
|
|
|
public class GatewayRouteRepository implements ApplicationEventPublisherAware, |
|
|
|
public class GatewayRouteRepository implements RouteDefinitionRepository, RouteRepository<GatewayTargetRoute> { |
|
|
|
RouteDefinitionRepository, |
|
|
|
|
|
|
|
RouteRepository<GatewayTargetRoute> { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final Map<String, GatewayTargetRoute> routes = synchronizedMap(new LinkedHashMap<>()); |
|
|
|
private final Map<String, GatewayTargetRoute> routes = synchronizedMap(new LinkedHashMap<>()); |
|
|
|
|
|
|
|
|
|
|
|
private ApplicationEventPublisher publisher; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Flux<org.springframework.cloud.gateway.route.RouteDefinition> getRouteDefinitions() { |
|
|
|
public Flux<org.springframework.cloud.gateway.route.RouteDefinition> getRouteDefinitions() { |
|
|
|
List<org.springframework.cloud.gateway.route.RouteDefinition> list = routes.values().parallelStream() |
|
|
|
List<org.springframework.cloud.gateway.route.RouteDefinition> list = routes.values().parallelStream() |
|
|
@ -91,7 +87,6 @@ public class GatewayRouteRepository implements ApplicationEventPublisherAware, |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void delete(String id) { |
|
|
|
public void delete(String id) { |
|
|
|
routes.remove(id); |
|
|
|
routes.remove(id); |
|
|
|
this.publisher.publishEvent(new PredicateArgsEvent(this, id, Collections.emptyMap())); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -106,9 +101,4 @@ public class GatewayRouteRepository implements ApplicationEventPublisherAware, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) { |
|
|
|
|
|
|
|
this.publisher = applicationEventPublisher; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |