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:
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.
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 properties to the new sensor, in particular the name and the target – the input element in the inputVariable.
Press OK.
In the window that pops up, type the name for this BAM Sensor Action.
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.
Close the Mapper, save all and we are done creating the BPEL process.
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.
If you feel like it, you can run a few more BPEL Process Instances and find them producing additional DataObject instances.
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.
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:
- create a new Data Object in BAM (also the interface between the BPEL process and the BAM Active Data Cache)
- create an HelloWorld BPEL process
- add a variable sensor and a BAM Sensor action to the BPEL process
- deploy and run the BPEL process
- verify the creation of instances of the BAM Data Object
- create a BAM report based on the Data Object
- 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 BPEL process instance that just return " Hello Tommy" to us.
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.
No comments:
Post a Comment