-
1. Re: Should (core) FileConfiguration support normal queue definition?
clebert.suconic May 4, 2010 3:18 PM (in response to noer2b)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?
noer2b May 4, 2010 4:33 PM (in response to clebert.suconic)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...
<queues>
<queue name="queue.exampleQueue">
<address>queue.exampleQueue</address>
<durable>true</durable>
</queue>
</queues>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:
e.getElementsByTagName("queue");
< 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,
Rick
-
3. Re: Should (core) FileConfiguration support normal queue definition?
clebert.suconic May 4, 2010 4:54 PM (in response to noer2b)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?
jmesnil May 5, 2010 4:02 AM (in response to noer2b)1 of 1 people found this helpfulHi 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)
-
5. Re: Should (core) FileConfiguration support normal queue definition?
noer2b May 6, 2010 12:56 AM (in response to jmesnil)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.