Tuesday, July 10, 2007

BPEL in Cluster: In which node my process is working

I was helping a customer with his BPEL in cluster and we needed to follow the flow and on which machine the instance was running.

I simply use a bpel:exec activity with the following code:
java.net.InetAddress addr = null;
try {
  addr = java.net.InetAddress.getLocalHost();
catch (Exception e) {
System.out.println("EXCEPTION :"+ e);
setVariableData("HostNameVariable", addr.getCanonicalHostName());
This code is just an example of what could be done. Here I am using java.net code API and put the result in a BPEL global variable using the setVariableData method. Obviously you will use appropriate code to differenciate the different nodes for example the name of the OC4J instance, hostname, ... or any interesting value.

No comments: