camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Müller <christian.muel...@gmail.com>
Subject Re: Configured routes at runtime - multiple destinations
Date Tue, 15 Nov 2011 20:22:29 GMT
The 4th time for the inner or outer loop?

After the outer loop, could you add a "end()"?

And instead of
cd2.to("activemq:queue:"+dest);
could you please write
cd2 = cd2.to("activemq:queue:"+dest);

Best,
Christian

On Mon, Nov 14, 2011 at 12:04 PM, sub3 <steve@subwest.com> wrote:

> 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.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message