You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by chrislovecnm <cl...@cnmconsulting.net> on 2012/04/06 15:48:18 UTC
Can't I do this with a filter?
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.
Re: Can't I do this with a filter?
Posted by Christopher Love <ch...@cnmconsulting.net>.
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 <cl...@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 <cl...@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
Re: Can't I do this with a filter?
Posted by Claus Ibsen <cl...@gmail.com>.
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 <cl...@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/