SOA 11g Tutorial: Business Activity Monitoring (BAM)
Define Data Object
* Define data object to hold event data.Login BAM Console
* Login in BAM using IE (NOT Firefox): http://localhost:9001/OracleBAM- User name: weblogic
- Password: welcome1
Create Subfolders
* Click on Architect button to open the Architect application page.* In the upper left corner "Folders" pane, click the Data Objects folder.
* In the right side pane, click Create Subfolder link.
* Enter Training and click Create Folder button.
* Click Continue button.
* Create another subfolder named POProcessing within the newly created Training folder.
Create Data Objects
* Click POProcessing folder on the "Folders" pane.* In the right pane, click Create Data Object link.
- Name for new Data Object: Orders
- Tip text: Orders
* Click Add a field link to add the following fields
Order ID String 30 Customer ID String 30 Product Name String 50 Item Type String 30 Price Decimal 10 Quantity Decimal 10 Status String 50 Total Calculated Price * Quantity Received Date Timestamp* Click Create Data Object button.
* Click Continue button.
Define BAM Dashboard
Open Active Studio
* Go back to the BAM welcome page, i.e. first page after logging in.* Click Active Studio link to open BAM Active Studio application page.
* Click Shared Reports tab so we can create a report everyone can view.
Create Report Folders
* Click Create a new folder link in Organize pane named Training.* Double click newly created Training folder to open it.
* Click Create a new folder link in Organize pane again to create a subfolder named POProcessing.
* Double click POProcessing folder to open.
Create a New Report
* Click Create A New Report button.* Select "Three tiles with horizontal tile on the top and two square tiles on the bottom" layout.
* Name the report POProcessing Report by "Click to add a report title" on title bar.
Configure Top Tile
* On the top tile, click Updating Ordered List icon.* On the Choose Data Object dialog,
- Double click Training folder
- Double click POProcessing folder
- Select Orders
- Click Next button
- Click Select All to the right of Data Fields.
- Rearrange data fields with the up and down arrow.
- Click Next and Finish.
Configure Lower Left Tile
* Select 3D Pie Chart.* Select Orders as data object.
* Select Item Type data field as Group By option.
* Select Total data field as Chart Values option.
* Select Percentage of Total as Summary Function option.
* Click Next.
* Click Change View Properties.
* Set View Title to Percentage of Total Sales by Item Type.
* Click OK.
Configure Lower Right Tile
* Select 3D Bar Chart.* Select Orders as data object.
* Select Status data field as Group By option.
* Select Order ID field as Chart Values.
* Select Count as Summary Function(s).
* Click Next.
* Click Change View Properties.
* Set View Title to Purchase Orders by Status.
* Click OK.
Save Report
* Click Save Report link under Actions pane.* Choose Shared Reports/Training/POProcessing subfolder
* Accept default report name of POProcessing Report.
* Click OK button.
Configure BAM Adapter on WebLogic Server
* BAM adapter is used to send events to data object from POProcessing composite.Create BAM Plan Directory
* Create BAM plan directory on BAM server machine
mkdir /opt/oracle/Middleware/home_11gr1/Oracle_SOA1/soa/BAMPlan
Configure BAM Adapter
* Login WebLogic Admin Console (http://localhost:7001/console/login/LoginForm.jsp).* Click Deployments in Domain Structure pane.
* Search and click OralceBamAdapter.
* Click on Configuration tab.
* Click on Outbound Connection Pools sub-tab.
* Expand oracle.bam.adapter.adc.RMIConnectionFactory.
* Click eis/bam/rmi.
* Enter following values (note, you need to hit enter key after enter a value):
HostName: localhost
InstanceName: ADCServer1
Password: welcome1
PortNumber: 9001
UserName: weblogic
* Click Save button. Use newly created path as plan path:
Path: /opt/oracle/Middleware/home_11gr1/Oracle_SOA1/soa/BAMPlan/Plan.xml
* Click OK.
Redeploy BAM Adapter
* Click Deployments in Domain Structure pane.* Search and select OralceBamAdapter.
* Click Update button.
* Accept the default selections and click Finish button.
* Check that BAM Adapter is depployed on bam_server1 server instance.
Add BAM Connection to POProcessing
* Open JDeveloper* Open POProcessing application
* Right click POProcessing application and select New...
* Select General -> Connections -> BAM Connection and click OK.
* Accept default name of BAMServerConnection1 and click Next.
* Enter connection values:
BAM Web Host: localhost
BAM Server Host: localhost
User Name: weblogic
Password: welcome1
HTTP Pot: 9001
JNDI Port: 9001
* Click Next.
* Click Test Connection.
Testing HTTP connection ... success. Testing Data Object browsing ... success. Testing JNDI connection ... success. 3 of 3 tests successful.* Click Finish.
Use BAM Adapter in POProcessing
Add BAM Adapter to POProcessing
* Open POProcessing composite.xml file.* Drag and drop BAM Adapter onto External References.
* On Adapter Configuration Wizard dialogs,
- Click Next on Welcome screen
- Enter OrdersBAMAdapter as service name.
- Browse and select Orders as data object:
BAMServerConnection1 -> Training -> POProcessing -> Orders- Select Operation: Upsert
- Opeation Name: writetoBAM
- Enable Batching: selected
- Selected: _Order_ID
- JNDI Name: eis/bam/rmi
Connect Mediator Component to BAM Adapter
* Wire routePO mediator component to newly added BAM adapter.* Double click routePO mediator component to open the routePO.mplan file.
* Click the transform icon for BAM adapter and create a new mapper file:
CustID -> _Customer_ID ID -> _Order_ID productName -> _Product_Name itemType -> _Item_Type quantity -> _Quantity status -> _Status* Save all.
Test BAM Adapter Connection
* Redeploy POProcessing* Test with input message
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body xmlns:ns1="http://xmlns.oracle.com/ns/order"> <ns1:PurchaseOrder> <ns1:CustID>1111</ns1:CustID> <ns1:ID>SMALL1-VALID</ns1:ID> <ns1:productName>iPod Shuffle</ns1:productName> <ns1:itemType>Electronics</ns1:itemType> <ns1:price>100.99</ns1:price> <ns1:quantity>3</ns1:quantity> <ns1:status>Initial</ns1:status> <ns1:ccType>Mastercard</ns1:ccType> <ns1:ccNumber>8765-8765-8765-8765</ns1:ccNumber> </ns1:PurchaseOrder> </soap:Body> </soap:Envelope>
Check Data Object Contents
* Log into BAM console.* Click Architect to open Architect application.
* In Folders pane, click Data Objects -> Training -> POProcessing folder.
* In Data Objects pane, click DataOrders.
* In right pane, click contents link.
* Check that Orders data object contains data rows.
Add BAM Sensors to BPEL Process
Set Order Status to 'Pending Approval'
* Open JDev.* Open POProcessing composite.xml file.
* Double click approveLargeOrder BPEL component to open it.
* Double click assignCCNumber activity to open it.
* Copy 'Pending Approval' (with single quotes) to the status field of the Order output Variable (ouputVariable/payload//ns2:Order/ns2:status).
Add sensor: PendingApprovalActivitySensor
* On the upper right corner of editor pane, click Monitor button next to the BPEL button to turn on Monitor perspective.* Right click assignCCNumber icon and select "Create -> Sensors" to open the Create Activity Sensor dialog.
- Name: PendingApprovalActivitySensor
- Activity Name: assignCCNumber
- Evaluation Time: Completion
* Click the green plus sign in Activity Variable Sensors pane to open the Create Activity Variable Sensor dialog.
- Variable XPath: $outputVariable/payload/ns2:Order
- Output Namespace: http://xmlns.oracle.com/ns/order
- Output Datatype: OrderType
* Click OK to close Create Activity Sensor dialog.
* Notice that assignCCNumber activity icon has a new sensor icon in it.
Add sensor action: PendingApprovalSensorAction
* With approveLargeOrder.bpel file open, open Structure panel (View -> Structure)* Right click Sensor Actions folder and select Create -> BAM Sensor Action... to open the Create Sensor Action dialog.
- Action Name: PendingApprovalSensorAction
- Sensor: PendingApprovalActivitySensor
- Data Object: Training/POProcessing/Orders (Click magnifying glass and browse to BAMServerConnection1 -> Training -> POProcessing -> Orders)
- Operation: Upsert
- Keys: _Order_ID
- Map File: bam\xsl\PendingApprovalSensorAction.xsl and map payload/variableData/data/Order to Orders1Collection/_Orders.
- BAM Connection Factory JNDI: eis/bam/rmi
- Enable Batching: checked
* Click OK.
Add sensor: CallbackActivitySensor
* Right click callbackClient invoke activity at the end of BPEL process. Select Create -> Sensor...- Name: CallbackActivitySensor
- Evaluation Time: Activation
* Click the green plus sign in Activity Variable Sensors pane to open the Create Activity Variable Sensor dialog.
- Variable XPath: $outputVariable/payload/ns2:Order
- Output Namespace: http://xmlns.oracle.com/ns/order
- Output Datatype: OrderType
* Click OK to close Create Activity Sensor dialog.
Add sensor action: CallbackSensorAction
* With approveLargeOrder.bpel file open, open Structure panel (View -> Structure)* Right click Sensor Actions folder and select Create -> BAM Sensor Action... to open the Create Sensor Action dialog.
- Action Name: CallbackSensorAction
- Sensor: CallbackActivitySensor
- Data Object: Training/POProcessing/Orders (Click magnifying glass and browse to BAMServerConnection1 -> Training -> POProcessing -> Orders)
- Operation: Upsert
- Keys: _Order_ID
- Map File: bam\xsl\CallbackSensorAction.xsl and map payload/variableData/data/Order to Orders1Collection/_Orders.
- BAM Connection Factory JNDI: eis/bam/rmi
- Enable Batching: checked
* Click OK.
* Save all.
Test BPEL Sensors
* Redeploy POProcessing.* Test with input message that contains invalid credit card number:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body xmlns:ns1="http://xmlns.oracle.com/ns/order"> <ns1:PurchaseOrder> <ns1:CustID>1111</ns1:CustID> <ns1:ID>LARGE1-INVCC</ns1:ID> <ns1:productName>Stereo</ns1:productName> <ns1:itemType>Music</ns1:itemType> <ns1:price>150.99</ns1:price> <ns1:quantity>50</ns1:quantity> <ns1:status>Initial</ns1:status> <ns1:ccType>Mastercard</ns1:ccType> <ns1:ccNumber>4321-4321-4321-4321</ns1:ccNumber> </ns1:PurchaseOrder> </soap:Body> </soap:Envelope>* Log into BAM console
* Start Active Viewer application.
* Click Select Report and select POProcessing Report
* Notice that new purchase order is shown on the ordered list with status of invalidCreditCard:
LARGE1-INVCC 1111 Stereo Music 150.99 50 7,549.5 invalidCreditCard
Test Large Order
* Test with input message that has order larger than 5000 and valid credit card:<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body xmlns:ns1="http://xmlns.oracle.com/ns/order"> <ns1:PurchaseOrder> <ns1:CustID>1111</ns1:CustID> <ns1:ID>LARGE1-VALCC</ns1:ID> <ns1:productName>Stereo</ns1:productName> <ns1:itemType>Music</ns1:itemType> <ns1:price>150.99</ns1:price> <ns1:quantity>50</ns1:quantity> <ns1:status>Initial</ns1:status> <ns1:ccType>Mastercard</ns1:ccType> <ns1:ccNumber>1234-1234-1234-1234</ns1:ccNumber> </ns1:PurchaseOrder> </soap:Body> </soap:Envelope>* Open Active Viewer and check that new order is shown on the ordered list with a status of "Pending Approval".
LARGE1-VALCC 1111 Stereo Music 150.99 50 7,549.5 Pending Approval* Log into Worklist application to approve the order.
* Check that order status is changed to "Approved".
LARGE1-VALCC 1111 Stereo Music 150.99 50 7,549.5 approved
No comments:
Post a Comment