5 Replies Latest reply on May 6, 2010 12:56 AM by Richard Berman

    Should (core) FileConfiguration support normal queue definition?

    Richard Berman Newbie

      HornetQ looks great.  I particularly like that I can dispense with the weight/formality of JMS and get great reliable messaging.


      I started out evaluating HornetQ (2.0.0.GA) with a core embedded server configured programmatically.  I've been trying to move the configuration to an xml document.  It's all working great except that my queue isn't getting defined.  On page 90 of the PDF User Manual, it says "a queue can be predefined at a core level in the hornetq-configuration.xml file".  The hornetq-configuration.xsd clearly allows the <queues> element.


      I've looked in FileConfiguration (in my 2.0.0 copy and in SVN for the trunk or HornetQ_2_1_0_Beta3) and don't see any attempt to collect the queues element from the XML document and make QueueConfiguration instances.  The only queue support I see there is for the references in bridge and cluster configuration.


      I get my queue when I programmatically add a QueueConfiguration to my Configuration after "start()" and before using it in a call to HornetQServers.newHornetQServer().  So it seems like it's just the FileConfiguration that's missing support for this.


      Am I confused or should I file a bug?



        • 1. Re: Should (core) FileConfiguration support normal queue definition?
          Clebert Suconic Master

          I'm a little confused in what you're trying to do.



          I see FileConfiguration parsing the queue definitions.



          It seems you're embedding HornetQ. Maybe a few lines of code explaining what you're not being able to do would help better here.

          • 2. Re: Should (core) FileConfiguration support normal queue definition?
            Richard Berman Newbie

            Thanks Clebert.  Yes.  I'm definitely embedding.  I'll put together a whole (small) example.  Probably not until tonight though.  My exploration code has some extraneous stuff I'll eliminate before submitting.


            At the high level... I have one queue defined in my config file...


                  <queue name="queue.exampleQueue">


            After invoking configuration.start(), the List<QueueConfiguration> returned from configuration.getQueueConfigurations() is empty.  Looking inside start(), I see Element e = org.hornetq.utils.XMLUtil.stringToElement(xml); parsing the xml.  It's definitely in the DOM.  What I don't see is anything processing the DOM to pull it out.  For instance, with:




            < and then code to extract subelements and make the QueueConfiguration(s) >


            Code like this is present for "acceptor", "connector" and several other list member portions of the config file schema.


            Thanks again,


            • 3. Re: Should (core) FileConfiguration support normal queue definition?
              Clebert Suconic Master

              We have done some changes with the latest trunk (For 2.1.0). You should maybe take a look on trunk and see how it behaves before submitting your example.

              • 4. Re: Should (core) FileConfiguration support normal queue definition?
                Jeff Mesnil Master

                Hi Richard,


                you encountered a bug that was fixed in 2.1.0.BETA2 https://jira.jboss.org/jira/browse/HORNETQ-352


                Queues configured in the XML files are deployed when starting HornetQServerImpl server provided file deployment is enabled

                (see HornetQServerImpl.initilalisePart2() circa line 1060)

                1 of 1 people found this helpful
                • 5. Re: Should (core) FileConfiguration support normal queue definition?
                  Richard Berman Newbie

                  Thanks Clebert,


                  I grabbed the trunk and built from that.  Looking more carefully at the code in FileConfiguration, I see the parsing and processing of the queue definition.  My test program confirms that the definition is in the configuration after start() completes.


                  Thanks Jeff,


                  It's great to have confirmation that this was an issue and has been fixed.


                  I did have a minor surprise when running my test program all the way thru.  As noted, the queue config was loaded.  However, I still got an exception because the queue didn't exist.  A bit more digging and here's what I found...


                  Since I'm loading a FileConfiguration, the default value for the fileDeploymentEnabled property is true (FileConfigurationParser.parseMainConfig circa line 159).  I didn't have an explicit declaration of this element in my config file so it took the default.


                  In HornetQServerImpl.initilalisePart2() circa line 1060 where you suggested I look, it checks the fileDeploymentEnabled property.  If enabled, it uses the QueueDeployer.  If not, it uses what's in the configuration.  The QueueDeployer looks hardwired to use files named "hornetq-configuration.xml", "hornetq-queues.xml" (in QueueDeployer.getDefaultConfigFileNames() circa line 89).  I'm not using the default config file names so it couldn't load either and so had no queues so my queue never got deployed.


                  I added <file-deployment-enabled>false</file-deployment-enabled> to my config file and it skips the QueueDeployer and uses what it had already loaded.  At that point, my test program ran fine.


                  Just a thought... Maybe the QueueDeployer shouldn't have too many expectations about the file names to load.  If the FileConfiguration were able to accept a list/array of urls rather than just one there wouldn't be a need to have the QueueDeployer choosing its own to load.  If nothing else, it would save loading the file again (at least at startup) just to parse the queues that were in the config file already loaded.


                  Thanks again.  I'm looking forward to the rest of my evaluation of HornetQ.