Only set id if not already set.

This commit is contained in:
Spencer Gibb
2019-12-11 15:59:49 -05:00
parent 6936c83b18
commit 8bb7f786ee

View File

@@ -53,10 +53,12 @@ public class CompositeRouteDefinitionLocator implements RouteDefinitionLocator {
.flatMap(routeDefinition -> Mono.justOrEmpty(routeDefinition.getId())
.defaultIfEmpty(idGenerator.generateId().toString())
.publishOn(Schedulers.elastic()).map(id -> {
routeDefinition.setId(id);
if (log.isDebugEnabled()) {
log.debug(
"Id set on route definition: " + routeDefinition);
if (routeDefinition.getId() == null) {
routeDefinition.setId(id);
if (log.isDebugEnabled()) {
log.debug(
"Id set on route definition: " + routeDefinition);
}
}
return routeDefinition;
}));