On Wed, Jun 10, 2009 at 11:10 AM, ErwinK<[email protected]> wrote:
>
> Hi,
>
> When I have the following route:
>
> from("timer://timer?period=3600000")
> .to("ldap:ldapConnection?base=&scope=subtree")
> .splitter(body(List.class), new MyAggregationStrategy())
> .filter(some expression)
> .end()
> .to("smtp://[email protected]&[email protected]");
>
> Now, when a message is filtered out, I still get it as an individual message
> at the smtp endpoint, is this suposed to happen?
Hi
Ah I can see the issue now. When you use a filter in the split sub
route, it just filters from processing any further in this subroute.
But it will aggregate all messages using your strategy. Even if it was filtered.
The filter in Camel just blocks the message from being routed any
further. It does not mark it as filtered.
What is needed to let this work is to add this logic inside Camel to
mark the message as being filtered so the aggregator can skip this
message.
As a workaround you can implement the fiter logic in your aggregation strategy.
You can also invoke expression or predicates from that Java code, if you like.
In the route builder you can define a predicate:
Predicate goodWord = body().contains("World");
And then pass it in as argument to the constructor of your aggregation strategy
Then you can evaluate the predicate in the javacode.
I will create a ticket about the mark a message as filtered so Camel
can skip it in aggregation strategies.
>
> Regards,
> Erwin
> --
> View this message in context:
> http://www.nabble.com/Filtered-message-after-splitter-shows-up-after-aggregation-tp23957958p23957958.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus