-
1. Re: Programmatic way to control ESB listener from action pipeline?
tcunning Mar 4, 2012 8:11 AM (in response to dbuttery)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.
-
2. Re: Programmatic way to control ESB listener from action pipeline?
dbuttery Mar 5, 2012 4:23 PM (in response to tcunning)Thanks Tom!
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!!
Much appreciated,
-Dennis
-
3. Re: Programmatic way to control ESB listener from action pipeline?
dbuttery Mar 19, 2012 4:39 PM (in response to dbuttery)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?
Thanks again,
-Dennis
-
4. Re: Programmatic way to control ESB listener from action pipeline?
tcunning Mar 21, 2012 8:46 PM (in response to dbuttery)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
-
5. Re: Programmatic way to control ESB listener from action pipeline?
chmanosh Dec 18, 2012 12:37 AM (in response to dbuttery)Hi Dennis/Tom,
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.
Thanks
-
6. Re: Programmatic way to control ESB listener from action pipeline?
tcunning Dec 18, 2012 11:04 AM (in response to chmanosh)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)
Example :
jboss.esb:deployment=jbpm.esb,listener-name=JMS-DCQListener,service-category=JBossESB-Internal,service-name=JBpmCallbackService
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.
-
7. Re: Programmatic way to control ESB listener from action pipeline?
chmanosh Jan 8, 2013 11:01 AM (in response to tcunning)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.
Thanks
Manosh