diff --git a/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/context/ContextData.java b/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/context/ContextData.java index bf6b01c8ac..8070afe4a5 100644 --- a/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/context/ContextData.java +++ b/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/context/ContextData.java @@ -21,9 +21,11 @@ package com.raytheon.uf.edex.esb.camel.context; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -52,6 +54,18 @@ import com.raytheon.uf.edex.core.EdexException; * @version 1.0 */ public class ContextData { + /** + * Set of endpoint types that allow multiple consumers. + */ + private static final Set MULTIPLE_CONSUMER_TYPES; + + static { + Set multipleConsumerTypes = new HashSet(1, 1); + multipleConsumerTypes.add("topic"); + MULTIPLE_CONSUMER_TYPES = Collections + .unmodifiableSet(multipleConsumerTypes); + } + private final List contexts; private final Map consumerRouteMapping; @@ -63,7 +77,7 @@ public class ContextData { * the endpoint URI. */ private static final Pattern endpointUriParsePattern = Pattern - .compile("([^:]+)://([^?]+)"); + .compile("(?:[^:]+:)*([^:]+):(?://)?([^?]+)\\??.*$"); /** * Parses passed contexts for route and endpoint data about all contexts. @@ -78,9 +92,11 @@ public class ContextData { .unmodifiableMap(generateRouteMappings(this.contexts)); Map idUriMapping = new HashMap( consumerRouteMapping.size(), 1); - for (Route route : consumerRouteMapping.values()) { - idUriMapping.put(route.getId(), route.getEndpoint() - .getEndpointUri()); + for (CamelContext ctx : this.contexts) { + for (Route route : ctx.getRoutes()) { + idUriMapping.put(route.getId(), route.getEndpoint() + .getEndpointUri()); + } } this.routeIdUriMapping = Collections.unmodifiableMap(idUriMapping); @@ -109,7 +125,9 @@ public class ContextData { String endpointName = typeAndName.getSecond(); Route prev = routeMapping.put(endpointName, route); - if (prev != null) { + if ((prev != null) + && !MULTIPLE_CONSUMER_TYPES + .contains(typeAndName.getFirst())) { throw new ConfigurationException( "Two contexts listen to the same endpoint name [" + endpointName diff --git a/rpms/awips2.edex/Installer.edex/scripts/init.d/edex_camel b/rpms/awips2.edex/Installer.edex/scripts/init.d/edex_camel index e9b374ea67..a55038350e 100644 --- a/rpms/awips2.edex/Installer.edex/scripts/init.d/edex_camel +++ b/rpms/awips2.edex/Installer.edex/scripts/init.d/edex_camel @@ -218,6 +218,10 @@ case $func in stopEDEX $service & done wait + + # small sleep for wrapper lock to disappear so that we don't make .1 version of log files + sleep 5 + for service in ${SERVICES[*]}; do echo "Starting EDEX Camel ($service): "