Tuesday 15 April 2014

Oracle BPEL Variable Sensors For Monitoring

Sensors are the monitoring artifacts which can be used to monitor variable values, activity execution facts and fault details. For example using an Activity Sensor we can evaluate a scope activity start execution time, finish time and what is the value of a variable in that scope after execution completes.

There are the following type of sensors are there.

  • Variable Sensor : Used to detect value of a variable through out the bpel life cycle. We can use it for logging purpose in a BPEL process.
  • Activity Sensor : Used to monitor an activity within the BPEL process and also the variable used within the activity.
  • Fault Sensor : Used to monitor different BPEL faults during execution.
With every sensor we need to configure corresponding sensor actions like after triggered the sensor what Action it needs to perform. We can use one of the following type of Sensor Action with the sensor.
  • Database : publish the sensor data into report schema of in the database.
  • JMS Queue : publish the sensor data to a JMS queue
  • JMS Topic : publish the sensor data to a JMS Topic
  • Custom : publish the sensor data to a custom java class
  • JMS adapter : publish the data to a remote JMS queue or topic
When we use a sensor in BPEL process the Jdeveloper generates two files in it.
  • bpel_process_name_sensor.xml : It contains the sensor details.
  • bpel_process_name_sensorAction.xml : It contains the corresponding sensor Action details.
The following example describes the creation of a variable sensor and monitor its values from Report schema of the database.
  • In the BPEL process create a simple string type variable as LogMessage.
  • Assign the input value and different values to the above created variable.





















  • Go to the Monitor tab of the BPEL process in the SOA editor of Jdeveloper.





  • Go to the Structure pane of the Jdev and select variable under Sensors and click on add button.



















  • Give the sensor name to any name. Choose the sensor variable as LogMessage variable. Then give the sensor Action as Database and save all.





















  • After creating the sensor it generated two xml files in the project.

















  • Deploy the project and test the same from the Oracle Enterprise Manager.








  • Goto the launch Flow trace from EM then click on Sensor Values tab. Click on the LogMessageVarSensor and you will find the corresponding values in the Sensor Values tab.

















Please give your comment on the above post.
Happy Coding :)

JMS Adapter Message Selector

In this post we will elaborate how to select messages from the JMS queue based on certain selection criteria. To do this we need to add a JMS message header property while publish the message. Depending upon same we can filter out the message while consuming the message through a JMS adapter.

While transferring the JMS message the server by default adds some of the JMS header properties, however we can set our own custom JMS header property also for our requirement.

To add a custom JMS property in the JMS message header we need to use inputProporty tag in the invoke activity of *.bpel file. The corresponding value we can pass through a variable or an expression. Consider the below code snippet,

<invoke name="InvkJMSProduceMsg"
            inputVariable="InvkJMSProduceMsg_Produce_Message_InputVariable"
            partnerLink="JMSProduceMsg" portType="ns2:Produce_Message_ptt"
            operation="Produce_Message" bpelx:invokeAsDetail="no">
            <bpelx:inputProperty name="jca.jms.JMSProperty.depid" variable="deptidVar"/>
 </invoke>



    <invoke name="InvkJMSProduceMsg"
            inputVariable="InvkJMSProduceMsg_Produce_Message_InputVariable"
            partnerLink="JMSProduceMsg" portType="ns2:Produce_Message_ptt"
            operation="Produce_Message" bpelx:invokeAsDetail="no">
            <bpelx:inputProperty name="jca.jms.JMSProperty.depid" expression="10"/>
 </invoke>




In the above screenshot jca.jms.JMSProperty.depid is the custom JMS header Property whose value will be visible at EM console as shown below.



Now to consume messages as per certain criteria we need to set the Message selector defined in JMS adapter.





Here depid is the JMS header custom property which was set at the time of producing message in JMS Queue.

After this configuration of JSM adapter it will poll only the required messages from the JSM Queue depending upon the deptid value.


Let us know your valuable feedback.