[jboss-user] [JBoss Messaging] - Re: How to create persistent queues on the fly

jbmuser do-not-reply at jboss.com
Wed Jun 24 02:08:56 EDT 2009

"jbmuser" wrote : Hi Jeff,
  | Thank you for the quick response. 
  | I created a queue from JConsole using the operation "createQueue" of MBean "org.jboss.messaging:module=JMS,type=Server" and restarted the server. The queue disappeared after the server restart.
  | My understanding is that, if the queue is really durable and the issue is only with JNDI binding, then I should see the queue from JConsole even after server restart. Please advise. 
  | Thanks in advance.
  | Bijith Kumar

"jmesnil" wrote : How does the problem occur? Do you have an exception when looking up the queue in JNDI?
  | There is a bug in the creation of JMS queue using the management API.
  | The underlying core queue is durable and messages will survive server restart but when the server is restarted, the JMS queue is not bound to JNDI and can not be looked up.
  | We will fix the bug. In the meantime, a possible workaround for you is to always recreate the queue when the server is restarted using the management API. The 1st time, it will create the queue, the other times, the queue won't be created (it already exists) but the queue will be bound to JNDI again.
  | Tell us if this workaround works for you.

Hi Jeff,
Just created a persistent queue successfully using management API. The issue is that, even though the queues survive server restart (i.e. they ARE persistent) but wouldn't show up in JConsole after restart. I am able to obtain the reference of the queue and consume the pending messages even though the queue is not visible in JConsole. It seems the queues become sort of 'invisible' after restart. Btw, I noticed that BETA3 has changed some interfaces in management API. Below given is the new code snippet in case it helps anyone.

private static final String JMX_URL = "service:jmx:rmi:///jndi/rmi://localhost:3000/jmxrmi";
  | JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), new HashMap());
  | 		         MBeanServerConnection mbsc = connector.getMBeanServerConnection();
  | 		         ObjectName name=new ObjectName("org.jboss.messaging:module=JMS,type=Server");
  | 		         JMSServerControl control = (JMSServerControl)MBeanServerInvocationHandler.newProxyInstance(mbsc,name,JMSServerControl.class,false);
  | 		         control.createQueue("TestQ", "TestQ");	

Bijith Kumar

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4239607#4239607

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4239607

More information about the jboss-user mailing list