The majority of my Oracle SOA Suite customers are not taking advantage of the Business Activity Monitoring (BAM) capabilities of the platform. This is a real shame, because gaining the type of real time insight into your business that BAM can provide should be one of the primary reasons for adopting a SOA architecture in the first place.
For the uninitiated, Business Activity Monitoring allows you to visually see how your business is performing in the moment and then react if necessary. What you visualize is up to you – orders processed, carts abandoned, reservations booked, reservations cancelled, etc. The beauty of using a SOA platform is that you already have all of this data flowing through a central system, so it just needs to be captured as it’s streaming by. Therefore, the first step after deciding that you want BAM is to decide what you want BAM do show.
For this exercise, I’m going to use a credit card processing service, so we can monitor things like authorizations, declines, purchase amounts, etc. Once I know what I want to monitor, I need to produce the data in a format that’s consumable by BAM. Oracle BAM can consume data from several source types. For this tutorial we are going to use an Enterprise Message Source, which is one of the more flexible and popular types.
I’ve decided to break the tutorial into three Parts. Part 1 (this part) will focus on the production of data. Part 2 will focus on the consumption of that data into BAM. Part 3 will conclude with using the data to design a dashboard.
As a starting point, I’m going to use the ValidatePayment composite from the Oracle SOA Suite 12.1.3 end-to-end tutorial. This composite contains a simple web service which validates a credit purchase. I’ve documented the steps of installing the ValidatePayment composite into the Pre-built Virtual Machine for SOA Suite. So if you want to follow along, as a starting point, please complete Deploying ValidatePayment to the OTN SOA VM.
Step 1: Create JMS Artifacts
- Open the WebLogic Admin Console.
Create a Persistent Store
By creating a persistent store we will be able to view the message text in the console (that last step of this exercise).
- Select Peristent Stores.
- Create a New FileStore named PaymentJMSFileStore:
- Target the file store to soa_server1. The JMS resources must be targeted to the SOA server so that the composite (deployed to the SOA server) can locate them:
- Click Finish.
Create a JMS Server
- Select JMS Servers.
- Create a new JMS Server named PaymentJMSServer:
- Select the PaymentJMSFileStore Persistent Store:
- Target the file store to soa_server1 and click Finish.
Create a JMS Module
- Select JMS Modules.
- Create a new JMS Module named PaymentJMSModule:
- Target the JMS Module to the AdminServer, bam_server1, and soa_server1. The JMS resources should then be locatable from any of these servers. At a minimum, the deployed composite will look at soa_server1 and BAM Composer will look at bam_server1:
- Click Next and select Would you like to add resources to this JMS system module? and click Finish:
This will take you directly to the page where you can added resources.
Create JMS Resources
We will use a subdeployment to group all of our JMS resources together. It’s also via the subdeployment that we target our resources to the appropriate managed servers.
- Click the Subdeployments tab create a new subdeployment named PaymentSubdeployment:
- Target the subdeployment to the PaymentJMServer we just created:
- Switch to the Configuration tab and create a new Queue named PaymentQueue with the JNDI Name of jms/PaymentQueue:
- Select the PaymentSupdeployment we just created and click Finish:
- Create a new Connection Factory named PaymentConnectionFactory with the JNDI Name of jms/PaymentConnectionFactory and click Finish.
Step 2: Configure the JMS Adapter
The JMS Adapter from the ValidatePayment SOA composite will connect via this connection.
- Select Deployments.
- Select the JmsAdapter and select the Configuration tab and Outbound Connection Pools sub-tab. Create a new Outbound Connection Pool configuration and select oracle.tip.adapter.jms.IJmsConnectionFactory as the Outbound Connection Group:
- Set the JNDI Name to eis/jms/PaymentQueue and click Finish:
- Change the plan file name to JMSPlan.xml and save the Deployment Plan:
- Edit the eis/jms/PaymentQueue configuration we just created and set the ConnectionFactoryLocation to jms/PaymentConnectionFactory. Now we have mapped the JMS Adapter to the JMS Connection Factory.
- Return to deployments, select the JmsAdpter and select Update and then Finish:
Step 3: Configure the Composite
Create a Schema
In BAM, we are going to define a data object that represents the data we want to monitor. In our composite, we need to define a schema that maps to the BAM data object we will eventually create.
- In JDeveloper, create a new PaymentForBAM.xsd in the SOA/Schemas folder with the following contents:
<?xml version="1.0" encoding="UTF-8" ?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.oracle.com/bampayment" targetNamespace="http://www.oracle.com/bampayment" elementFormDefault="qualified"> <xsd:complexType name="PaymentAuthorizationType"> <xsd:sequence> <xsd:element name="CARD_NAME" type="xsd:string"/> <xsd:element name="FIRST_NAME" type="xsd:string"/> <xsd:element name="LAST_NAME" type="xsd:string"/> <xsd:element name="CITY" type="xsd:string"/> <xsd:element name="STATE" type="xsd:string"/> <xsd:element name="AUTHORIZATION_AMOUNT" type="xsd:float"/> <xsd:element name="CREDIT_LIMIT" type="xsd:float"/> <xsd:element name="PAYMENT_STATUS" type="xsd:string"/> </xsd:sequence> </xsd:complexType> <xsd:element name="PaymentAutorization" type="PaymentAuthorizationType"/> </xsd:schema>
Configure the JMS Adapter
We will use the JMS Adapter to publish messages on the queue.
- Open the ValidatePayment composite.
- Drag and drop a JMS Adapter into the External References lane. Name the reference Produce_Message:
- Select Oracle Weblogic JMS as the Oracle Enterprise Messaging Service (OEMS):
- Select SOA_Domain as the AppServer Connection:
- For the Interface, select Define from operation and schema (specified later). This will be the PaymentForBAM.xsd we created above:
- Select Produce Message as the Operation Type and name the operation Produce_Message:
- Browse for Destination Name and select the PaymentJMSModule PaymentQueue (queue):
- For the JNDI Name, use the JNDI browser to ensure the name has been set up correctly in the directory:
Your Produce Operation Parameters should appear as follows:
- On the Messages page, browse and select the PaymentAuthorizationType from the PaymentForBAM.xsd that we created earlier:
Your Messages page should appear as follows:
- Click Next and Finish to complete the wizard.
- Wire the JMS Adapter to the Composite. The composite should now look as follows:
Invoke the JMS Adapter
- Open the validatePaymentProcess BPEL component.
- Drag and drop and Invoke before the replyOutput and name it Invoke_Produce_Message.
- Wire the Invoke to the Produce Message Partner Link. This will open the Edit Invoke dialog. Click the plus sign to create a new input variable. Select the default name (Invoke_Produce_Message_Produce_Message_InputVariable) and click OK.
- Click OK to close the Edit Invoke dialog.
- Drag and drop and Assign before the Invoke_Produce_Message and name it setMessageValues.
- Edit the setMessageValues assign by double-clicking it. Map the appropriate values to the Invoke_Produce_Message_Produce_Message_InputVariable.From the inputVariable you should map the following:
CardName - CARD_NAME FirstName - FIRST_NAME LastName - LAST_NAME City - CITY State - STATE
From the outputVariable:
Status - PAYMENT_STATUS
From the getPaymentInformation_getPaymentInformationSelect_OutputVariable:
dailyLimit - CREDIT_LIMIT
The result should look as follows:
Step 4: Deploy and Test
- Save All and Deploy ValidatePayment to the SOA_Domain.
- Switch to Enterprise Manager Fusion Middleware Control and navigate to the Test Web Service page of the ValidatePayment composite.
- Browse and select the PaymentInfoSample_Authorized_soap.xml and click Test Web Service.
- Switch to the WebLogic Console and navigate to the PaymentQueue (soa_domain > Services > Messaging > JMS Modules > PaymentJMSModule). Switch to the Monitoring tab where you should see the message in the queue:
- Select the PaymentJMSModule!PaymentQueue and click Show Messages to see the Summary of JMS Messages:
- Click the message ID to view the message details:
Excellent, we now have data being published to a JMS queue. In Part 2, we will consume this data for business analysis.