camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Love <ch...@cnmconsulting.net>
Subject Re: Can't I do this with a filter?
Date Fri, 06 Apr 2012 17:05:22 GMT
Thanks Claus

For some reason is was getting a npe with the solution of using the 'not',
so I inverted the method and it works like a charm!

Chris

On Fri, Apr 6, 2012 at 10:04 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:

> Hi
>
> If you use a filter then you most likely need to invert the method.
> eg a isNotXXX method
>
> filter().method(RedisService.class, "isNotLsaHtmlDuplicateBody")
>    .to("activemq:getAndStoreHTMLPage")
> .end()
>
> And you can use end to mark the end of the filter.
>
> There is also a not predicate in Camel but the DSL is a bit
> cumbersome, so I have improved that on Camel 2.10, so you can do
>
> // requires Camel 2.10
> filter(not(bean(RedisService.class, "isLsaHtmlDuplicateBody")))
>    .to("activemq:getAndStoreHTMLPage")
> .end()
>
> For Camel 2.9 or older, you can do something alike
>
> filter(not(toPredicate(bean(RedisService.class,
> "isLsaHtmlDuplicateBody"))))
>    .to("activemq:getAndStoreHTMLPage")
> .end()
>
> And then do a static import of the toPredicate method.
>
>
> On Fri, Apr 6, 2012 at 3:48 PM, chrislovecnm <clove@cnmconsulting.net>
> wrote:
> > Hi all
> >
> > I am doing this
> >
> >  .choice()
> >          .when().method(RedisService.class,
> > "isLsaHtmlDuplicateBody").to("mock:nowhere")
> >
> >
> .otherwise().to("activemq:getAndStoreHTMLPage?concurrentConsumers=30&asyncConsumer=true");
> >
> > I tried using a filter first, but I seemed to still be getting data.  Am
> I
> > incorrect about the filter?
> >
> > Thanks
> >
> > Chris
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/Can-t-I-do-this-with-a-filter-tp5622789p5622789.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>



-- 
Chris Love
clove@cnmconsulting.net
(303) 929-8509
http://www.cnmconsulting.net
Calendar: http://j.mp/cnmCalendar
Follow me on twitter: @chrislovecnm

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message