You may want to refer to ConfigDestinationManager instead.
DestinationManager
Here's an example showing how to use DestinationManager to create a queue dynamically:
//MBean related imports:
import javax.management.MBeanServer;
import javax.management.MBeanServerInvocationHandler;
import javax.management.ObjectName;
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.mq.server.jmx.DestinationManagerMBean;
...
// target MBean: DestinationManager
ObjectName objectName = new ObjectName("jboss.mq:service=DestinationManager");
// find the local MBeanServer
MBeanServer server = MBeanServerLocator.locateJBoss();
// Get a type-safe dynamic proxy
DestinationManagerMBean mbean =
(DestinationManagerMBean)MBeanServerInvocationHandler.newProxyInstance(
server,
objectName,
DestinationManagerMBean.class,
false);
// Use the proxy to dynamically create a queue
// by providing the queue name and the JNDI location
mbean.createQueue("myUgatz", "queue/myUgatz");
Comments