Hi
> .when(checckFilePattern(header("CamelFileAbsolutePath").toString())).
This is wrong. This code is only invoked once to setup the routes.
Use a bean as predicate instead of header for dynamic, and just write
it as plain java code
public static boolean checkPattern(@Header("CamelFileAbsolutePath") path) {
...
}
And use a bean as the predicate.
On Mon, May 25, 2015 at 9:33 AM, Kondalarv <[email protected]> wrote:
> I have choice with many options, and using java operation for conditions.
> The route is going to otherwise() option always and checckFilePattern()
> method is not executing.
>
>
> from(FILE_WATCHER_DSL)
> .log(LoggingLevel.INFO, FileWatchDSLUtil.getFileLogPattern())
> .choice()
>
> .when(checckFilePattern(header("CamelFileAbsolutePath").toString())).process(new
> FileConsumerProcesser()).endChoice()
> .otherwise().log("File Patten is not Matched.
> ${file:absolute.path}")
>
> .to("file:/app/work01/FileWatcherAgent/quarantine").process(new
> FileConsumerErrorProcesser()).stop().endChoice()
> .end()
> .log("End Processing Route");
> ;
>
>
> private static Predicate checckFilePattern(String fileName){
> logger.info("checckFilePattern==> File Name : {}", fileName);
> boolean flag = false;
> if(fileName.endsWith("txt")) flag= true;
> Predicate predicate = PredicateBuilder.constant(flag);
> logger.info("checckFilePattern==> predicate: {}", predicate);
> return predicate;
> }
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Content-Based-Router-Java-DSL-is-not-working-tp5767440.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [email protected]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/