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