Oracle SOA Suite - Custom Data Publisher for Sensor Action.
This blog will explain the steps to create the custom data publisher for the sensor action in Oracle SOA Suite 11g or Oracle SOA Suite 12c(the same steps will work in Oracle SOA Suite 12c but the screens will be different) .Steps to create custom data publisher
1. Create the java class e.g. MyCustomSensorPublisher that implements the class DataPublisher in the composite project.
Implement the method - public void publish(ITSensorAction action,ITSensorActionData actiondata,Element xml) to publish the event to the custom publisher.
package customjavasensor;
import com.oracle.bpel.sensor.DataPublisher;
import com.oracle.bpel.sensor.schemas.ITHeaderInfo;
import com.oracle.bpel.sensor.schemas.ITSensorAction;
import com.oracle.bpel.sensor.schemas.ITSensorActionData;
import com.oracle.bpel.sensor.schemas.ITSensorData;
import org.w3c.dom.Element;
public class MyCustomSensorPublisher implements DataPublisher{
public MyCustomSensorPublisher() {
}
public void publish(ITSensorAction action,ITSensorActionData actiondata,Element xml) {
ITHeaderInfo header =actiondata.getHeader();
ITSensorData data=actiondata.getPayload();
System.out.println("Sensor "+header.getSensor().getSensorName()+" fired for BPEL Process "+header.getProcessName());
System.out.println("Sensor Data "+xml.toString());
}
}
2. Open the BPEL file and add the sensor.
Right click on the activity and select Create - Sensor