How to Disable an Event Subscriber via the SDK
In a Script PX Event Handler using the SDK API, is there a way to Disable/Enable a Event Subscriber? I am referring to the Event Subscribers node that is a child of “Event Management” in the Java client, not the Subscribers node that is a child of “Agile Content Services”.
The NodeConstants NODE_EVENTS documented in the SDK documentation seems to refer to ACS nodes. I would guess that if I could get the Event Subscribers node, I could use INode.setValue() to set the Enabled property, but please confirm.
Hi Brian F,
Please refer the below code to Disable an Event Subscriber via SDK
IAdmin admin = session.getAdminInstance();
INode node = admin.getNode(“EventSubscribers”);
INode subnode = (INode) node.getChild(“test subscriber”);//Your event subscriber name
IProperty[] props = (IProperty[])subnode.getProperties();
for (int i = 0; i < props.length; i++)
{
String propname= props[i].getName();
System.out.println(“Name : ” + propname);
Object value = props[i].getValue();
System.out.println(“Value : ” + value);
if(propname.equalsIgnoreCase(“Enabled”))
{
props[i].setValue(“No”);
}
}
This would help you to disable subscriber .
let me know for any queries.
Thanks,
Kalyani