You sure can - the listeners have associated mbeans which you can start/stop. Check out the jboss.esb category under the jmx-console and it should be apparent what your listener is.
I think this is documented in the Services guide.
I was able to figure out how to use the MBeanServer and target my desired listener and then invoke the 'stop' action.
Works like a charm!!
Taking this to the next level ...
Any thoughts on how this can be accomplished in a clustered environment?
If I am running an instance of my ESB on each node in the cluster how would I shut them all down when errors are detected?
There's a few options here, but there's really no silver bullet that I know of.
I think what you have to do is cycle through each node in the cluster, and execute the mbean operation on it. There's a number of ways to do that :
- have all your nodes in the cluster register for JMX notifications, and then send them one and have a listener that shuts down the listener
- set up a service that listens to a JMS topic that shuts down the listener - your actions can notify the topic when you detect the error
- grab all the cluster addresses from JGroups and just run through them, shutting down the listener
I am also in a similar situtation, Can you please post the code snippet or point me to the documentation on how to stop/start an ESB listener.
Sure - if you go into the jmx-console (http://localhost:8080/jmx-console) and browse to the jboss.esb section, you should see MBeans for your listener (the listener-name will be specified in the MBean name)
That mbean contains a start and a stop method. You need to get the MBean (https://community.jboss.org/message/508925#508925) and then call the start or stop method.
Thank you very much, it worked. Here is what I did, just in case if anyone else is look for a code snippet.
MBeanServer mBeanServer = MBeanServerLocator.locateJBoss();
ObjectName mBeanObjectName = new ObjectName("jboss.esb:deployment=jbpm.esb,listener-name=JMS-DCQListener,service-category=JBossESB-Internal,service-name=JBpmCallbackService");
mBeanServer.invoke(mBeanObjectName, START, null, null); or
mBeanServer.invoke(mBeanObjectName, STOP, null, null);
Above snippet only works after server is started and MBeans are already loaded. I wanted to have the Jboss ESB Lister/mbean deployed in stopped state. I could find a solution, the work around i had was stop the listener/mbean as soon server is started.