2 Replies Latest reply on Aug 16, 2012 4:55 AM by Andy Taylor

    Easiest Way Create Queue Dynamically from MDB?

    Marc Zbyszynski Newbie

      I have an application that is running on JBoss as 7.1.1.Final and uses Hornetq as a stomp server for two-way communication with a number of devices. Right now I'm trying to build an MDB that responds to a "registration" queue. Each device sends it's id to the registration queue when it is first activated, and the MDB has to create a new jms Queue based on that supplied id for the device to listen to to receive subsequent messages back to the server.


      However, I'm having some trouble figuring out the right way to access the management API to create the durable queue from inside an MDB. All the examples I've seen for using the management API revolved around connecting to hornetq remotely (either via the jms interface or the jmx interface). I've tried figure out a way to get an instance of the JMSServerController from within MDB, but I haven't been able to get it to work. I also can't seem to get a reference to the hornetq.management queue using @Resource() or HornetQJMSClient.createQueue("hornetq.management").

      It seems like this would be a fairly common thing that someone might want to do... But I've been searching around all day and I haven't found an solution that works for me. My apologies if I've missed something obvious, but does anyone have any idea how I might be able to create a durable queue from within a message driven bean?


      Or is there another approach that people usually take to solving this type of two-way messaging (selectors maybe... Althought I'm not sure if HornetQ's stomp server integration supports those).