Hello again.

As it seems I have no solution to get an implicit connection factory, I've
adapted my POC setting myself a reference. But it seems that it doesn't
work because the service that is created by the jms:create command doesn't
match some class definition.

In my POC's code I've added a dependency javax.jms-api version 2.0 to match
the API version that the bundle that is deployed is providing.
karaf@root()> exports | grep javax.jms
javax.jms.doc-files                                    │ 2.0.0       │ 83
 │ javax.jms-api
javax.jms                                              │ 2.0.0       │ 83
 │ javax.jms-api

In my blueprints I've added the service reference, and used it on my JMS
routes :
 <reference
    id="myJMS"
    interface="javax.jms.ConnectionFactory"
    availability="mandatory" />

<from uri="jms:queue:k1-test-queue-1?connectionFactory=#myJMS" />

My bundle's manifest imports the correct package and service :
Import-Package: javax.jms;version="[2.0,3)",my.test.t26.helper;version
 ="[0.0,1)",my.test.t26.uow;version="[0.0,1)",org.osgi.service.bluepri
 nt;version="[1.0.0,2.0.0)"
Import-Service: javax.jms.ConnectionFactory;multiple:=false,my.test.t2
 6.helper.Helper;multiple:=false,my.test.t26.uow.CustomUnitOfWorkFacto
 ry;multiple:=false

The service seems to be present on Karaf :

karaf@root()> jms:connectionfactories
JMS Connection Factory
──────────────────────
jms/my_amq

and with service:list :

[javax.jms.ConnectionFactory]
-----------------------------
 name = my_amq
 osgi.jndi.service.name = jms/my_amq
 password = secret
 pax.jms.managed = true
 service.bundleid = 93
 service.factoryPid = org.ops4j.connectionfactory
 service.id = 147
 service.pid =
org.ops4j.connectionfactory.4d276d00-2c50-49b0-93f9-18dc16a107ce
 service.scope = singleton
 type = activemq
 url = tcp://localhost:61616
 user = application
Provided by :
 OPS4J Pax JMS Config (93)
Used by:
 System Bundle (0)

[javax.management.MBeanRegistration,
org.apache.karaf.features.management.FeaturesServiceMBean,
javax.management.NotificationEmitter,
javax.management.NotificationBroadcaster, javax.management.DynamicMBean,
javax.management.MBeanRegistration]

