This is a repost as I'm still searching for this howto.

Does anyone happen to have or know of an example�to�creating a destination (either topic or queue) on the fly as stated in http://www.jboss.org/online-manual/HTML/ch08s07.html�?


What's stated (or lack of) in the docs leaves many questions open to what I might be doing wrong and�I only found one example in the code of JBoss itself and this didn't seem to fit what the docs say.

Any help much appreciated.

--- snip ---�

�� MBeanServer server = (MBeanServer)�MBeanServerFactory.findMBeanServer(null).iterator().next();
�� server.invoke(new ObjectName("JBossMQ", "service", "Server"),�"createQueue", new Object[] { bInfo.getNodeName() },�new String[] {"java.lang.String"});

�� context = new InitialContext();

�� connectionFactory = (QueueConnectionFactory)
���context.lookup("QueueConnectionFactory");


���connection = connectionFactory.createQueueConnection();

���session = connection.createQueueSession(false,�Session.AUTO_ACKNOWLEDGE);

�� // really not sure if I still use the "queue/" prefix and how to grab the new queue
�� // or if any of this is still to be done ...
���queue = (Queue)context.lookup("queue/" + bInfo.getNodeName());

���sender = session.createSender(queue);

���ObjectMessage message = session.createObjectMessage();
���message.setObject(bInfo);


���sender.send(queue, message);
...

Reply via email to