You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Ephemeris Lappis <ep...@gmail.com> on 2019/07/02 08:40:10 UTC

Camel EventNotifier as OSGi service

Hello.

I've been trying to provide a org.apache.camel.spi.EventNotifier as a
shared OSGi service.

When I instantiates a similar object as a bean in a bundle blueprint, the
Camel context registers it and all events are received as expected.

If I try to expose the same kind of object as a service from another
bundle, It seems that it is automatically added to all my Camel contexts in
any bundle, masking all others EventNotifier created as simple beans, ans
without using a service reference.

I expose it like that :

<bean
    id="my.pure.service.bean"
    class="my.tests.t13.spy.service.SpyPureService" />
<service
    id="my.spy.pure.service"
    interface="org.apache.camel.spi.EventNotifier"
    ref="my.pure.service.bean" />

Is it a normal behavior ?

Why does the service appear all the bundles without setting a reference ?

Thanks for your help.

Regards.

Re: Camel EventNotifier as OSGi service

Posted by Ephemeris Lappis <ep...@gmail.com>.
Hello.
I'm coming back to my problem with my EventNotifier managed as a service.
We have to present a new design for about 150 to 200 Camel bundles that
instantiate an EventNotifier as a Blueprint bean. The EventNotifier class
is provided by a common bundle that may change some times. This coupling
may produce useless upgrade and restart of all the bundles. Providing the
EventNotifier as a service reference instead of a bean seems to be the best
design solution, but as it doesn't work with just some simple bundles I'm
afraid that this rework is lost time... Some idea of the origin of the
problem and some kind of workaround ? Thanks for your help.
Regards.

Le mar. 2 juil. 2019 à 11:01, Jean-Baptiste Onofré <jb...@nanthrax.net> a
écrit :

> Let me take a look on the Camel version shipped with SMX 7.0.1.
>
> Regards
> JB
>
> On 02/07/2019 10:58, Ephemeris Lappis wrote:
> > Exact :
> > 1) one bundle exposes an object that implements the EventNotifier
> interface
> > as a service in ts blueprint.
> > 2) two other bundles with their blueprints run Camel contexts, and do not
> > reference the service. All the exchanges of these routes are trapped as
> > events by the service.
> > Strange, no ? It seems that the global service is added to each bundle
> > registry without any explicit reference, and detected as a listener by
> > Camel.
> > An explanation ?
> > FYI : I'm using SMX 7.0.1 with just its given Camel features.
> > Thanks.
> > Regards.
> >
> > Le mar. 2 juil. 2019 à 10:51, Jean-Baptiste Onofré <jb...@nanthrax.net> a
> > écrit :
> >
> >> Hi,
> >>
> >> I guess you are using camel-blueprint, right ?
> >>
> >> The EventNotifier service is in a dedicated bundle ?
> >>
> >> Regards
> >> JB
> >>
> >> On 02/07/2019 10:40, Ephemeris Lappis wrote:
> >>> Hello.
> >>>
> >>> I've been trying to provide a org.apache.camel.spi.EventNotifier as a
> >>> shared OSGi service.
> >>>
> >>> When I instantiates a similar object as a bean in a bundle blueprint,
> the
> >>> Camel context registers it and all events are received as expected.
> >>>
> >>> If I try to expose the same kind of object as a service from another
> >>> bundle, It seems that it is automatically added to all my Camel
> contexts
> >> in
> >>> any bundle, masking all others EventNotifier created as simple beans,
> ans
> >>> without using a service reference.
> >>>
> >>> I expose it like that :
> >>>
> >>> <bean
> >>>     id="my.pure.service.bean"
> >>>     class="my.tests.t13.spy.service.SpyPureService" />
> >>> <service
> >>>     id="my.spy.pure.service"
> >>>     interface="org.apache.camel.spi.EventNotifier"
> >>>     ref="my.pure.service.bean" />
> >>>
> >>> Is it a normal behavior ?
> >>>
> >>> Why does the service appear all the bundles without setting a
> reference ?
> >>>
> >>> Thanks for your help.
> >>>
> >>> Regards.
> >>>
> >>
> >> --
> >> Jean-Baptiste Onofré
> >> jbonofre@apache.org
> >> http://blog.nanthrax.net
> >> Talend - http://www.talend.com
> >>
> >
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Re: Camel EventNotifier as OSGi service

Posted by Ephemeris Lappis <ep...@gmail.com>.
2.16.5

Le mar. 2 juil. 2019 à 11:01, Jean-Baptiste Onofré <jb...@nanthrax.net> a
écrit :

