Thursday, 9 February 2012

Sensors in SOA 11g

Hi All... in this topic we will see how can we define sensors and in how many ways we can use these sensors for different purposes.
We can create three types of sensors in BPEL.

1) Variable sensors ----Variable sensors are used to monitor variables(or parts of a variable) of a BPELprocess.

2) Fault sensors ---- Fault sensors are used to monitor BPEL faults.

3) Activity sensors ----Activity sensors are used to monitor the execution of activities within a BPEL process.

Once we create a sensor we can associate an action to it. When a sensor is triggered by Oracle BPEL Process Manager, a new sensor value for that sensor is created. After that, all the sensor actions associated with that sensor are performed. A sensor action typically persists the sensor value in a database or sends the normalized sensor value data to a JMS queue or topic. For integration with Oracle Business Activity Monitoring, the sensor value can sent to the BAM adapter.

When we create a sensor we will get below files
bpel_process_name_sensor.xml --- defines the sensor definitions of a BPEL process.


bpel_process_name_sensorAction.xml --- defines the sensor action definitions of a BPEL process.

Using sensors in BPEL:

Create a soa project with BPEL as component (can be any template empty, sync or async)
We will create variable, activity, fault sensors in order respectively.
Now open the bpel process and go to structure window, right click variablesensor and select create variable sensor as below.


Give a proper name to sensor and select the variable to which you want to create a sensor and finish the creation.
 

Now right click activity sensor and select create activity sensor as below.

 

Give a proper name to sensor and select the activity to which you want to create a sensor and finish the creation.

 

To create fault sensor right click fault and select create. Now provide the name and select the fault for which we want to create. (In this example we are going with selection failure) as below.




Now we are done with creation of sensors and we are about to create sensor actions.
For this right click sensor actins and select create and then sensor action.



Here give some name and select the publish type as Database.(we have other options, in this sample we are going with database. Infact in BPEL console we will see the sensors with action -publish type as database.)

Database: Publishes the sensor data to the reports schema in the database. The sensor data can then be queried using SQL.
JMS Queue: Publishes the sensor data to a JMS queue.
JMS Topic: Publishes sensor data to JMS topic.
Custom: Publishes the data to custom Java class.
JMS Adapter: Publishes to remote queues or topics. (Above JMS Queue and JMS Topic publish types only publishes to local JMS destinations)



Now in edit all the sensors we have cretaed above and select the sensor action thatwe created now as below.



To get the selection failure for fault sensor we are creating an assign activity as below.



Now deploy the composite application and initiate it from em page.



It will get faulted because of our assign activity.



Now open the instance and go to sensor values tab.



In sensor values page we can see the sensors for variable, activity and fault sensors with the values like in below pics.







Till now we have seen sensors in BPEL.

Along with the BPEL sensors we have one more sensors called COMPOSITE sensors which we create in composite.xml. We will see these sensors in coming post in detail.

1 comment:

  1. Hi,
    I unable to see the sensor folder in the structure.
    can u help me on this.

    ReplyDelete