An Introduction to Oracle Business Activity Monitoring (BAM) – Part 1: Message Production

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.

Prerequisites

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

  1. 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).

  1. Select Peristent Stores.
  2. Create a New FileStore named PaymentJMSFileStore:

    bam1-01_create_file_store

  3. 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:

    bam1-02_file_store_target

  4. Click Finish.

Create a JMS Server

  1. Select JMS Servers.
  2. Create a new JMS Server named PaymentJMSServer:

    bam1-03_payment_jms_server

  3. Select the PaymentJMSFileStore Persistent Store:

    bam1-04_select_persistent_store

  4. Target the file store to soa_server1 and click Finish.

Create a JMS Module

  1. Select JMS Modules.
  2. Create a new JMS Module named PaymentJMSModule:

    bam1-05_create_jms_module

  3. 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:

    bam1-06_target_jms_module

  4. Click Next and select Would you like to add resources to this JMS system module? and click Finish:

    bam1-07_add_resources

    This will take you directly to the page where you can added resources.

Create JMS Resources

Subdeployment

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.

  1. Click the Subdeployments tab create a new subdeployment named PaymentSubdeployment:

    bam1-08_create_payment_subdeployment

  2. Target the subdeployment to the PaymentJMServer we just created:

    bam1-09_target_subdeployment

Queue

  1. Switch to the Configuration tab and create a new Queue named PaymentQueue with the JNDI Name of jms/PaymentQueue:

    bam1-10_create_payment_queue

  2. Select the PaymentSupdeployment we just created and click Finish:

    bam1-11_select_subdeployment

Connection Factory

  1. Create a new Connection Factory named PaymentConnectionFactory with the JNDI Name of jms/PaymentConnectionFactory and click Finish.

    bam1-12_create_connection_factory

Step 2: Configure the JMS Adapter

The JMS Adapter from the ValidatePayment SOA composite will connect via this connection.

  1. Select Deployments.
  2. 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:

    bam1-13_create_outbound_connection

  3. Set the JNDI Name to eis/jms/PaymentQueue and click Finish:

    bam1-14_jndi_name

  4. Change the plan file name to JMSPlan.xml and save the Deployment Plan:

    bam1-15_save_deployment_plan

  5. 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.

    bam1-14_connection_factory_location

  6. Return to deployments, select the JmsAdpter and select Update and then Finish:

    bam1-16_update_jmsadapter

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.

  1. 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.

  1. Open the ValidatePayment composite.
  2. Drag and drop a JMS Adapter into the External References lane. Name the reference Produce_Message:

    bam1-17_jms_adapter

  3. Select Oracle Weblogic JMS as the Oracle Enterprise Messaging Service (OEMS):

    bam1-18_oems

  4. Select SOA_Domain as the AppServer Connection:

    bam1-19_app_server

  5. For the Interface, select Define from operation and schema (specified later). This will be the PaymentForBAM.xsd we created above:

    bam1-20_interface

  6. Select Produce Message as the Operation Type and name the operation Produce_Message:

    bam1-21_produce_message

  7. Browse for Destination Name and select the PaymentJMSModule PaymentQueue (queue):

    bam1-22_browse

  8. For the JNDI Name, use the JNDI browser to ensure the name has been set up correctly in the directory:

    bam1-23_browse_jndi

    Your Produce Operation Parameters should appear as follows:

    bam1-24_produce_operation_parameters

  9. On the Messages page, browse and select the PaymentAuthorizationType from the PaymentForBAM.xsd that we created earlier:

    bam1-25_payment_authorization_type

    Your Messages page should appear as follows:

    bam1-26_messages

  10. Click Next and Finish to complete the wizard.
  11. Wire the JMS Adapter to the Composite. The composite should now look as follows:

    bam1-27_wire

Invoke the JMS Adapter

  1. Open the validatePaymentProcess BPEL component.
  2. Drag and drop and Invoke before the replyOutput and name it Invoke_Produce_Message.

    bam1-28_invoke

  3. 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.

    bam1-29_edit_invoke

  4. Click OK to close the Edit Invoke dialog.
  5. Drag and drop and Assign before the Invoke_Produce_Message and name it setMessageValues.
  6. 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:

    bam1-30_edit_assign

Step 4: Deploy and Test

  1. Save All and Deploy ValidatePayment to the SOA_Domain.
  2. Switch to Enterprise Manager Fusion Middleware Control and navigate to the Test Web Service page of the ValidatePayment composite.
  3. Browse and select the PaymentInfoSample_Authorized_soap.xml and click Test Web Service.
  4. 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:

    bam1-31_monitoring

  5. Select the PaymentJMSModule!PaymentQueue and click Show Messages to see the Summary of JMS Messages:

    bam1-32_summary_of_messages

  6. Click the message ID to view the message details:

    bam1-33_message_detail

Excellent, we now have data being published to a JMS queue. In Part 2, we will consume this data for business analysis.

 

 

 

Advertisements

2 thoughts on “An Introduction to Oracle Business Activity Monitoring (BAM) – Part 1: Message Production

  1. Pingback: An Introduction to Oracle Business Activity Monitoring (BAM) – Part 2: Message Consumption | W Brian Leonard

  2. Pingback: An Introduction to Oracle Business Activity Monitoring (BAM) – Part 3: Dashboard Design | W Brian Leonard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s