> Let me take a look on the Camel version shipped with SMX 7.0.1.
>
> Regards
> JB
>
> On 02/07/2019 10:58, Ephemeris Lappis wrote:
> > Exact :
> > 1) one bundle exposes an object that implements the EventNotifier
> interface
> > as a service in ts blueprint.
> > 2) two other bundles with their blueprints run Camel contexts, and do not
> > reference the service. All the exchanges of these routes are trapped as
> > events by the service.
> > Strange, no ? It seems that the global service is added to each bundle
> > registry without any explicit reference, and detected as a listener by
> > Camel.
> > An explanation ?
> > FYI : I'm using SMX 7.0.1 with just its given Camel features.
> > Thanks.
> > Regards.
> >
> > Le mar. 2 juil. 2019 à 10:51, Jean-Baptiste Onofré <jb...@nanthrax.net> a
> > écrit :
> >
> >> Hi,
> >>
> >> I guess you are using camel-blueprint, right ?
> >>
> >> The EventNotifier service is in a dedicated bundle ?
> >>
> >> Regards
> >> JB
> >>
> >> On 02/07/2019 10:40, Ephemeris Lappis wrote:
> >>> Hello.
> >>>
> >>> I've been trying to provide a org.apache.camel.spi.EventNotifier as a
> >>> shared OSGi service.
> >>>
> >>> When I instantiates a similar object as a bean in a bundle blueprint,
> the
> >>> Camel context registers it and all events are received as expected.
> >>>
> >>> If I try to expose the same kind of object as a service from another
> >>> bundle, It seems that it is automatically added to all my Camel
> contexts
> >> in
> >>> any bundle, masking all others EventNotifier created as simple beans,
> ans
> >>> without using a service reference.
> >>>
> >>> I expose it like that :
> >>>
> >>> <bean
> >>>     id="my.pure.service.bean"
> >>>     class="my.tests.t13.spy.service.SpyPureService" />
> >>> <service
> >>>     id="my.spy.pure.service"
> >>>     interface="org.apache.camel.spi.EventNotifier"
> >>>     ref="my.pure.service.bean" />
> >>>
> >>> Is it a normal behavior ?
> >>>
> >>> Why does the service appear all the bundles without setting a
> reference ?
> >>>
> >>> Thanks for your help.
> >>>
> >>> Regards.
> >>>
> >>
> >> --
> >> Jean-Baptiste Onofré
> >> jbonofre@apache.org
> >> http://blog.nanthrax.net
> >> Talend - http://www.talend.com
> >>
> >
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Re: Camel EventNotifier as OSGi service

Posted by Ephemeris Lappis <ep...@gmail.com>.
Hello again.

I've done new tests deploying the same bundles on our target environment to
check if there behavior is the same : "Camel 2.17.0.redhat-630187" on Fuse
"fabric8-karaf-1.2.0.redhat-630187". And, unfortunately, the same bad
behavior...

Thanks for your help.

Regards.

Le mar. 2 juil. 2019 à 11:01, Jean-Baptiste Onofré <jb...@nanthrax.net> a
écrit :

> Let me take a look on the Camel version shipped with SMX 7.0.1.
>
> Regards
> JB
>
> On 02/07/2019 10:58, Ephemeris Lappis wrote:
> > Exact :
> > 1) one bundle exposes an object that implements the EventNotifier
> interface
> > as a service in ts blueprint.
> > 2) two other bundles with their blueprints run Camel contexts, and do not
> > reference the service. All the exchanges of these routes are trapped as
> > events by the service.
> > Strange, no ? It seems that the global service is added to each bundle
> > registry without any explicit reference, and detected as a listener by
> > Camel.
> > An explanation ?
> > FYI : I'm using SMX 7.0.1 with just its given Camel features.
> > Thanks.
> > Regards.
> >
> > Le mar. 2 juil. 2019 à 10:51, Jean-Baptiste Onofré <jb...@nanthrax.net> a
> > écrit :
> >
> >> Hi,
> >>
> >> I guess you are using camel-blueprint, right ?
> >>
> >> The EventNotifier service is in a dedicated bundle ?
> >>
> >> Regards
> >> JB
> >>
> >> On 02/07/2019 10:40, Ephemeris Lappis wrote:
> >>> Hello.
> >>>
> >>> I've been trying to provide a org.apache.camel.spi.EventNotifier as a
> >>> shared OSGi service.
> >>>
> >>> When I instantiates a similar object as a bean in a bundle blueprint,
> the
> >>> Camel context registers it and all events are received as expected.
> >>>
> >>> If I try to expose the same kind of object as a service from another
> >>> bundle, It seems that it is automatically added to all my Camel
> contexts
> >> in
> >>> any bundle, masking all others EventNotifier created as simple beans,
> ans
> >>> without using a service reference.
> >>>
> >>> I expose it like that :
> >>>
> >>> <bean
> >>>     id="my.pure.service.bean"
> >>>     class="my.tests.t13.spy.service.SpyPureService" />
> >>> <service
> >>>     id="my.spy.pure.service"
> >>>     interface="org.apache.camel.spi.EventNotifier"
> >>>     ref="my.pure.service.bean" />
> >>>
> >>> Is it a normal behavior ?
> >>>
> >>> Why does the service appear all the bundles without setting a
> reference ?
> >>>
> >>> Thanks for your help.
> >>>
> >>> Regards.
> >>>
> >>
> >> --
> >> Jean-Baptiste Onofré
> >> jbonofre@apache.org
> >> http://blog.nanthrax.net
> >> Talend - http://www.talend.com
> >>
> >
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Re: Camel EventNotifier as OSGi service

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Let me take a look on the Camel version shipped with SMX 7.0.1.

Regards
JB

