Question


BNY Mellon
US
Last activity: 2 May 2016 15:03 EDT
How to control Listeners from within Java
Business need is to turn off listeners programatically. Seems like an agent would be the straightforward way to do this.
We can control agents via PublicAPI.getAgentUtils() -- see AgentManager - How to programatically manage bulk init/start/stop of Agents
Is there no analogue for Listeners?
Otherwise do we have to create the kludgey jmx pipes to do this.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!


there is a private API method executeMbeanOperation. See activity executeMbeanOperation in AESRemote ruleset.


BNY Mellon
US
Thanks. But it remains kludgey.
To stop a listener is easy:
String result = (String)com.pega.pegarules.priv.management.MBeanManagement.executeMBeanOperation( "com.pega.pegarules.management.internal.ListenerManagement", "StopAll", null, null, null);
To restart all the listeners, you need to fetch the XML, iterate through, get the name, which you can pass to StartListener
String AvailableListenersXML = (String)com.pega.pegarules.priv.management.MBeanManagement.executeMBeanOperation( "com.pega.pegarules.management.internal.ListenerManagement", "AvailableListeners", null, null, null); // from the XML returned by AvailableListenersXML, parse out /AvailableListeners/Listener/Name into ListenerNames[] for (String ListenerName in ListenerNames[]) { com.pega.pegarules.priv.management.MBeanManagement.executeMBeanOperation( "com.pega.pegarules.management.internal.ListenerManagement", "StartListener", ListenerName, null, null); }


There's an operation to start all listeners by type.


There's an operation to start all listeners by type.


BNY Mellon
US
There's an operation to restart all listeners (and by type) -- assuming they are running.


BNY Mellon
US
Also, of course, Start All Listeners for this node -- this is done by the system when it starts up. Surely there is already an API for this.
PRIntegrationEngineProvider.initServices() is public... is there a way to call that?
This is for v6, but, in v7, if we just quiesce the node, would that have the same effect?


BNY Mellon
US
Any takers?
Doesn't every Pega developer, inside and out of the company, go to sleep at night (or wake up in the morning, saying), how can I make this product easier for everyone to use?
We can stop all listeners, but there's no supported way to start them all.
Can we fix this?


There is a MBEAN operation "RestartAll", which would restart all the listeners on the node, will that help?


BNY Mellon
US
As I mentioned in my comment on Sept 3rd, restart only starts listeners that are running. Not those that were stopped.


Pegasystems Inc.
US
Hi Jon,
I'm Marissa, one of the new moderators here. Sorry that you haven't received a reply. Let me see if I can find someone that can help you out!
Hang in there for me!


BNY Mellon
US
Thanks Marissa. Question is still open.


Pegasystems Inc.
US
I concur. Suggest you create an enhancement request. I might add that to allow pause feature besides start/stop.


Pegasystems Inc.
US
I submitted the enhancement request for this and noted the Feedback number within your original post.