|
Replies:
8
-
Last Post:
Feb 4, 2009 9:28 PM
by: sppugazh
|
|
|
|
|
|
|
Glassfish mbean for controlling MDB
Posted:
Jan 9, 2009 3:07 AM
|
|
|
Hi,
Is there any mbean interface with the functionality like controlling the MDB. My requirement is like the MDB consumes a queue but at times i might need to stop the MDB. Is there any other provision in glassfish to achieve this functionality.I found one document related to oc4j which has a mbean to control the mbean.
|
|
|
|
|
|
|
Re: Glassfish mbean for controlling MDB
Posted:
Jan 9, 2009 7:37 AM
in response to: sppugazh
|
|
|
"stop the mdb" -> if there are no messages in a queue it listens to, mdb is not "running". flushing (removing messages so mdb's can't pick them up) the queue is possible through JMX.
|
|
|
|
|
|
|
|
Re: Glassfish mbean for controlling MDB
Posted:
Jan 11, 2009 11:22 PM
in response to: mareks
|
|
|
Hi Mareks,
Flushing the queue will lead to data loss. I just need to control the mdb from reading the queue. While the mdb is stopped the users will still be putting messages to the queue.so i should not stop the queue from receiving the messages.Is there any other way to control the mdb. I am new to MBean strategy ,so please provide me all the feasible ways to control the ejb from mbean.
With regards, Pugazh sp
|
|
|
|
|
|
|
|
Re: Glassfish mbean for controlling MDB
Posted:
Jan 12, 2009 7:37 AM
in response to: sppugazh
|
 |
Helpful |
|
|
You can't stop MDB to consume messages.But you can stop Queue's.If queue is stoped MDB can't consume msg from Queue.
You can control your queue's by controlling by below commnad.
imqcmd pause dst -n MyQueue -t q -pst PRODUCERS|CONSUMERS|ALL imqcmd resume dst -n MyQueue -t q
you will find above coomand in below location: Go to : C:\<GLASSFISH_HOME>\imq\bin
Message was edited by: chalava
|
|
|
|
|
|
|
|
Re: Glassfish mbean for controlling MDB
Posted:
Jan 12, 2009 12:10 PM
in response to: chalava
|
|
|
...and as flushing the queue, pausing/resuming is also possible through JMX.
/mareks
|
|
|
|
|
|
|
|
Re: Glassfish mbean for controlling MDB
Posted:
Jan 13, 2009 12:49 AM
in response to: mareks
|
|
|
Hi,
Is there a way to stop the queue programatically and also to purge the messages in the queue programatically.If this is achievable please give some code snippets to achieve this.
With regards, Pugazh sp
|
|
|
|
|
|
|
|
Re: Glassfish mbean for controlling MDB
Posted:
Jan 13, 2009 7:36 AM
in response to: sppugazh
|
 |
Helpful |
|
|
/*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
|
|
|
|
|
|
|
|
Re: Glassfish mbean for controlling MDB
Posted:
Jan 22, 2009 9:35 PM
in response to: sppugazh
|
|
|
Thanks for all your support
|
|
|
|
|
|
|
|
Re: Glassfish mbean for controlling MDB
Posted:
Feb 4, 2009 9:28 PM
in response to: sppugazh
|
|
|
As Mareks suggested i tried the same. But it ended up throwing objectnot found exceptions. Is there any link which details in working with the mbean in controlling the resources like queue.
Thanks, Pugazh
|
|
|
|
|