Integrating BPEL and BAM in Oracle 11g SOA Suite

7

Following hot on the heels of a previous article on BAM – Business Activity Monitoring in Oracle 11g SOA Suite – this article will discuss how to integrate BPEL and BAM, more specifically: how to make a BPEL process send ‘live’ process instance execution data to BAM and how to have BAM display these details in a dynamic web-based report. Having created that basic integration, the sky is the limit when it comes to building rich, powerful consoles for monitoring Business Process execution.

We will start humbly: with almost the easiest, simplest BPEL process there is and a similarly trivial BAM Data Object and Report. But the key concepts are here.....

I will assume as a starting point that all of the BAM Server, JDeveloper 11g and the SOA Suite run time (part of the JDeveloper 11g install) have been installed and are up and running.

The steps we will go through in this article are:

  1. create a new Data Object in BAM (also the interface between the BPEL process and the BAM Active Data Cache)
  2. create an HelloWorld BPEL process
  3. add a variable sensor and a BAM Sensor action to the BPEL process
  4. deploy and run the BPEL process
  5. verify the creation of instances of the BAM Data Object
  6. create a BAM report based on the Data Object
  7. view the report and watch it update in real time as more BPEL process instances are started

The first step is creation of the BAM Data Object. Login to the BAM Web Application – http://host:8888/OracleBAM/default.htm – and go to the Architect.

 

Click on Architect:

Click on Create Data Object and fill in the details for the HelloWorldDO Data Object:

 

The DataObject has three fields that contain respectively the inputParameter sent into the BPEL process, the timestamp of the start of the process instance and the instanceId which identifies both the BPEL Process Instance and this data object.

Click on Create Data Object.

and the object is presented:

What we have now is an interface that external data (event) providers can hook into. We will now continue to create a BPEL process that feeds into this Data Object. Then we will return to BAM to create a Report based on this Data Object that will display the data fed into it.

Step 2 – create an HelloWorld BPEL process

Before we continue and if you have not already done so, create a BAM Server Connection. Do this via File, New and select Connections, BAM

Create the Connection in the Application Resources.

The username is fmwadmin and the default password is welcome1.

 

Test the connection and upon success, press Finish. 

You have to make sure that you have only one BAM Server connection.

In JDeveloper 11g, create a new Application with SOA technology template. Create a new project, call it for example HelloWorldBPELandBAM. Open the SOA Composite. Add a BPEL Component to the composite.

Note that  this is a simple synchronous process.

Press OK. 

Double Click the BPEL component to start adding details to the process definition.

Add an Assign step.

 

Edit the Assign Step. Set the output parameter to the string concatenation of Hello and the input parameter.

Step 3 – add a variable sensor and a BAM Sensor action to the BPEL process

In the structure window for the BPEL process, locate the node Sensors\variable and click on the create icon.

Edit the properties to the new sensor, in particular the name and the target – the input element in the inputVariable.

 

Press OK.

In the Structure Window locate the node Sensor Actions and click on the create icon. Select BAM Sensor Action from the dropdown list.

In the window that pops up, type the name for this BAM Sensor Action.

Browse for the BAM Data Object this sensor action will feed into – the HelloWorldDO object.

Select the Insert operation. Select _instanceId as the Selected Key. You may want to change the name of the XSL Mapping file that will specify the mapping from data in the BPEL process (instance) to the DataObject, for example to bam\InputToHelloWorldDO.xsl.

Press the icon to create the mapping file.

 

In the Mapper connect the appropriate elements in the Header and the Payload to the BAM DataObject.

Close the Mapper, save all and we are done creating the BPEL process.

Step 4 – deploy and run the BPEL process

Select Deploy …. to Bundled OC4J Server from the RMB menu on the project. Make sure that the Bundles OC4J server is running when you do this.

Open the SOA Console, locate the HelloWorldWithBAMSensors component and start an instance.

Enter a value for the input parameter and press the Invoke button.

 

After some time the synchronous BPEL process will return its response:

And if all is well, it will have sent out signals to the BAM Server as well. 

Step 5 – verify the creation of instances of the BAM Data Object

Return to the BAM Server.  Click on the Contents link on the Data Object overview page. The page will refresh with the current contents for this Data Object. It should now show a single DataObject instance, created from the BP
EL process instance that just return " Hello Tommy"  to us.

c="http://technology.amis.nl/wp-content/uploads/images/bam11gtp4027.jpg" />

If you feel like it, you can run a few more BPEL Process Instances and find them producing additional DataObject instances.

 

Step 6 – create a BAM report based on the Data Object

Close the Architect module in BAM. Now start the Active Studio. Click on Create New Report.

Select the simplest Report Layout, shown in the upper left hand corner.

 

Set the Report’s title to HelloWorld Monitor.

Click on the Streaming List icon to select the View Type. Note: we can later on change the View Type for our Report. A Streaming List presents a tabular display of data that is actively refreshed when new data arrives.

 

Select the HelloWorldDO as the base Data Object.

 

Accept all three Data Fields – you can rearrange them if you like.

Press OK to apply the changes. Note: you can very easily go in to edit the Report properties such as display and layout styles, prompts, filters etcetera.

For now we are satisfied. Save the Report and click on View.

Step 7 – view the report and watch it update in real time as more BPEL process instances are started

If we now start some additional BPEL process instances of the HelloWorld process, this report will automatically get updated. We can sit back and relax and watch as new records are added.

Share.

About Author

Lucas Jellema, active in IT (and with Oracle) since 1994. Oracle ACE Director for Fusion Middleware. Consultant, trainer and instructor on diverse areas including Oracle Database (SQL & PLSQL), Service Oriented Architecture, BPM, ADF, Java in various shapes and forms and many other things. Author of the Oracle Press book: Oracle SOA Suite 11g Handbook. Frequent presenter on conferences such as JavaOne, Oracle OpenWorld, ODTUG Kaleidoscope, Devoxx and OBUG. Presenter for Oracle University Celebrity specials.

7 Comments

  1. This is about SOA Suite 11g which does not run on OC4J and also not on the Integrated WebLogic Server in JDeveloper. You will need to set up a stand-alone SOA Suite 11g run time environment.

     

    Lucas

  2. Hi,
    awesome .. explanation.. but can u please let me know to deploy the helloworld program in bundledoc4jserver.. i dont find any in the connections tab also.. please guide me its urgent..
     

  3. oh .. there was an other little issue: with the JDeveloper version I used: 11.1.1.4, I could not select an ID in step 3 for the Insert operation ! It explained that it didn’t need an Id for the insert operation!
     
    Kind regards,
    Dwight

  4. Hello Lucas,
     
    thanks for the example … I excuted all steps, but saw one detail (minor if you know BAM sensors ;-) )
     
    @step 3: You have to put the BPEL window in Monitor mode (default BPEL), otherwise you will not see the sensor part!
    Thanks for the excellent example!
     

  5. Excelente!!! Muchas gracias me ha servido de mucho tu post al implementar BAM en mi empresa.

    Gracias por la ayuda y aprovecho para saber si conoces de algún manual para detallar en el diseño de monitoreo BAM???