Retrieving time taken to invoke a remote endpoint

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Retrieving time taken to invoke a remote endpoint

rajith
Assume a route as follows
......
.to(myRemoteEndpoint)
.log(...)

I was wondering if there's a way to retrieve the time taken to invoke the
remote endpoint so it can be logged in the next step?

I'm aware that we can define an id for that step and use jmx or we can use
an event listener and use getTimeTaken() on the EXCHANGE_SENT event.
But in both cases we have to deal with all event/metrics to get the one we
want.

Additionally we want to log the time taken with other data related to that
particular exchange which will not be visible in the other approaches.

Any guidance is much appreciated.

Regards,

Rajith <http://rajith.2rlabs.com/>
Reply | Threaded
Open this post in threaded view
|

Re: Retrieving time taken to invoke a remote endpoint

Zoran Regvart-2
Hi Rajith,
perhaps you can take a look at creating a interceptor[1] to do that.

zoran

[1] https://github.com/apache/camel/blob/master/docs/user-manual/en/intercept.adoc

On Thu, Nov 8, 2018 at 2:16 PM, Rajith Muditha Attapattu
<[hidden email]> wrote:

> Assume a route as follows
> ......
> .to(myRemoteEndpoint)
> .log(...)
>
> I was wondering if there's a way to retrieve the time taken to invoke the
> remote endpoint so it can be logged in the next step?
>
> I'm aware that we can define an id for that step and use jmx or we can use
> an event listener and use getTimeTaken() on the EXCHANGE_SENT event.
> But in both cases we have to deal with all event/metrics to get the one we
> want.
>
> Additionally we want to log the time taken with other data related to that
> particular exchange which will not be visible in the other approaches.
>
> Any guidance is much appreciated.
>
> Regards,
>
> Rajith <http://rajith.2rlabs.com/>



--
Zoran Regvart
Reply | Threaded
Open this post in threaded view
|

Re: Retrieving time taken to invoke a remote endpoint

Claus Ibsen-2
Hi

And there is also this little example
http://camel.apache.org/eventnotifier-to-log-details-about-all-sent-exchanges.html
On Fri, Nov 9, 2018 at 10:36 AM Zoran Regvart <[hidden email]> wrote:

>
> Hi Rajith,
> perhaps you can take a look at creating a interceptor[1] to do that.
>
> zoran
>
> [1] https://github.com/apache/camel/blob/master/docs/user-manual/en/intercept.adoc
>
> On Thu, Nov 8, 2018 at 2:16 PM, Rajith Muditha Attapattu
> <[hidden email]> wrote:
> > Assume a route as follows
> > ......
> > .to(myRemoteEndpoint)
> > .log(...)
> >
> > I was wondering if there's a way to retrieve the time taken to invoke the
> > remote endpoint so it can be logged in the next step?
> >
> > I'm aware that we can define an id for that step and use jmx or we can use
> > an event listener and use getTimeTaken() on the EXCHANGE_SENT event.
> > But in both cases we have to deal with all event/metrics to get the one we
> > want.
> >
> > Additionally we want to log the time taken with other data related to that
> > particular exchange which will not be visible in the other approaches.
> >
> > Any guidance is much appreciated.
> >
> > Regards,
> >
> > Rajith <http://rajith.2rlabs.com/>
>
>
>
> --
> Zoran Regvart



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2