You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Victor NOËL <vi...@linagora.com> on 2015/10/13 10:55:26 UTC

Capturing events on route start

Hi,

I was wondering if it was possible to register something on a 
CamelContext so that when a route deployed on it is started (using any 
type of from()), some code is executed.

Optimally, it would be useful to know the component involved (if 
possible the object, but even its string name could be useful).

Thank you

Victor

Re: Capturing events on route start

Posted by Victor NOËL <vi...@linagora.com>.
Or maybe interceptor (in particular interceptFrom) are more adequate as 
they allow me to only be notified when the from of a route is invoked?

Victor

Le 13/10/2015 11:13, Victor NOËL a écrit :
> I wasn't so clear: I really meant I wanted to be notified when a new 
> exchange is sent from a Consumer component.
>
> So I guess what I am looking for is something like 
> ExchangeSendingEvent or ExchangeSentEvent :)
>
> Thank you very much!
>
> Victor
>
> Le 13/10/2015 11:09, Claus Ibsen a écrit :
>> Ah yeah that is only for add/remove.
>>
>> For events like that you can use event notifier
>> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/ManagementStrategy.html 
>>
>>
>> And it can listen for any of these events
>> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/management/event/package-frame.html 
>>
>>
>> which you can filter which you want to listen for
>>
>>
>> An example here
>> http://camel.apache.org/eventnotifier-to-log-details-about-all-sent-exchanges.html 
>>
>>
>> On Tue, Oct 13, 2015 at 11:04 AM, Victor NOËL 
>> <vi...@linagora.com> wrote:
>>> It's not clear from the Javadoc if it will give me ways to know when 
>>> a route
>>> start (not when it is added), but maybe I don't know well how Camel 
>>> works…
>>>
>>> Could you clarify that for me? Thanks :)
>>>
>>>
>>> Le 13/10/2015 11:02, Claus Ibsen a écrit :
>>>> You can register a custom lifecycle to get callbacks
>>>>
>>>> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/LifecycleStrategy.html 
>>>>
>>>>
>>>> There is api on camel context to add it. or if you use spring then
>>>> just declare it as a <bean> and its auto enabled
>>>>
>>>> On Tue, Oct 13, 2015 at 10:55 AM, Victor NOËL 
>>>> <vi...@linagora.com>
>>>> wrote:
>>>>> Hi,
>>>>>
>>>>> I was wondering if it was possible to register something on a
>>>>> CamelContext
>>>>> so that when a route deployed on it is started (using any type of
>>>>> from()),
>>>>> some code is executed.
>>>>>
>>>>> Optimally, it would be useful to know the component involved (if 
>>>>> possible
>>>>> the object, but even its string name could be useful).
>>>>>
>>>>> Thank you
>>>>>
>>>>> Victor
>>>>
>>>>
>>
>>
>


Re: Capturing events on route start

Posted by Victor NOËL <vi...@linagora.com>.
I wasn't so clear: I really meant I wanted to be notified when a new 
exchange is sent from a Consumer component.

So I guess what I am looking for is something like ExchangeSendingEvent 
or ExchangeSentEvent :)

Thank you very much!

Victor

Le 13/10/2015 11:09, Claus Ibsen a écrit :
> Ah yeah that is only for add/remove.
>
> For events like that you can use event notifier
> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/ManagementStrategy.html
>
> And it can listen for any of these events
> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/management/event/package-frame.html
>
> which you can filter which you want to listen for
>
>
> An example here
> http://camel.apache.org/eventnotifier-to-log-details-about-all-sent-exchanges.html
>
> On Tue, Oct 13, 2015 at 11:04 AM, Victor NOËL <vi...@linagora.com> wrote:
>> It's not clear from the Javadoc if it will give me ways to know when a route
>> start (not when it is added), but maybe I don't know well how Camel works…
>>
>> Could you clarify that for me? Thanks :)
>>
>>
>> Le 13/10/2015 11:02, Claus Ibsen a écrit :
>>> You can register a custom lifecycle to get callbacks
>>>
>>> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/LifecycleStrategy.html
>>>
>>> There is api on camel context to add it. or if you use spring then
>>> just declare it as a <bean> and its auto enabled
>>>
>>> On Tue, Oct 13, 2015 at 10:55 AM, Victor NOËL <vi...@linagora.com>
>>> wrote:
>>>> Hi,
>>>>
>>>> I was wondering if it was possible to register something on a
>>>> CamelContext
>>>> so that when a route deployed on it is started (using any type of
>>>> from()),
>>>> some code is executed.
>>>>
>>>> Optimally, it would be useful to know the component involved (if possible
>>>> the object, but even its string name could be useful).
>>>>
>>>> Thank you
>>>>
>>>> Victor
>>>
>>>
>
>


