Adding a composite sensor

In the previous recipe, we saw how to define composite and BPEL sensors. This recipe will show you how to add different types of sensors to a composite and BPEL process.

Getting ready

For adding a composite sensor, we will use the example from the Defining composite sensors recipe. Remember we defined one composite sensor and three BPEL sensors.

How to do it…

In the following recipe, we will add a composite sensor to the SCA. We first add the composite sensor to the BookHotelSvc service in the composite structure. We already saw in the previous recipe that an icon appears indicating that the sensor is added to the composite. To add a composite sensor in JDeveloper there are two ways:

  1. We can add a composite sensor by clicking on the toolbar icon in the composite design view as shown in the following screenshot:
    How to do it…

    With this option, you will receive a list of all possible candidates where you can place the composite sensor as shown in the following screenshot:

    How to do it…
  2. Another way to add a composite sensor is to select the web service in the composite and then right-click and select Configure Sensors....

How it works…

When adding composite sensors, the following two files are created in the project structure:

  • sensor.xml: This file contains the sensor definitions as shown in the following code:
    <?xml version="1.0" encoding="UTF-8"?>
    <sensors xmlns="http://xmlns.oracle.com/bpel/sensor">
      <sensor sensorName="HotelSensor" kind="reference" target="undefined" filter="" xmlns:ns="http://www.packt.org/book/hotel">
        <referenceConfig reference="BookHotelSvc" expression="concat($in.parameters/ns:availableHotels/ns:from, $in.parameters/ns:availableHotels/ns:to)" operation="availableHotels" outputDataType="string" outputNamespace="http://www.w3.org/2001/XMLSchema"/>
      </sensor>
    </sensors>
  • sensorAction.xml: This file contains the sensor action definitions as shown in the following code:
    <?xml version="1.0" encoding="UTF-8"?>
    <actions xmlns="http://xmlns.oracle.com/bpel/sensor">
      <action name="JMSSensorAction_HotelSensor" enabled="false" publishType="JMSQueue" publishTarget="">
        <property name="JMSConnectionFactory"/>
      </action>
      <action name="DBSensorAction" enabled="true" publishType="BpelReportsSchema" publishName="" filter="" publishTarget="">
        <sensorName>HotelSensor</sensorName>
      </action>
    </actions>

Any subsequent addition of new composite sensors is stored into these two files.

There's more…

Occasionally, when we want to monitor a BPEL process in more detail, we should also add BPEL sensors. We achieve this by opening the BPEL process and then clicking on the Monitor icon at the top-right corner of the BPEL process design view:

  1. We enter into the monitoring mode where we add sensors for the BPEL process as shown in the following screenshot:
    There's more…
  2. It is possible to add BPEL sensors to any activity in the business process by right-clicking on the activity:
    There's more…

Adding a BPEL sensor for JMS queuing

In this recipe, we will see how to define a BPEL sensor that will report data to the JMS queue. For that purpose, we need to define the JMS queue on the Oracle WebLogic server. This approach represents a loosely coupled solution to monitoring. Also, the solution represents robust architecture from a disaster recovery point of view. For example, if the database crashes, the messages stay in the JMS waiting for the database to come back online. This approach is also recommended if you want to integrate with the third-party business activity monitoring systems.

Tip

Some very useful documentation on JMS queuing is available at the official Oracle WebLogic website: http://docs.oracle.com/cd/E12840_01/wls/docs103/messaging.html.

To use a JMS queue in the BPEL sensors, we need two pieces of information. The first one is the JMS Connection Factory (holds the information about the connection to the JMS queues and presents the pool of connections) and the second one is Publish Target (in our case, this field holds the JNDI name of the JMS queue; otherwise, this field holds various information depending on the publishing type specified).

In JDeveloper, we need to define the sensor action. We do this by right-clicking on the Sensor Actions option in the project structure window and then selecting Create…. We then fill the dialog with the requested data as shown in the following screenshot:

Adding a BPEL sensor for JMS queuing

We define the sensor in the BPEL process. Note that instead of a database sensor action, we will use the JMS sensor action.

Adding a BPEL sensor for JMS queuing

Note

By running the BPEL process, we won't see any JMS sensor information in the Audit Trail or logs of the BPEL process. We can however, check the content of the JMS queue via the Oracle WebLogic Administration Console.

See also

To cover all palette of sensor management in the Oracle SOA Suite, we still need to cover the monitoring of composite and BPEL sensors. To see how we monitor sensors, look at the next recipe, Monitoring a composite sensor.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset