You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Sven Bauhan <sv...@ast.dfs.de> on 2014/06/27 22:46:58 UTC
Synchronisation and Aggregator
Hi,
I want to use a Synchronisation in a route with an Aggregator.
So I implemented the onCompletion() method of the Synchronisation to
send a response that the message was received correctly.
My problem is that the onCompletion() method is called for each message
segment, not only for the last one, when the Aggregator has completed
the combination of all segments.
The Aggregator::onCompletion() method is just called when the message is
complete. But this is too early, as the message is not yet received then
at the endpoint.
So I have to decide in Synchronization::onCompletion() if the message in
the Aggregator is complete. But I have no idea how I can do this.
Has someone an idea how I can solve this?
Thanks, Sven
Re: Synchronisation and Aggregator
Posted by Sven Bauhan <sv...@ast.dfs.de>.
On 06/27/14 22:46, Sven Bauhan wrote:
> Hi,
>
> I want to use a Synchronisation in a route with an Aggregator.
>
> So I implemented the onCompletion() method of the Synchronisation to
> send a response that the message was received correctly.
> My problem is that the onCompletion() method is called for each
> message segment, not only for the last one, when the Aggregator has
> completed the combination of all segments.
> The Aggregator::onCompletion() method is just called when the message
> is complete. But this is too early, as the message is not yet received
> then at the endpoint.
> So I have to decide in Synchronization::onCompletion() if the message
> in the Aggregator is complete. But I have no idea how I can do this.
>
> Has someone an idea how I can solve this?
>
> Thanks, Sven
>
>
>
Hi,
I already found the solution: I had to set the synchronisation point
behind the aggregator:
from(...)
.process(...)
.aggregate(...)
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
exchange.getUnitOfWork().addSynchronization(...);
.to(...);
Greetings, Sven