I suggest something like this: from("direct:start") .filter(new Predicate() { @Override public boolean matches(Exchange exchange) { String text = exchange.getIn().getHeader("mySpecialXPathHeader", String.class); return new XPathExpression(text).createPredicate(exchange.getContext()).matches(exchanges); } }) .to("mock:result");
In an ideal world, you should be able to do something like this: from("direct:start"). filter().xpath(header("mySpecialXPathHeader")). to("mock:result"); May you consider to open a JIRA for it [1]? [1] https://issues.apache.org/jira/browse/CAMEL Best, Christian On Mon, Apr 2, 2012 at 8:27 AM, Samruben <ramyasri....@gmail.com> wrote: > Hi > > I am new to camel. I have a use case, I need some suggestions and best way > to implement it. > > I have some data in database which has some header values as jxpath > expression. I need to validate it using filter. > > eg: jxpath //books/value>600 > > But in camel, the filter always comes with camel component, but i need to a > separate filter method in my simple java class. I need to pass the filter > value to the filter method which must validate it using jxpath expression > filter and return it as boolean value (using predicate concept ) > > eg: filter value --> value>600 > > Any suggestion will be heplful for me. > > Regards, > Sam > > -- > View this message in context: > http://camel.465427.n5.nabble.com/way-to-implement-usecase-tp5611605p5611605.html > Sent from the Camel Development mailing list archive at Nabble.com. >