Hi,

I have a question about configuring routes at runtime, that I hope someone
can answer for me.

My code for updating routes is below. I remove the old one & add a new one.
However, the 4th time I call it, it fails.  It doesn't actually throw an
error, but I cannot retrieve the route via context.getRoutes() and there is
no routing.  Is there any internal limit in the choice or some other
structure, or am I hitting something else?

Thanks.


routeID=<SOMETHING>;
context.stopRoute(routeID);
context.removeRoute(routeID);

RouteBuilder builder = new RouteBuilder() {
        public void configure() {
                
errorHandler(deadLetterChannel(Constants.UNROUTED_MESSAGE_QUEUE));
                ChoiceDefinition cd =
from("activemq:queue:"+fromProcessID+"_outgoing").routeId(routeID).choice();
                for (String key : keys) {
                        List<String> destinations = 
cc.outputPayloadsHash.get(key);
                        ChoiceDefinition cd2 = null;
                        for (String dest : destinations) {
                                if (cd2 != null) 
                                        cd2.to("activemq:queue:"+dest);
                                else
                                        cd2 =
cd.when(header("payload").isEqualTo(key)).to("activemq:queue:"+dest);
                        }
                }
        };
        context.addRoutes( builder );
}



--
View this message in context: 
http://camel.465427.n5.nabble.com/Configured-routes-at-runtime-multiple-destinations-tp4992222p4992222.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to