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: Problem with Java DSL filter
Date Mon, 04 Jun 2012 07:17:24 GMT
On Mon, Jun 4, 2012 at 7:33 AM, addict <ersubodhgupta@yahoo.com> wrote:
> public class Test extends RouteBuilder {
>
>
>        private volatile String tag = null;
>        @Override
>        public void configure() throws Exception {
>                from("http://url/a.csv")
>                                .filter(header("Tag").isNotNull())
>                                .filter(header("Tag").isNotEqualTo(tag))
>                                .process(new Processor() {
>                                        @Override
>                                        public void process(Exchange
exchange) throws Exception {
>                                                String s = String.valueOf(exchange.getIn().getHeader(
>                                                          
     "Tag"));
>                                                etag = new String(s);
>                                                System.out.println(tag);
>                                        }
>                                }).to("file://c:/test/");
>        }
>
>
>
> }
>
>
> However the comparison always pick up the tag value as null. Can anybody
> help
>

Do you mean this filter?
>                                .filter(header("Tag").isNotEqualTo(tag))

Then its because the configure method is most likely executed before
you have assigned a value to the tag value.




> --
> View this message in context: http://camel.465427.n5.nabble.com/Problem-with-Java-DSL-filter-tp5713919.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message