On 02/07/2019 10:58, Ephemeris Lappis wrote:
> Exact :
> 1) one bundle exposes an object that implements the EventNotifier interface
> as a service in ts blueprint.
> 2) two other bundles with their blueprints run Camel contexts, and do not
> reference the service. All the exchanges of these routes are trapped as
> events by the service.
> Strange, no ? It seems that the global service is added to each bundle
> registry without any explicit reference, and detected as a listener by
> Camel.
> An explanation ?
> FYI : I'm using SMX 7.0.1 with just its given Camel features.
> Thanks.
> Regards.
> 
> Le mar. 2 juil. 2019 à 10:51, Jean-Baptiste Onofré <jb...@nanthrax.net> a
> écrit :
> 
>> Hi,
>>
>> I guess you are using camel-blueprint, right ?
>>
>> The EventNotifier service is in a dedicated bundle ?
>>
>> Regards
>> JB
>>
>> On 02/07/2019 10:40, Ephemeris Lappis wrote:
>>> Hello.
>>>
>>> I've been trying to provide a org.apache.camel.spi.EventNotifier as a
>>> shared OSGi service.
>>>
>>> When I instantiates a similar object as a bean in a bundle blueprint, the
>>> Camel context registers it and all events are received as expected.
>>>
>>> If I try to expose the same kind of object as a service from another
>>> bundle, It seems that it is automatically added to all my Camel contexts
>> in
>>> any bundle, masking all others EventNotifier created as simple beans, ans
>>> without using a service reference.
>>>
>>> I expose it like that :
>>>
>>> <bean
>>>     id="my.pure.service.bean"
>>>     class="my.tests.t13.spy.service.SpyPureService" />
>>> <service
>>>     id="my.spy.pure.service"
>>>     interface="org.apache.camel.spi.EventNotifier"
>>>     ref="my.pure.service.bean" />
>>>
>>> Is it a normal behavior ?
>>>
>>> Why does the service appear all the bundles without setting a reference ?
>>>
>>> Thanks for your help.
>>>
>>> Regards.
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>>
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Camel EventNotifier as OSGi service

Posted by Ephemeris Lappis <ep...@gmail.com>.
Exact :
1) one bundle exposes an object that implements the EventNotifier interface
as a service in ts blueprint.
2) two other bundles with their blueprints run Camel contexts, and do not
reference the service. All the exchanges of these routes are trapped as
events by the service.
Strange, no ? It seems that the global service is added to each bundle
registry without any explicit reference, and detected as a listener by
Camel.
An explanation ?
FYI : I'm using SMX 7.0.1 with just its given Camel features.
Thanks.
Regards.

Le mar. 2 juil. 2019 à 10:51, Jean-Baptiste Onofré <jb...@nanthrax.net> a
écrit :

> Hi,
>
> I guess you are using camel-blueprint, right ?
>
> The EventNotifier service is in a dedicated bundle ?
>
> Regards
> JB
>
> On 02/07/2019 10:40, Ephemeris Lappis wrote:
> > Hello.
> >
> > I've been trying to provide a org.apache.camel.spi.EventNotifier as a
> > shared OSGi service.
> >
> > When I instantiates a similar object as a bean in a bundle blueprint, the
> > Camel context registers it and all events are received as expected.
> >
> > If I try to expose the same kind of object as a service from another
> > bundle, It seems that it is automatically added to all my Camel contexts
> in
> > any bundle, masking all others EventNotifier created as simple beans, ans
> > without using a service reference.
> >
> > I expose it like that :
> >
> > <bean
> >     id="my.pure.service.bean"
> >     class="my.tests.t13.spy.service.SpyPureService" />
> > <service
> >     id="my.spy.pure.service"
> >     interface="org.apache.camel.spi.EventNotifier"
> >     ref="my.pure.service.bean" />
> >
> > Is it a normal behavior ?
> >
> > Why does the service appear all the bundles without setting a reference ?
> >
> > Thanks for your help.
> >
> > Regards.
> >
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Re: Camel EventNotifier as OSGi service

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

I guess you are using camel-blueprint, right ?

The EventNotifier service is in a dedicated bundle ?

Regards
JB

On 02/07/2019 10:40, Ephemeris Lappis wrote:
> Hello.
> 
> I've been trying to provide a org.apache.camel.spi.EventNotifier as a
> shared OSGi service.
> 
> When I instantiates a similar object as a bean in a bundle blueprint, the
> Camel context registers it and all events are received as expected.
> 
> If I try to expose the same kind of object as a service from another
> bundle, It seems that it is automatically added to all my Camel contexts in
> any bundle, masking all others EventNotifier created as simple beans, ans
> without using a service reference.
> 
> I expose it like that :
> 
> <bean
>     id="my.pure.service.bean"
>     class="my.tests.t13.spy.service.SpyPureService" />
> <service
>     id="my.spy.pure.service"
>     interface="org.apache.camel.spi.EventNotifier"
>     ref="my.pure.service.bean" />
> 
> Is it a normal behavior ?
> 
> Why does the service appear all the bundles without setting a reference ?
> 
> Thanks for your help.
> 
> Regards.
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com