You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "s.marjanovic" <sl...@gmail.com> on 2015/06/01 12:26:35 UTC

Re: How to react when there is a fixed period of inactivity (no traffic) in a route?

Hi,

I managed to get around the problem by using the statistics about the last
completed exchange and the elapsed time since last reset like this:

Date lastCompletedExchangeTimestamp = (Date)
camelContext.getManagementStrategy().getManagementAgent().getMBeanServer()
                                                            
.invoke(objectNameForRoute, "getLastExchangeCompletedTimestamp", null,
null);

Date resetTimestamp = (Date)
camelContext.getManagementStrategy().getManagementAgent().getMBeanServer()
                                               .invoke(objectNameForRoute,
"getResetTimestamp", null, null);

One small question though, I'm assuming that getResetTimestamp will give me
the time that camel context was initialized or the time of the last reset of
statistics (which doesn't concern me for now since statistics aren't being
reset manually yet).

Am I right with my assumption? Is there anything better to replace
getResetTimestamp with? I'm interested in obtaining camel context
initialization timestamp here and haven't had luck finding an alternative to
getResetTimestamp.

Thanks



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-react-when-there-is-a-fixed-period-of-inactivity-no-traffic-in-a-route-tp5767607p5767731.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How to react when there is a fixed period of inactivity (no traffic) in a route?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I have logged a ticket to add a start timestamp then its easier for you to know
https://issues.apache.org/jira/browse/CAMEL-8824

On Tue, Jun 2, 2015 at 9:20 AM, Claus Ibsen <cl...@gmail.com> wrote:
> On Mon, Jun 1, 2015 at 12:26 PM, s.marjanovic
> <sl...@gmail.com> wrote:
>> Hi,
>>
>> I managed to get around the problem by using the statistics about the last
>> completed exchange and the elapsed time since last reset like this:
>>
>> Date lastCompletedExchangeTimestamp = (Date)
>> camelContext.getManagementStrategy().getManagementAgent().getMBeanServer()
>>
>> .invoke(objectNameForRoute, "getLastExchangeCompletedTimestamp", null,
>> null);
>>
>> Date resetTimestamp = (Date)
>> camelContext.getManagementStrategy().getManagementAgent().getMBeanServer()
>>                                                .invoke(objectNameForRoute,
>> "getResetTimestamp", null, null);
>>
>> One small question though, I'm assuming that getResetTimestamp will give me
>> the time that camel context was initialized or the time of the last reset of
>> statistics (which doesn't concern me for now since statistics aren't being
>> reset manually yet).
>
> When last reset.
>
>
>>
>> Am I right with my assumption? Is there anything better to replace
>> getResetTimestamp with? I'm interested in obtaining camel context
>> initialization timestamp here and haven't had luck finding an alternative to
>> getResetTimestamp.
>>
>
> You can get the uptime from the camel context.
>
>
>
>> Thanks
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/How-to-react-when-there-is-a-fixed-period-of-inactivity-no-traffic-in-a-route-tp5767607p5767731.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: How to react when there is a fixed period of inactivity (no traffic) in a route?

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Jun 1, 2015 at 12:26 PM, s.marjanovic
<sl...@gmail.com> wrote:
> Hi,
>
> I managed to get around the problem by using the statistics about the last
> completed exchange and the elapsed time since last reset like this:
>
> Date lastCompletedExchangeTimestamp = (Date)
> camelContext.getManagementStrategy().getManagementAgent().getMBeanServer()
>
> .invoke(objectNameForRoute, "getLastExchangeCompletedTimestamp", null,
> null);
>
> Date resetTimestamp = (Date)
> camelContext.getManagementStrategy().getManagementAgent().getMBeanServer()
>                                                .invoke(objectNameForRoute,
> "getResetTimestamp", null, null);
>
> One small question though, I'm assuming that getResetTimestamp will give me
> the time that camel context was initialized or the time of the last reset of
> statistics (which doesn't concern me for now since statistics aren't being
> reset manually yet).

When last reset.


>
> Am I right with my assumption? Is there anything better to replace
> getResetTimestamp with? I'm interested in obtaining camel context
> initialization timestamp here and haven't had luck finding an alternative to
> getResetTimestamp.
>

You can get the uptime from the camel context.



> Thanks
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-react-when-there-is-a-fixed-period-of-inactivity-no-traffic-in-a-route-tp5767607p5767731.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/