问题
I need to programmatically stop a Message-driven bean from receiving messages from a JMS queue.
My environment is WebSphere Application Server v7.
I think it could be done by some MBean operation on an Activation Specification MBean, but I can't locate the activationSpec using WebSphere's adminclient API.
I've browsed the JMX tree using JConsole and also tried printing out every available MBean and searching for the name of the activationspec. It's nowhere to be found.
Is this the right approach and what am I missing?
Could the MDB be stopped in any other way?
Thanks!
回答1:
You need to find the right J2CMessageEndpoint and deactivate it. Look here :
Managing the message endpoint lifecycle using wsadmin scripting
J2CMessageEndpoint MBean
Although the first link talks about wsadmin scripting you can do anything from java code as well.
来源:https://stackoverflow.com/questions/8819169/stop-mdb-from-receiving-messages