Live match report using JMS, BAM, ADF Push and Data Visualization image

Live match report using JMS, BAM, ADF Push and Data Visualization

Real time events can be translated into a live visual representation using a largely declarative approach. Events can be published for example on a JMS Topic. Using Oracle BAM (Business Activity Monitor, component of the SOA Suite), this JMS Topic can be subscribed to. The events arriving on the Topic are used to update a BAM Data Object in the Active Data Cache. ADF provides a BAM Data Control that can be defined against the BAM Data Object. ADF Data Visualization Components support an active mode that does automatic server push to the browser. Using these DVT components, it is straightforward to create charts that are live updated in the browser.

Welding these components together, this article will explain how we can create a streaming line chart that represents the score in a volleyball match.

image 

The steps described in this article:

  • configure JMS artifacts (Topic, Connection Factory, Module, Server and Subdeployment)
  • create the Java application representing the match reporter and publishing messages to the topic
  • create a BAM Data Object
  • create a BAM Enterprise Message Resource, mapped to the JMS Map Message published by the Java reporter application
  • create an ADF application
  • configure a BAM Data Control on top of the BAM Data Object
  • create a web page with a Line Graph based on the BAM Data Control
  • run the ADF application and start the volleyball match
  • The details:

    1. Configure JMS artifacts (Topic, Connection Factory, Module, Server and Subdeployment)

    Go to the WebLogic Administration Console and create a new JMS Server JMSSportsServer. Specify which storage to use for the server. In this case I have taken the easy way and piggybacked on the file storage already set up for the SOA Suite (only because this is a prototype).

    image

    Target the JMSportServer to the appropriate WLS Server. In my case – lazy approach – that is the AdminServer

    image

    Next, define a new JMS Module SportsModule.

     

    In the module, create the JMS artifacts jms/sportsCF and jms/volleyballChannel.

    image

    Create a subdeployment in the module:

    image

    and target the subdeployment to the JMS Server:

    image

    Activate all changes. The JMS setup in WebLogic is now complete.

    2. Create the Java application representing the match reporter and publishing messages to the topic

    Create Java Class MatchReporter. This class simulates a volleyball match and all points scored in that match. Each point scored is reported as a JMS Map Message to the volleyballChannel JMS Topic:

    image

    The helper classes JMSMessageProducer (code is in the source download at the end of this article) and JMSDestinationHandler facilitate the interaction with the remote JMS Topic.

    We already can test the set up: if we run the MatchReporter, we should be able to find JMS messages published to the volleyballChannel topic in the WebLogic console.

    3. Create a BAM Data Object

    Start Oracle BAM in Internet Explorer – in 11g the only supported browser. Create a new Data Object, for example VolleyballScore, defined as follows:

    image

    note that the fields in the data object correspond by and large to the properties written in the JMS Map Message by the MatchReporter class.

     

    4. Create a BAM Enterprise Message Resource, mapped to the JMS Map Message published by the Java reporter application

    BAM consumes JMS messages into Data Objects through an Enterprise Message Resource. Configure such an EMS in BAM Architect like this:

    image

    Provide the details of the JMS Topic that the EMS should subscribe to. Specify the JMS Message Type (Map or XML); as MatchReporter publishes Map messages, we definitely need to select MapMessage. Specify which Data Object will be updated from the messages received from the topic – in this case the VolleybalScore Data Object. Each new MapMessage on the JMS Topic should result in a new record in the Data Object – hence the Operation set as Insert.

    Then, on the same page, specify the mapping between properties in the JMS Map Message, as specified in the MatchReporter class, and the fields in the BAM Data Object VolleyballScore:

    image

    Save the changes.

    Next, start the Enterprise Message Resource:

    image

    If you do not start the EMS, no messages will be received and nothing happens to the Data Object.

    Here we have another test opportunity: run the MatchReporter class and verify whether records are created in the BAM Data Object:

    image

     

    5. Create an ADF application

    Start JDeveloper, create a new Fusion Web Application. Nothing special at all.

    image

    6. Configure a BAM Data Control on top of the BAM Data Object

    First, we need to create a connection to the BAM Server:

    image

    When the connection is created, we can browse the contents of the BAM Server and inspect the Data Objects.

    Next, we create a BAM Data Control, from the context menu on the VolleyballScore data object.

    image

    Choose the Flat Query style for the BAM Data Control:

    image

    Define no parameters:

    image

    And not calculated fields either:

    image

    Select all fields to be included in the Data Control:

    image

    And finally refrain from defining any filters:

    image

    Click the Finish button to create the Data Control.

    image

    7. Create a web page with a Line Graph based on the BAM Data Control

    Create a new JSF page:

    image

    image

    Drag the Query in the BAM Data Control to the page and drop it as a Graph:

    image

    Configure the graph – let’s say a line chart:

    image

    Two lines should be displayed, one based on the score for team one and the other based on the score for team two:

    image

    The id – although perhaps an auto-generated timestamp in the Data Object would have been a better idea – is used for the x-axis.

    Close the graph editor. Save all changes.

    8. Run the ADF application and start the volleyball match

    Once the web application is running, we can run the MatchReporter class. It starts publishing scores to the JMS Topic, the BAM Data Object gets updated and these changes are pushed to the ADF application that in turn pushes them to the browser to live update the the chart, allowing us to witness the match in real time:

    image

     

    Resources

    Download the JDeveloper application workspace with the MatchReporter and the ADF Web app with the BAM Data Control and the line graph: .

    2 Comments

    1. satyaobiee November 28, 2014
    2. Vatican October 13, 2014