BPEL Sensors can be very useful to extract information from the execution of a process,We can use sensors for debugging purpose.
We have 3 types of sensors.
- Activity sensors –>Activity sensors are used to monitor the execution of activities within a BPEL process. For example, they can monitor the execution time of an invoke activity or how long it takes to complete a scope. Along with the activity sensor, you can also monitor variables of the activity.
- Variable sensors–> Variable sensors are used to monitor variables (or parts of a variable) of a BPEL process. For example, variable sensors can monitor the input and output data of a BPEL process.
- Fault sensors –>Fault sensors are used to monitor BPEL faults.
When we create sensors in a composite it will creates 2 files .
sensor.xml -->Contains the sensor definitions of a BPEL process
sensorAction.xml-->Contains the sensor action definitions of a BPEL process
We will see how to create variable sensors.
Creating Activity sensors –>
Open your bpel process and click on monitor.
Then go to the “monitoring process” on the left hand side and click on sensors.
It will open ‘sensors’ window.
click on “+” on right hand side, and click on “Activity Sensor”.Then it will open a new window, give the name to and activity on which you want to create a sensor in my case its “Receive” activity.
Select the Evaluation type as “Activation” and go to next section i.e, Activity sensor variable and click on +button.
Then it will open “Create Activity variable sensor window” , here click on the pen button in the right hand corner to provide the variable which has to be captured for monitoring.
Click Ok after selecting the variable.Now we have to create the sensor action (where to store this sensor information).
Go to Sensor action section and click on + button , it will open the Sensor Action chooser page click on + button , give sensor action name and select the publish type as “database” as i want to store the data in database. Click on OK.
Once everything is done your window looks like this.Click on OK to complete.
Create Composite Sensors –>
Step4: You will see the input payload only in our usecase as our BPEL process is one way only.Drill down to Employee ID and click OK.
Step5: Now under sensor actions you will see two options Enterprise Manager and JMS Queue.
- Enterprise Manager
Select to make runtime sensor data searchable in the Instances tab of a SOA composite application in Oracle Enterprise Manager Fusion Middleware Control.
- JMS Queue
Select to store composite sensor data (XML payload) in a JMS queue. You must specify the JMS connection factory and queue name.In our case we will use Enterprise Manager
Step6:Our Composite sensor EmployeeID is created .Click OK.
Step7: Under your projects on left hand side you can see two new files getting created sensor.xml and sensorActiuon.xml. These files contains list of all the sensors configured for particular composite and along with their actions.
Step8: Compile and deploy your code to EM and test the Sensors composite.Pass the values in employeeid,Fname and Lname.
Step9: Now Open up flow trace for the request you triggered.Expand the sensors tab just below Flow Trace.You will see EmployeeID as sensor and its value that we passed in the input.
Step10: Go back to your Composite in EM and go to Instances tab.Just next to Search,Reset Buttons you will see a new button :AddFields. Click on that and select EmployeeID.
Step11: New search field “EmployeeID” will be added in the Search box along with all other existing search criterias.In this way you can search your instances by passing employeeID field value.
Composite sensors are very important from support and operations point of view as we can set custom search fields using which we can search for our composite instances.