users@glassfish.java.net

Re: Glassfish mbean for controlling MDB

From: <glassfish_at_javadesktop.org>
Date: Tue, 13 Jan 2009 07:36:43 PST

/*create JMXServiceURL object. JMX url can be retrieved by "imqcmd list jmx" command*/
JMXServiceURL url = new JMXServiceURL(".....mq jmx url.....");

/*create JMXConnector object, where environment is a String[] array containing username and password used to access MessageQueue server JMX*/
JMXConnector jmxc = JMXConnectorFactory.connect(url, environment);

/*create MBeanServerConnection and ObjectName for Your queue/topic*/
MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
ObjectName destMgrConfigName = MQObjectName.createDestinationConfig(DestinationType.QUEUE, "yourQueueName");
String [] signature = null;
Object [] params = null;

/*this is where You invoke actual method. here "purge" is used. same thing goes for "pause" and other available*/
mbsc.invoke(destMgrConfigName, "purge", params, signature);
jmxc.close();


More on this:

http://docs.sun.com/app/docs/doc/820-6766?l=en&q=Sun+Java+System+Message+Queue+4.3

/mareks
[Message sent by forum member 'mareks' (mareks)]

http://forums.java.net/jive/thread.jspa?messageID=325556