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.