Uploaded image for project: 'ServiceMix'
  1. ServiceMix
  2. SM-2183

Provide JMS ConnectionFactory in the OSGi Service Registry

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.0
    • Fix Version/s: 5.0.0
    • Component/s: assemblies
    • Labels:
      None

      Description

      The new OSGi implementation of ActiveMQ no longer provides a javax.jms.ConnectionFactory service in the OSGi Service Registry.

      We should provide a small glue bundle for
      ActiveMQ (similar to what we do for Activiti) that provides these
      extra services to the container:

      • a plain JMS ConnectionFactory to be used by routes and e.g. by our
        own JMS appender
      • an XA ConnectionFactory that has already been configured to interact
        with the Aries JTA provider we also ship

      Cfr. http://servicemix.396122.n5.nabble.com/smx5-jms-appender-td5716215.html for some background on this issue

      1. SM-2183.patch.txt
        15 kB
        filippo balicchia

        Issue Links

          Activity

          Hide
          gertvanthienen Gert Vanthienen added a comment -

          Fixed in http://svn.apache.org/viewvc?view=revision&revision=1572938
          Thanks to Filippo for the patch!

          Show
          gertvanthienen Gert Vanthienen added a comment - Fixed in http://svn.apache.org/viewvc?view=revision&revision=1572938 Thanks to Filippo for the patch!
          Hide
          fbalicchia filippo balicchia added a comment - - edited

          Please see the patch:
          it includes a little module for register javax.jms.ConnectionFactory in service registry.

          	<cm:property-placeholder persistent-id="org.apache.activemq.server-default" update-strategy="reload">
                  <cm:default-properties>
                      <cm:property name="broker-name" value="amq-broker"/>
                  </cm:default-properties>
              </cm:property-placeholder>
          
              <bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
                  <property name="brokerURL" value="vm://${broker-name}?create=false&amp;waitForStart=10000" />
              </bean>
          
              <bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory">
                  <property name="maxConnections" value="8" />
                  <property name="connectionFactory" ref="activemqConnectionFactory" />
              </bean>
          
          
              <reference id="recoverableTxManager" interface="org.apache.geronimo.transaction.manager.RecoverableTransactionManager" availability="mandatory" />
              
              
              <!--
                  Register the javax.jms.ConnectionFactory in the OSGi Service Registry
              -->
          
              <service ref="pooledConnectionFactory" interface="javax.jms.ConnectionFactory">
                  <service-properties>
                      <entry key="name" value="localhost"/>
                  </service-properties>
              </service>
          </blueprint>
          

          the patch include
          -upgrade to activemq-5.9.0
          -upgrade to camel-2.13-SNAPSHOT

          end feature cfg for apache-servicemix and apache-servicemix-full distribution.
          I don't know if persistent-id is the best choice but can be change

          Any feedBack are wellcome

          Show
          fbalicchia filippo balicchia added a comment - - edited Please see the patch: it includes a little module for register javax.jms.ConnectionFactory in service registry. <cm:property-placeholder persistent-id= "org.apache.activemq.server-default" update-strategy= "reload" > <cm:default-properties> <cm:property name= "broker-name" value= "amq-broker" /> </cm:default-properties> </cm:property-placeholder> <bean id= "activemqConnectionFactory" class= "org.apache.activemq.ActiveMQConnectionFactory" > <property name= "brokerURL" value= "vm://${broker-name}?create=false&amp;waitForStart=10000" /> </bean> <bean id= "pooledConnectionFactory" class= "org.apache.activemq.pool.PooledConnectionFactory" > <property name= "maxConnections" value= "8" /> <property name= "connectionFactory" ref= "activemqConnectionFactory" /> </bean> <reference id= "recoverableTxManager" interface= "org.apache.geronimo.transaction.manager.RecoverableTransactionManager" availability= "mandatory" /> <!-- Register the javax.jms.ConnectionFactory in the OSGi Service Registry --> <service ref= "pooledConnectionFactory" interface= "javax.jms.ConnectionFactory" > <service-properties> <entry key= "name" value= "localhost" /> </service-properties> </service> </blueprint> the patch include -upgrade to activemq-5.9.0 -upgrade to camel-2.13-SNAPSHOT end feature cfg for apache-servicemix and apache-servicemix-full distribution. I don't know if persistent-id is the best choice but can be change Any feedBack are wellcome
          Hide
          gertvanthienen Gert Vanthienen added a comment -

          There's a related JIRA issue on the ActiveMQ project.

          Show
          gertvanthienen Gert Vanthienen added a comment - There's a related JIRA issue on the ActiveMQ project.
          Hide
          gertvanthienen Gert Vanthienen added a comment -

          Thanks to Raul for taking a stab at this one!

          Show
          gertvanthienen Gert Vanthienen added a comment - Thanks to Raul for taking a stab at this one!
          Hide
          gertvanthienen Gert Vanthienen added a comment -

          The missing ConnectionFactory also causes problems installing some of the examples:

          karaf@root> features:install examples-activemq-camel-blueprint 
          Error executing command: Can not resolve feature:
          Unsatisfied requirement(s):
          ---------------------------
             service:(service=javax.jms.ConnectionFactory)
                Apache ServiceMix :: Examples :: ActiveMQ Camel Blueprint
          
          Show
          gertvanthienen Gert Vanthienen added a comment - The missing ConnectionFactory also causes problems installing some of the examples: karaf@root> features:install examples-activemq-camel-blueprint Error executing command: Can not resolve feature: Unsatisfied requirement(s): --------------------------- service:(service=javax.jms.ConnectionFactory) Apache ServiceMix :: Examples :: ActiveMQ Camel Blueprint
          Hide
          gertvanthienen Gert Vanthienen added a comment - - edited

          @Filippo: Thanks for working on this! Personally, I would prefer a solution that does not replace ActiveMQ's own OSGi bootstrap mechanism, I think. Perhaps we could look at the JMX MBean and expose those connections for any broker that gets registered there or read the broker-name value from the Configuration Admin service or something like that?

          I'd consider that a workaround for this release. For a next version, we probably want to get in touch with the ActiveMQ team to see if activemq-osgi can publish some extra information about the brokers it creates to the OSGi Service Registry so we can react to that instead

          Show
          gertvanthienen Gert Vanthienen added a comment - - edited @Filippo: Thanks for working on this! Personally, I would prefer a solution that does not replace ActiveMQ's own OSGi bootstrap mechanism, I think. Perhaps we could look at the JMX MBean and expose those connections for any broker that gets registered there or read the broker-name value from the Configuration Admin service or something like that? I'd consider that a workaround for this release. For a next version, we probably want to get in touch with the ActiveMQ team to see if activemq-osgi can publish some extra information about the brokers it creates to the OSGi Service Registry so we can react to that instead
          Hide
          fbalicchia filippo balicchia added a comment -

          This is a very premature solution for use activemq in servicemix 5 but my goal is to get some feedback about what people aspect from this issue.

          At the moment this works for me and the example run well.

          The first doubt that comes to me is that in with activemq 5.8.0 I see that was released a new artifact called activemq-osgi and probably people want to reuse that, and the solution that i proposed is can be replaced with an extensions of that artifact

          Anyway,
          suggestions, feedback are wellcome for me

          Thanks

          Show
          fbalicchia filippo balicchia added a comment - This is a very premature solution for use activemq in servicemix 5 but my goal is to get some feedback about what people aspect from this issue. At the moment this works for me and the example run well. The first doubt that comes to me is that in with activemq 5.8.0 I see that was released a new artifact called activemq-osgi and probably people want to reuse that, and the solution that i proposed is can be replaced with an extensions of that artifact Anyway, suggestions, feedback are wellcome for me Thanks

            People

            • Assignee:
              gertvanthienen Gert Vanthienen
              Reporter:
              gertvanthienen Gert Vanthienen
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development