Hi

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 <mcr...@optasportsdata.com> 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:
>
> //INTERCEPTOR
> 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 );
>  }
> });
>
> //ROUTE
> 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: 
> http://old.nabble.com/recipientList-%2B-AggregationStrategy-tp27305176p27305176.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

Reply via email to