Reputation: 221
I'm working with WSO2 EI.
When a sequence fails I have the need to deactivate a message processor
How can I deactivate the message processor from the sequence?
Thank you!
This if for Linux Server, WSO2 EI - 6.4.0 and JDK is this: 1.8.0_201
Upvotes: 0
Views: 122
Reputation: 580
You can implement a simple class mediator to access the JMX endpoint of the EI to deactivate the message processor. And refer the class mediator in your relevant sequence. Following is a sample class mediator. Here I'm deactivating the message processor named testPro.
public class MsgProDeactivator extends AbstractMediator {
public boolean mediate(MessageContext context) {
try {
Map<String, Object> env = new HashMap<String, Object>();
String[] credentials = new String[]{"admin", "admin"};
env.put("jmx.remote.credentials", credentials);
String url = "service:jmx:rmi://localhost:11111/jndi/rmi://localhost:9999/jmxrmi";
JMXServiceURL target = new JMXServiceURL(url);
JMXConnector connector = JMXConnectorFactory.connect(target, env);
MBeanServerConnection remote = connector.getMBeanServerConnection();
String beanDef = "org.apache.synapse:Type=Message Forwarding Processor view,Name=testPro";
ObjectName bean = new ObjectName(beanDef);
remote.invoke(bean, "deactivate", null, null);
connector.close();
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
}
For more info : http://imesh.github.io/how-to-activatedeactivate-message-processors-in-wso2-esb-with-mbeans/
Upvotes: 1