camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roman Kalukiewicz" <>
Subject Re: AW: AW: Aggregation problems
Date Mon, 14 Jan 2008 10:23:22 GMT
2008/1/12, P.Budzik <>:
> Robert Thullner pisze:
> > Does batch size mean, the number of messages I want to aggregate to one
> > single message, or does it mean something else?
> Aggregation end is triggered either by exceeding number of collected
> exchanges (where N=batchSize) or when after specified timeout nothing
> was received (however nothing is sent then).

To clarify few things that were told in this thread.

I believe that your correlationId could be specified in some easier
way. Instead of creating expression instance it should be enough to

.aggregator(header("JMSCorrelationID"), aggregationStrategy)

as 'header("JMSCorrelationID")' is already an expression.

About those batch sizes and timeouts it works in a tricky way. They
are used ONLY if you don't have a completedPredicate specified. If you
have it, then other settings are ignored. What is important - this
predicate is evaluated on your aggregated exchange when message
arrives - so it is hard to have a timeout condition here.

When no completedPredicate is specified then we assume that it is time
to send our aggregated batches when:
* overall number of collected messages since last send is >= batchSize
(it is not a size of some batch)
* on timeout (that ticks on its own - it is not 'event driven' so it
doesn't start when first exchange is received - it just starts when
context is started)

In your particular case, when you don't know how many messages could
belong to the batch - is there any way to 'evaluate it'? If so, then
completed Predicate is for you. If there is no way to evaluate it,
then you need some kind of timeout (unfortunately at the moment we
cannot specify a condition like "send my batch when there is no
message for it for 5 sec" - we rather have "send my batch every 5 sec
whatever we have aggregated").

I hope it clears it a little (should we update our Aggregator wiki page? ;) )


View raw message