camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: recipientList + AggregationStrategy
Date Mon, 25 Jan 2010 14:40:59 GMT

Interesting use case you got.
I got to go over this again at another time. I am at a business
convention in the US which means I am on a 9h timezone difference
which makes me a bit dizzy at this moment.

However just wanted to pitch in that JMX stores performance stats for
nearly all processors in a Camel route. However I know the JMX API is
clumpsy and a pain in the ...... to use.

Using the interceptSendToEndpoint appears at first sight convenient to
use in your situations but you need to have a hook to the after
sending which it does not provides currently.

We may be able to add something to the DSL so you can control when to
send to the original designated endpoint. Currently we only get the
skipSendToOriginalEndpoint(). However you could use this fact and send
the message yourself.

For example from a bean or processor you could just

long start = ....

// send to intended endpoint
String uri = exchange.getHeader(Exchange.INTERCEPTED_ENDPOINT, String.class);
// use eg producer template to send to that uri
long end = ...

And you can use try .. finally so the end is always computed.

On Mon, Jan 25, 2010 at 12:18 PM, mcrive <> wrote:
> Hi,
> I am using recipientList to send a message to a list of endpoints (mostly
> FTP).
> I am using an AggregationStrategy to compute few properties of the
> exchanges:
> - delivered
> - how many retries
> - time taken
> I've been able to get 'delivered' and 'how many retries' for each endpoint
> but I can't find a way to get the time it took to send the message.
> I've tried to use an interceptor and store 'start-time' in the header and
> then check the timestamp when the exchange hits the aggregation strategy but
> this is not working as all exchanges are sent to the aggregationstrategy as
> soon as the last endpoint is processed.
> Do you have any suggestion on how I could get the transfer time for each
> exchange?
> I am using Camel 2.2
> route sample:
> interceptSendToEndpoint("(ftp|direct|smtp):.*").process(new Processor() {
> // in start-time header we store the time in which the message is sent to
> the endpoint
>  public void process(Exchange exchange) throws Exception {
>    long currentTime = System.currentTimeMillis();
>    exchange.getIn().setHeader("start-time", currentTime );
>  }
> });
> from("jms-test:queue:test.queue").process(processor)
> .onException(Exception.class).maximumRedeliveries(2).redeliverDelay(60L).end()
> .recipientList(header("recipientListHeader").tokenize(","))
> .parallelProcessing().executorService(customThreadPoolExecutor)
> .aggregationStrategy(new RecipientAggregationStrategy(deliveryEndpoints,
> _endpointDeliveredBaseUri))
> .to("direct:chunk.completed");
> thanks
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Apache Camel Committer

Author of Camel in Action:
Open Source Integration:

View raw message