But when installing my feature, the services do not match, and I have the
following error :( !!!

Unable to resolve root: missing requirement [root] osgi.identity;
osgi.identity=my-test-26-karaf-2-routes; type=karaf.feature;
version="[0.0.1.SNAPSHOT,0.0.1.SNAPSHOT]";
filter:="(&(osgi.identity=my-test-26-karaf-2-routes)(type=karaf.feature)(version>=0.0.1.SNAPSHOT)(version<=0.0.1.SNAPSHOT))"
[caused by: Unable to resolve my-test-26-karaf-2-routes/0.0.1.SNAPSHOT:
missing requirement [my-test-26-karaf-2-routes/0.0.1.SNAPSHOT]
osgi.identity; osgi.identity=my-test-26-karaf-2-routes; type=osgi.bundle;
version="[0.0.1.SNAPSHOT,0.0.1.SNAPSHOT]"; resolution:=mandatory [caused
by: Unable to resolve my-test-26-karaf-2-routes/0.0.1.SNAPSHOT: missing
requirement [my-test-26-karaf-2-routes/0.0.1.SNAPSHOT] osgi.service;
effective:=active; filter:="(objectClass=javax.jms.ConnectionFactory)"]]

I thought it may come from the class origin, but only one bundle seems to
export it. So I tried to find the issue elsewhere...

Inspecting the ActiveMQ OSGi bundle :
 52 │ Active   │  80 │ 5.17.1             │ ActiveMQ :: OSGi bundle

I saw that it also gets the class, but doesn't export it :

karaf@root()> bundle:classes 52 | grep javax.jms.ConnectionFactory
javax/jms/ConnectionFactory.class | exported: false

Can I deduce that the JMS connection factory service may have been created
using a bad class from a private package, and this may be the reason why it
doesn't match my reference, and perhaps why the camel-jms component doesn't
detect it ?

With previous versions of ActiveMQ I think it was working...

Thanks a lot for your help.

Regards.


Le lun. 22 août 2022 à 07:01, Jean-Baptiste Onofré <j...@nanthrax.net> a
écrit :

> Hi,
>
> here's the documentation about camel-activemq:
> https://camel.apache.org/components/3.18.x/activemq-component.html
>
> About the ConnectionFactory, you have to define it as reference in
> your route. You can find an example here:
>
>
> https://github.com/jbonofre/camel-amq-redelivery/blob/master/src/main/resources/OSGI-INF/blueprint/route.xml
>
> https://github.com/jbonofre/camel-amq-redelivery/blob/master/src/main/resources/OSGI-INF/blueprint/connectionfactory.xml
>
> Regards
> JB
>
> On Sun, Aug 21, 2022 at 10:22 AM Ephemeris Lappis
> <ephemeris.lap...@gmail.com> wrote:
> >
> > Hello.
> >
> > I've never seen any documentation about "camel-activeemq" : what's the
> > feature that provides it ?
> >
> > As I've said before, I've been trying to use camel-jms but surprisingly
> > my unique connection factory is not detected, and the component asks for
> > an explicit declaration. I thought that one unique connection factory
> > should be taken into account... I've created a unique connection factory
> > using "jms:create" connecting to an external ActiveMQ, and I've checked
> > that the service is present declaring the right interface. Is there a
> > special way of declaring or naming the connexion factory to make it
> > available for routes with camel-jms endpoints ?
> >
> > Thanks a lot for your help.
> >
> > Regards.
> >
> > Ephemeris Lappis
> >
> > Le 21/08/2022 à 08:12, Jean-Baptiste Onofré a écrit :
> > > That's correct: activemq-camel has been removed.
> > >
> > > You can now use camel-jms (recommended) or camel-activeemq.
> > >
> > > You can wrap your own component if needed, but I would rather update
> > > to camel-jms (not so hard to do).
> > >
> > > Regards
> > > JB
> > >
> > > On Fri, Aug 19, 2022 at 12:33 PM Ephemeris Lappis
> > > <ephemeris.lap...@gmail.com> wrote:
> > >> Hello.
> > >>
> > >> I've been working before on ActiveMQ 5.16.5, but as this version
> leads to
> > >> too many problems on Karaf 4.4.1 (spring compatibility among other
> issues),
> > >> I've decided to switch to ActiveMQ 5.17.1.
> > >>
> > >> Before, I think the component camel-activemq was provided by the
> feature
> > >> activemq-camel, but with 5.17.1 it doesn't appear anymore in this
> feature,
> > >> if I'm not wrong...
> > >>
> > >> I've also tried as you suggested to use the jms component in my
> routes, but
> > >> the connection factory I've created to connect to my ActiveMQ server
> is not
> > >> taken into account by the component that requires an explicit
> connection
> > >> factory... Changing all our about 100 camel projects to change from
> > >> activemq to jms and declare a connection factory reference seems to
> be a
> > >> very bad choice for us...
> > >>
> > >> So, from both sides I've issues.
> > >>
> > >> Any idea to get out of this sad situation 😥 ?
> > >>
> > >> Thanks a lot !
> > >>
> > >> Regards.
> > >>
> > >> PS: Perhaps the documentation on the component should say that it's
> > >> available "Since Camel 1.0" but also only with restriction after a
> given
> > >> version...
> > >>
> > >>
> > >> Le ven. 19 août 2022 à 11:51, Claus Ibsen <claus.ib...@gmail.com> a
> écrit :
> > >>
> > >>> camel-activemq is not out of the box in Apache Camel in Camel v2.
> > >>> It comes from Apache ActiveMQ 5.x instead.
> > >>>
> > >>> However starting from ActiveMQ 5.17 then they dropped their
> camel-activemq
> > >>> JAR and its no longer available.
> > >>> Instead use the generic camel-jms instead. Or go back to ActiveMQ
> 5.16.x
> > >>>
> > >>> In the Camel website make sure to browse the components list for the
> Camel
> > >>> version you use. The list is different per version.
> > >>>
> > >>>
> > >>> On Fri, Aug 19, 2022 at 11:35 AM Ephemeris Lappis <
> > >>> ephemeris.lap...@gmail.com> wrote:
> > >>>
> > >>>> Hello.
> > >>>>
> > >>>> I've already asked the question, but probably not clearly...
> > >>>>
> > >>>> I don't understand why I can't resolve the dependency for :
> > >>>> org.apache.camel:camel-activemq:jar:2.25.4
> > >>>>
> > >>>> I used this component for a long time on old servicemix
> environments,
> > >>>> and I'm trying to port my projects to Karaf using Camel 2.25.4 (and
> > >>>> ActiveMQ 5.17.1).
> > >>>>
> > >>>> The component is still documented on the Camel components list, but
> I
> > >>>> can't find it.
> > >>>>
> > >>>> Any help ?
> > >>>>
> > >>>> Thanks in advance.
> > >>>>
> > >>>> Regards.
> > >>>>
> > >>>
> > >>> --
> > >>> Claus Ibsen
> > >>> -----------------
> > >>> http://davsclaus.com @davsclaus
> > >>> Camel in Action 2: https://www.manning.com/ibsen2
> > >>>
> >
> > --
> > Cet e-mail a été vérifié par le logiciel antivirus d'Avast.
> > www.avast.com
>

Reply via email to