01 September 2009

Composite Sensors


Composite sensors, as the name suggests, are nothing but sensors on the composite level. They can be configured on services and references in any composite. Once configured these sensors then can be used to track the input and output for a composite instance.

Configuring Composite Sensor:

For the current POC, I created a composite with name SensorPOC which takes input a string and returns Hello attached.

Steps for configuring the sensors are similar to that of the good old BPEL process sensors.
In short:

1) Go to composite.xml design view. Click the button for composite sensors. This is present in the top pane.




2) A new window for configuring the sensors will pop up. Select the service for which you want to configure the sensors and click plus sign


3) Name the sensor. Select the appropriate operation. Selecting the operation is important as the variables will be available based on what operation you select.


4) Click the pencil button to choose the type of sensor to be configured. Three types of sensors can be configured - Variables, Expressions and properties. In variable sensors, we can track only values in the variables. In the expression sensors, we can track values of different expressions created using variables and Xpath functions In the properties sensors, we can get values for different properties of that composite.

5) Click Variables.In the XPath window, select the appropriate node and click OK.


If you want to set any filter, you can set it by adding XPath expression in Filter Part. The meaning of filter is that sensor will work only if the filter condition is true. In the POC, I added a filter that checks whether input string has 'a' present.

Note that Composite sensor action is "DBSensorAction". This is a current restriction in Release1.

Click OK. Configuration is done.


Viewing on Console:

1) After deploying the process, open the process on BPEL Console and create an instance.
2) View the instance by clicking the instance-id. This opens pop-up window. In the same window We have a folded node for sensors.Clicking it will show the sensors. Note that sensors will be only activated if the filter condition is met.


Using the sensors as trackers.

In the Instances tab for the composite, we have Search option available. In the right side, we have a button called "Add Fields". Clicking this button will show the list of sensors which can be added. Once the sensor is added, it can be used to filter the instance based on the input value.