This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch cloud2 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 607716cbc964f3c7bb9b5046d4a18dd9ee26b2f4 Author: Claus Ibsen <[email protected]> AuthorDate: Fri Apr 5 15:17:37 2019 +0200 CAMEL-13380: camel-core - Move cloud out into camel-cloud component. Woprk in progress --- core/camel-api/src/main/java/org/apache/camel/Route.java | 1 + .../org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java | 5 ++--- .../src/main/java/org/apache/camel/impl/DefaultRouteContext.java | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/camel-api/src/main/java/org/apache/camel/Route.java b/core/camel-api/src/main/java/org/apache/camel/Route.java index aeaba49..49087d9 100644 --- a/core/camel-api/src/main/java/org/apache/camel/Route.java +++ b/core/camel-api/src/main/java/org/apache/camel/Route.java @@ -33,6 +33,7 @@ import org.apache.camel.spi.RouteContext; public interface Route extends EndpointAware { String ID_PROPERTY = "id"; + String CUSTOM_ID_PROPERTY = "customId"; String PARENT_PROPERTY = "parent"; String GROUP_PROPERTY = "group"; String REST_PROPERTY = "rest"; diff --git a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java index ffea02d..ad48e39 100644 --- a/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java +++ b/core/camel-cloud/src/main/java/org/apache/camel/impl/cloud/ServiceRegistrationRoutePolicy.java @@ -28,7 +28,6 @@ import org.apache.camel.api.management.ManagedResource; import org.apache.camel.cloud.DiscoverableService; import org.apache.camel.cloud.ServiceDefinition; import org.apache.camel.cloud.ServiceRegistry; -import org.apache.camel.model.RouteDefinition; import org.apache.camel.support.RoutePolicySupport; import org.apache.camel.util.ObjectHelper; import org.slf4j.Logger; @@ -167,8 +166,8 @@ public class ServiceRegistrationRoutePolicy extends RoutePolicySupport implement String serviceId = properties.get(ServiceDefinition.SERVICE_META_ID); if (serviceId == null) { // if not check if the route id is custom and use it - RouteDefinition definition = (RouteDefinition) route.getRouteContext().getRoute(); - if (definition.hasCustomIdAssigned()) { + boolean custom = "true".equals(route.getProperties().get(Route.CUSTOM_ID_PROPERTY)); + if (custom) { serviceId = route.getId(); } diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java index 7f5830a..20f8539 100644 --- a/core/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java +++ b/core/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java @@ -229,6 +229,7 @@ public class DefaultRouteContext implements RouteContext { // and create the route that wraps the UoW Route edcr = new EventDrivenConsumerRoute(this, getEndpoint(), internal); edcr.getProperties().put(Route.ID_PROPERTY, routeId); + edcr.getProperties().put(Route.CUSTOM_ID_PROPERTY, route.hasCustomIdAssigned() ? "true" : "false"); edcr.getProperties().put(Route.PARENT_PROPERTY, Integer.toHexString(route.hashCode())); edcr.getProperties().put(Route.DESCRIPTION_PROPERTY, route.getDescriptionText()); if (route.getGroup() != null) {
