4 Replies Latest reply on Jul 29, 2010 6:19 PM by Peter Chandler

    Help with network ActiveMQ Brokers.

    Peter Chandler Master

      I am trying to network/cluster two ActiveMQ Brokers. BrokerA & BrokerB

       

      In BrokerA activemq-broker.xml:

       

           <networkConnectors>
              <!-- Make a static connection to JMS Broker Host -->
              <networkConnector name="connection_to_BrokerB_out" uri="static://(tcp://BrokerB_Hostname:61626)"></networkConnector>
           </networkConnectors>
      

       

      In BrokerB activemq-broker.xml:

              <!-- The transport connectors ActiveMQ will listen to -->
              <transportConnectors>
                  <transportConnector name="remote_in_broker" uri="tcp://0.0.0.0:61626"></transportConnector> 
                  <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"></transportConnector>
                  <transportConnector name="stomp" uri="stomp://0.0.0.0:61613"></transportConnector>
              </transportConnectors>
      

       

      Start Both JMS Brokers A & B (on different hosts).

       

      I connect to BrokerB and create a consumer on topic X.

       

      I connect to BrokerA and produce/publish to topic X.

       

      BrokerB does not receive any messages on topic X?

       

      No Error in the log file?

       

      Any idea?

       

      ...

       

      After some time/effort I figured-out that: if you edit FUSE-ROOT/etc/activemq-broker.xml and restart Servicemix the edits/modifications are NOT applied? Is  activemq-broker.xml  cached somewhere (osgibundle:/META-INF/spring/*.xml)?

       

      I did the old remove the data directory trick and SeriveMix would not re-start? Something new in this release?

       

      The only way I could get it to work was to do a complete re-install, edit activemq-broker.xml then start servicemix. Is there way the have servicemix re-read/initialize activemq-broker.xml on a re-start?

       

      ...

       

      Did a little more analysis I have the follow line in my servicemix log:

      14:58:50,697 | INFO  | ExtenderThread-1 | XmlBeanDefinitionReader          | tory.xml.XmlBeanDefinitionReader  323 | Loading XML bean definitions from URL [bundleentry://65.fwk409971196/META-INF/spring/activemq-broker.xml]
      

       

      Looks like the activeMQ bundle (with enclosed: META-INF/spring/activemq-broker.xml)  is being cache in apache-servicemix-4.2.0-fuse-02-00/data/cache/org.eclipse.osgi/bundles/65/1/bundlefile. How do I tell servicemix to rebuild/deploy activeMQ bundle using apache-servicemix-4.2.0-fuse-02-00/etc/activemq-broker.xml?

       

      Peter.

       

      Edited by: pchandler on Jul 23, 2010 5:28 PM

       

      Edited by: pchandler on Jul 26, 2010 7:20 PM

        • 1. Re: Help with network ActiveMQ Brokers.
          Gary Tully Novice

          >osgi:uninstall osgi:list will give u the bundle id

           

          A spring xml configuration file is auto bundled into a jar for osgi deployment so the uninstall/reinstall of the auto generated bundle should do it.

          • 2. Re: Help with network ActiveMQ Brokers.
            Peter Chandler Master

            Sorry didn't work. Somehow on the initial start of servicemix a bundle is created from the information in the etc directory and placed in data/cache/org.eclipse.osgi/bundles. So the question is: How to you update/re-initialize data/cache/org.eclipse.osgi/bundles directory at runtime?

             

            My understanding is that you can only osgi:install_ osgi bundles not XML files.

             

             
            karaf@root&gt; list | grep active
            [  55|http://fusesource.com/forums/] [Active     |http://fusesource.com/forums/] [            ] [       ] [   60|http://fusesource.com/forums/] activemq-core (5.3.1.fuse-02-00)
            [  56|http://fusesource.com/forums/] [Active     |http://fusesource.com/forums/] [            ] [       ] [   60|http://fusesource.com/forums/] activemq-ra (5.3.1.fuse-02-00)
            [  57|http://fusesource.com/forums/] [Active     |http://fusesource.com/forums/] [            ] [       ] [   60|http://fusesource.com/forums/] activemq-console (5.3.1.fuse-02-00)
            [  58|http://fusesource.com/forums/] [Active     |http://fusesource.com/forums/] [            ] [       ] [   60|http://fusesource.com/forums/] activemq-pool (5.3.1.fuse-02-00)
            [  65|http://fusesource.com/forums/] [Active     |http://fusesource.com/forums/] [            ] [Started|http://fusesource.com/forums/] [   60|http://fusesource.com/forums/] activemq-broker.xml (0.0.0)
            karaf@root&gt; osgi:uninstall 65
            karaf@root&gt; osgi:install file:///dirroot/home/hostname/1/username/programs/apache-servicemix-4.2.0-fuse-02-00/etc/activemq-broker .xml
            org.eclipse.osgi.service.pluginconversion.PluginConversionException: Could not find a META-INF/MANIFEST.MF, plugin.xml or a fragment.xml in /dirroot/home/hostname/1/username/programs/apache-servicemix-4.2.0-fuse-02-00/data/cache/org.eclipse.osgi/bundles/191/1/bundlefile.
            karaf@root&gt;
            

             

            • 3. Re: Help with network ActiveMQ Brokers.
              Gert Vanthienen Novice

              L.S.,

               

              In ServiceMix 4, the etc/activemq-broker.xml is not monitored for changes (only the files in the deploy folder are).  When the file is being installed in the container, the single XML file is transformed into an OSGi bundle and that bundle is installed in the OSGi environment.  On subsequent runs, the OSGi platform just reads the bundle out of its bundle cache instead of generating the bundle again.

               

              In order to force the bundle to get regenerated, you can run the

              osgi:update <activemq-broker.xml bundle id>

              command.  That will update the bundle information from the original location.

               

              Deleting everything in the data directory should work as well, because that would remove the entire bundle cache.  I'm not sure what happened there for you, but if you can reproduce that problem, feel free to raise a JIRA issue for it so we can look into it.

               

              BTW, if you want to use

              osgi:uninstall
              osgi:install -s <uri>

              you have to use a special uri like

              spring:file:etc/activemq-broker.xml

              with the spring: scheme to trigger the spring-to-bundle-transformation to happen for the file specified after that.

               

               

              Regards,

               

              Gert

              • 4. Re: Help with network ActiveMQ Brokers.
                Peter Chandler Master

                Gert,

                 

                Thanks, that worked!

                 

                The osgi:update command will re-initialize (force the bundle to get regenerated for the original location i.e. etc directory) ActiveMQ in ServiceMix.  

                 

                Example:

                osgi:update --force 65
                

                 

                Peter.