camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Conditionally omitting a portion of a route ...
Date Fri, 31 Jul 2015 14:51:40 GMT
Use the force luke ... just use java code, with a if branch

For that you need to break the dsl into the elements and build them together

ProcessorDefinition part = from("xxx").to("xxx");
if (foo) {
   part = part.wireTap("xxx")
}
// continue routing here
part.xxx



On Fri, Jul 31, 2015 at 2:30 PM, SteveR <srichardson@vonage.com> wrote:
> I also tried using the PredicateBuilder.constant() method to create a
> predicate that resolves to true/false, based on my Java configuration
> boolean:
>
> *    private static Boolean mirrorEnabled = null; // Set based on the
> "enabled" MIRROR configuration value.
>     Predicate mirrorWireTap = PredicateBuilder.constant(mirrorEnabled);*
>
>  and then added this DSL:
>
> *    .choice()
>          .when(mirrorWireTap).wireTap(mirrorToURI).id(sourceRouteId +
> "_MIRROR")
>     .end()*
>
> ... but dumping the roue as XML from within VisualVM shows that the choice()
> block encompasses the wireTap() and the remainder of the route.  I just want
> something that lets me conditionally run the wireTap() method, or not.
>
>   Thanks, Steve
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Conditionally-omitting-a-portion-of-a-route-tp5770127p5770165.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2

Mime
View raw message