You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Andreas A." <an...@gmail.com> on 2010/09/28 11:13:40 UTC

Aggregator completionFromBatchConsumer fallback max messages.

Hi

I want to build a route where I poll for all files in a directory every 24
hours, then aggregate the files in different groups and send them. So far I
have used an aggregator as below, but now a requirement to have a maximum of
for instance 100 messages per aggregated message has arisen. Any ideas how
to do this?

<aggregate strategyRef="myAggregator" completionFromBatchConsumer="true">
	<correlationExpression>
		<header>receiverAddress</header>
	</correlationExpression>

-- 
View this message in context: http://camel.465427.n5.nabble.com/Aggregator-completionFromBatchConsumer-fallback-max-messages-tp2856427p2856427.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Aggregator completionFromBatchConsumer fallback max messages.

Posted by sakchakravarthi <aj...@gmail.com>.
Hi Andreas A
I have a similar  situation i can get n number of file from a file location
so could you please help me in giving example.



--
View this message in context: http://camel.465427.n5.nabble.com/Aggregator-completionFromBatchConsumer-fallback-max-messages-tp2856427p5752578.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Aggregator completionFromBatchConsumer fallback max messages.

Posted by "Andreas A." <an...@gmail.com>.
Alright cool. I put the logic for this in my AggregationStrategy, works fine.
-- 
View this message in context: http://camel.465427.n5.nabble.com/Aggregator-completionFromBatchConsumer-fallback-max-messages-tp2856427p2856629.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Aggregator completionFromBatchConsumer fallback max messages.

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Sep 28, 2010 at 11:29 AM, Andreas A. <an...@gmail.com> wrote:
>
> Hi
>
> Yeah but the problem is that I only poll once per 24 hours (with a simple
> delay on the file endpoint) and I want all the messages to be picked up
> everytime.
> --

Ah then use a completion predicate instead and just indicate true at
every 100th message being aggregated.

And the batch consumer will set set the following properties on the
Exchange you can use

    String BATCH_INDEX                = "CamelBatchIndex";
    String BATCH_SIZE                 = "CamelBatchSize";
    String BATCH_COMPLETE             = "CamelBatchComplete";

You can then use that to know when the last batch message arrived and
thus when you are complete.



> View this message in context: http://camel.465427.n5.nabble.com/Aggregator-completionFromBatchConsumer-fallback-max-messages-tp2856427p2856438.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Aggregator completionFromBatchConsumer fallback max messages.

Posted by "Andreas A." <an...@gmail.com>.
Hi

Yeah but the problem is that I only poll once per 24 hours (with a simple
delay on the file endpoint) and I want all the messages to be picked up
everytime.
-- 
View this message in context: http://camel.465427.n5.nabble.com/Aggregator-completionFromBatchConsumer-fallback-max-messages-tp2856427p2856438.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Aggregator completionFromBatchConsumer fallback max messages.

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Sep 28, 2010 at 11:13 AM, Andreas A. <an...@gmail.com> wrote:
>
> Hi
>
> I want to build a route where I poll for all files in a directory every 24
> hours, then aggregate the files in different groups and send them. So far I
> have used an aggregator as below, but now a requirement to have a maximum of
> for instance 100 messages per aggregated message has arisen. Any ideas how
> to do this?
>

You can limit the file consumer to max 100 files using the
maxMessagesPerPoll option.


> <aggregate strategyRef="myAggregator" completionFromBatchConsumer="true">
>        <correlationExpression>
>                <header>receiverAddress</header>
>        </correlationExpression>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Aggregator-completionFromBatchConsumer-fallback-max-messages-tp2856427p2856427.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus