ServiceMix
  1. ServiceMix
  2. SM-2269

ActiveMQ quick start doesn't work due to the missing activemq component

    Details

      Description

      The activemq sample described in quick start (http://servicemix.apache.org/docs/5.0.x/quickstart/activemq.html) doesn't work with ServiceMix 5.0.0. It looks like the activemq component is not registered. Adding one of the following snippets to both routes solves the problem

      <reference id="connectionFactory" interface="javax.jms.ConnectionFactory" />
      <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
              <property name="connectionFactory" ref="connectionFactory" />
      </bean>
      
      <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
              <property name="brokerURL" value="tcp://localhost:61616"/>
      	<property name="userName" value="smx"/>
      	<property name="password" value="smx"/>
      </bean>
      

      As described by user reporting this problem, the quick start works with ServiceMix 4.5.3 without additional registering of the activemq component.

      As described by the user, the camle-jms component must be also installed manually (in opposite to 4.5.3)

      We should solve these issues or update the quick start.

      Cfr. http://servicemix.396122.n5.nabble.com/ANNOUNCE-Apache-ServiceMix-5-0-0-released-td5719674.html for more information

      1. 0001-SM-2269-ActiveMQ-quick-start-doesn-t-work-due-to-the.patch.txt
        14 kB
        Krzysztof Sobkowiak
      2. 0001-SM-2269-install-camel-jms-component.patch
        2 kB
        Krzysztof Sobkowiak
      3. 0001-SM-2269-registering-activemq-component-in-activemq-s.patch
        3 kB
        Krzysztof Sobkowiak
      4. error-by-route-deploying.txt
        5 kB
        Krzysztof Sobkowiak
      5. SM-2269-update-quick-start.patch
        1 kB
        Krzysztof Sobkowiak

        Issue Links

          Activity

          Hide
          Gert Vanthienen added a comment -

          I already updated the quickstart guide so at least that guide just works for people who start using the project.
          We should however still try to fix the issue here, I think, and make using ActiveMQ and Camel together as easy as possible.

          Show
          Gert Vanthienen added a comment - I already updated the quickstart guide so at least that guide just works for people who start using the project. We should however still try to fix the issue here, I think, and make using ActiveMQ and Camel together as easy as possible.
          Hide
          Krzysztof Sobkowiak added a comment -

          Please remove the reference to connection factory from the quick start

          <reference id="connectionFactory" interface="javax.jms.ConnectionFactory" />
          

          I have copied too much into the initial version of the issue description. I have updated it. One of the configurations form the description should be used. The current version of quick start works too but the reference to connection factory is not necessary.

          Show
          Krzysztof Sobkowiak added a comment - Please remove the reference to connection factory from the quick start <reference id= "connectionFactory" interface = "javax.jms.ConnectionFactory" /> I have copied too much into the initial version of the issue description. I have updated it. One of the configurations form the description should be used. The current version of quick start works too but the reference to connection factory is not necessary.
          Hide
          Gert Vanthienen added a comment -

          Thanks for the update, Krzysztof! I removed the unnecessary lines now in http://svn.apache.org/viewvc?view=revision&revision=1581758.

          The source of these documentation pages is living in svn as well, cfr. http://servicemix.apache.org/developers/source/documentation-source.html, so you can also create patches for these kinds of changes if you want.

          Show
          Gert Vanthienen added a comment - Thanks for the update, Krzysztof! I removed the unnecessary lines now in http://svn.apache.org/viewvc?view=revision&revision=1581758 . The source of these documentation pages is living in svn as well, cfr. http://servicemix.apache.org/developers/source/documentation-source.html , so you can also create patches for these kinds of changes if you want.
          Hide
          Gert Vanthienen added a comment -

          As for the issue itself, there are two things we can do to make this easier:

          • install the camel-jms component out-of-the-box
          • add a preconfigured activemq: component to the activemq-config module we already have
          Show
          Gert Vanthienen added a comment - As for the issue itself, there are two things we can do to make this easier: install the camel-jms component out-of-the-box add a preconfigured activemq: component to the activemq-config module we already have
          Hide
          Krzysztof Sobkowiak added a comment -

          Did you mean activemq-service module? I think, this is not enough to add a activemq bean into the blueprint configuration, because it will be visible only in activemq-service.

          Show
          Krzysztof Sobkowiak added a comment - Did you mean activemq-service module? I think, this is not enough to add a activemq bean into the blueprint configuration, because it will be visible only in activemq-service .
          Hide
          Gert Vanthienen added a comment -

          Patch applied in http://svn.apache.org/viewvc?view=revision&revision=1582183
          Thanks for the patch, Krzysztof!

          Yeah, I meant the activemq-service module. Just creating the activemq bean there won't do the trick, but we should be able to register a org.apache.camel.spi.ComponentResolver that does.

          Show
          Gert Vanthienen added a comment - Patch applied in http://svn.apache.org/viewvc?view=revision&revision=1582183 Thanks for the patch, Krzysztof! Yeah, I meant the activemq-service module. Just creating the activemq bean there won't do the trick, but we should be able to register a org.apache.camel.spi.ComponentResolver that does.
          Hide
          Krzysztof Sobkowiak added a comment -

          I don't know this mechanism very well, but I can see, activemq-osgi bundle exports already this service

          karaf@root> ls 84
          
          activemq-osgi (84) provides:
          ----------------------------
          objectClass = org.osgi.service.cm.ManagedServiceFactory
          osgi.service.blueprint.compname = activeMQServiceFactory
          service.id = 290
          service.pid = org.apache.activemq.server
          ----
          objectClass = org.osgi.service.blueprint.container.BlueprintContainer
          osgi.blueprint.container.symbolicname = org.apache.activemq.activemq-osgi
          osgi.blueprint.container.version = 5.9.0
          service.id = 291
          ----
          component = activemq.journal, activemq, broker
          objectClass = org.apache.camel.spi.ComponentResolver
          service.id = 305
          ----
          objectClass = org.apache.camel.spi.TypeConverterLoader
          service.id = 306
          

          Does the bundle register this service because the bundle exposes some components by META-INF/services/org/apache/camel/component/ but from any reason the resolver can not provide these components?

          Show
          Krzysztof Sobkowiak added a comment - I don't know this mechanism very well, but I can see, activemq-osgi bundle exports already this service karaf@root> ls 84 activemq-osgi (84) provides: ---------------------------- objectClass = org.osgi.service.cm.ManagedServiceFactory osgi.service.blueprint.compname = activeMQServiceFactory service.id = 290 service.pid = org.apache.activemq.server ---- objectClass = org.osgi.service.blueprint.container.BlueprintContainer osgi.blueprint.container.symbolicname = org.apache.activemq.activemq-osgi osgi.blueprint.container.version = 5.9.0 service.id = 291 ---- component = activemq.journal, activemq, broker objectClass = org.apache.camel.spi.ComponentResolver service.id = 305 ---- objectClass = org.apache.camel.spi.TypeConverterLoader service.id = 306 Does the bundle register this service because the bundle exposes some components by META-INF/services/org/apache/camel/component/ but from any reason the resolver can not provide these components?
          Hide
          Krzysztof Sobkowiak added a comment - - edited

          I think, the activemq: component is registered in activemq-osgi bundle.

          When you deploy the original routes from quick start (without defining the activemq: component in the route configuration), you get an error form the attached file. If you try to use another component name (e,g, activemq1:). you don't get this error while deploying the route (but you get another error later)

          I have managed to register a activemq1: component in activemq-service bundle and I get the same error using the activemq1: component (like using the activemq: component)

          It means, the component is correctly registered, but it has a problem with login credentials from any reason.

          I have changed the route replacing activemq://events by activemq:queue:events?username=smx&password=smx and the routes work correctly.

          Show
          Krzysztof Sobkowiak added a comment - - edited I think, the activemq: component is registered in activemq-osgi bundle. When you deploy the original routes from quick start (without defining the activemq: component in the route configuration), you get an error form the attached file. If you try to use another component name (e,g, activemq1: ). you don't get this error while deploying the route (but you get another error later) I have managed to register a activemq1: component in activemq-service bundle and I get the same error using the activemq1: component (like using the activemq: component) It means, the component is correctly registered, but it has a problem with login credentials from any reason. I have changed the route replacing activemq://events by activemq:queue:events?username=smx&password=smx and the routes work correctly.
          Hide
          Krzysztof Sobkowiak added a comment -

          See attached patch which registers activemq: component in activemq-service bundle (I had to enable dynamic import for this bundle additionally, but I couldn't find out why)

          Probably we have to extend the org.apache.activemq.camel.component.ActiveMQComponent and pass the correct credentials

          Show
          Krzysztof Sobkowiak added a comment - See attached patch which registers activemq: component in activemq-service bundle (I had to enable dynamic import for this bundle additionally, but I couldn't find out why) Probably we have to extend the org.apache.activemq.camel.component.ActiveMQComponent and pass the correct credentials
          Hide
          Krzysztof Sobkowiak added a comment -

          The part about installing of camel-jms feature can be removed from quick start

          Show
          Krzysztof Sobkowiak added a comment - The part about installing of camel-jms feature can be removed from quick start
          Hide
          Gert Vanthienen added a comment -

          Registering our own, extended version of the ActiveMQComponent through the META-INF/services/... mechanism might work, but I don't think we have a way to control which of those activemq component instances gets picked first. We could call ours amq or something like that though to disambiguate.

          Looking at the classes in https://git-wip-us.apache.org/repos/asf?p=camel.git;a=tree;f=components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi;h=b8a18fcb1f4ebb64e016ae2feafbf5c5bec0d650;hb=camel-2.12.x, another solution would be to build a ComponentResolver implementation that we register in the OSGi Service Registry and have that point to a properly configured ActiveMQComponent instance.

          Show
          Gert Vanthienen added a comment - Registering our own, extended version of the ActiveMQComponent through the META-INF/services/... mechanism might work, but I don't think we have a way to control which of those activemq component instances gets picked first. We could call ours amq or something like that though to disambiguate. Looking at the classes in https://git-wip-us.apache.org/repos/asf?p=camel.git;a=tree;f=components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi;h=b8a18fcb1f4ebb64e016ae2feafbf5c5bec0d650;hb=camel-2.12.x , another solution would be to build a ComponentResolver implementation that we register in the OSGi Service Registry and have that point to a properly configured ActiveMQComponent instance.
          Hide
          Gert Vanthienen added a comment -

          For the quickstart, perhaps we should wait until we get 5.0.1 out before we remove that bit from the documentation? If we do that right now, we'll probably end up getting the same question again on the mailing list.

          Show
          Gert Vanthienen added a comment - For the quickstart, perhaps we should wait until we get 5.0.1 out before we remove that bit from the documentation? If we do that right now, we'll probably end up getting the same question again on the mailing list.
          Hide
          Krzysztof Sobkowiak added a comment -

          Waiting with the quickstart update until 5.0.1 is released is a good idea.

          Show
          Krzysztof Sobkowiak added a comment - Waiting with the quickstart update until 5.0.1 is released is a good idea.
          Hide
          Krzysztof Sobkowiak added a comment -

          I propose following solution:

          • a new module activemq-camel (org.apache.servicemix.activemq.camel as artifactId and Bundle-SymbolicName) which provides the activemq: component and is included in the activemq-service feature.
          • the module registers an implementation of ComponentResolver as a service. The module references the existing pooled ConnectionFactory (transacted=false) from the OSGi Registry and wires it into the ComponentResolver The wired ConnectionFactory is used to instantiate the new ActiveMQComponent created by the implementation of ComponentResolver

          I also propose to change the artifactId of the existing module activemq-service from activemq-service to org.apache.servicemix.activemq.service (which is more ServiceMix specific) to avoid eventual future conflicts of the Bundle-SymbolicName) with other bundles using the same Bundle-SymbolicName

          Show
          Krzysztof Sobkowiak added a comment - I propose following solution: a new module activemq-camel ( org.apache.servicemix.activemq.camel as artifactId and Bundle-SymbolicName ) which provides the activemq: component and is included in the activemq-service feature. the module registers an implementation of ComponentResolver as a service. The module references the existing pooled ConnectionFactory ( transacted=false ) from the OSGi Registry and wires it into the ComponentResolver The wired ConnectionFactory is used to instantiate the new ActiveMQComponent created by the implementation of ComponentResolver I also propose to change the artifactId of the existing module activemq-service from activemq-service to org.apache.servicemix.activemq.service (which is more ServiceMix specific) to avoid eventual future conflicts of the Bundle-SymbolicName ) with other bundles using the same Bundle-SymbolicName
          Hide
          Krzysztof Sobkowiak added a comment -

          Please review the attached patch before I push the commit

          Show
          Krzysztof Sobkowiak added a comment - Please review the attached patch before I push the commit
          Hide
          Gert Vanthienen added a comment -

          Just found your patch again while going through the open issues for 5.1.0 and 5.0.1 - this looks like it could work fine, I would remove the System.out.println(...) that's left in there somewhere, but other than that this looks good to me.

          Show
          Gert Vanthienen added a comment - Just found your patch again while going through the open issues for 5.1.0 and 5.0.1 - this looks like it could work fine, I would remove the System.out.println(...) that's left in there somewhere, but other than that this looks good to me.
          Hide
          Krzysztof Sobkowiak added a comment -

          Yes, of course. I have forgotten to remove this

          Show
          Krzysztof Sobkowiak added a comment - Yes, of course. I have forgotten to remove this
          Show
          Krzysztof Sobkowiak added a comment - Fixed in: 5.0.x – https://git-wip-us.apache.org/repos/asf?p=servicemix.git;a=commit;h=27b5f39ed5a727f4f54da28916bba1c8767aec95 5.1.x -- https://git-wip-us.apache.org/repos/asf?p=servicemix.git;a=commit;h=e34ee480460d3c891b8c18a615cec2c4a3036b4f 6.0.x – https://git-wip-us.apache.org/repos/asf?p=servicemix.git;a=commit;h=c6cb8ad0dcb9ce82515d82d1755914c75ed9d72a

            People

            • Assignee:
              Krzysztof Sobkowiak
              Reporter:
              Krzysztof Sobkowiak
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development