Re: Capturing events on route start

Posted by Claus Ibsen <cl...@gmail.com>.
Ah yeah that is only for add/remove.

For events like that you can use event notifier
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/ManagementStrategy.html

And it can listen for any of these events
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/management/event/package-frame.html

which you can filter which you want to listen for


An example here
http://camel.apache.org/eventnotifier-to-log-details-about-all-sent-exchanges.html

On Tue, Oct 13, 2015 at 11:04 AM, Victor NOËL <vi...@linagora.com> wrote:
> It's not clear from the Javadoc if it will give me ways to know when a route
> start (not when it is added), but maybe I don't know well how Camel works…
>
> Could you clarify that for me? Thanks :)
>
>
> Le 13/10/2015 11:02, Claus Ibsen a écrit :
>>
>> You can register a custom lifecycle to get callbacks
>>
>> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/LifecycleStrategy.html
>>
>> There is api on camel context to add it. or if you use spring then
>> just declare it as a <bean> and its auto enabled
>>
>> On Tue, Oct 13, 2015 at 10:55 AM, Victor NOËL <vi...@linagora.com>
>> wrote:
>>>
>>> Hi,
>>>
>>> I was wondering if it was possible to register something on a
>>> CamelContext
>>> so that when a route deployed on it is started (using any type of
>>> from()),
>>> some code is executed.
>>>
>>> Optimally, it would be useful to know the component involved (if possible
>>> the object, but even its string name could be useful).
>>>
>>> Thank you
>>>
>>> Victor
>>
>>
>>
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition

Re: Capturing events on route start

Posted by Victor NOËL <vi...@linagora.com>.
It's not clear from the Javadoc if it will give me ways to know when a 
route start (not when it is added), but maybe I don't know well how 
Camel works…

Could you clarify that for me? Thanks :)

Le 13/10/2015 11:02, Claus Ibsen a écrit :
> You can register a custom lifecycle to get callbacks
> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/LifecycleStrategy.html
>
> There is api on camel context to add it. or if you use spring then
> just declare it as a <bean> and its auto enabled
>
> On Tue, Oct 13, 2015 at 10:55 AM, Victor NOËL <vi...@linagora.com> wrote:
>> Hi,
>>
>> I was wondering if it was possible to register something on a CamelContext
>> so that when a route deployed on it is started (using any type of from()),
>> some code is executed.
>>
>> Optimally, it would be useful to know the component involved (if possible
>> the object, but even its string name could be useful).
>>
>> Thank you
>>
>> Victor
>
>


Re: Capturing events on route start

Posted by Claus Ibsen <cl...@gmail.com>.
You can register a custom lifecycle to get callbacks
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/LifecycleStrategy.html

There is api on camel context to add it. or if you use spring then
just declare it as a <bean> and its auto enabled

On Tue, Oct 13, 2015 at 10:55 AM, Victor NOËL <vi...@linagora.com> wrote:
> Hi,
>
> I was wondering if it was possible to register something on a CamelContext
> so that when a route deployed on it is started (using any type of from()),
> some code is executed.
>
> Optimally, it would be useful to know the component involved (if possible
> the object, but even its string name could be useful).
>
> Thank you
>
> Victor



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition