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.
The steps described in this article:
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).
Target the JMSportServer to the appropriate WLS Server. In my case – lazy approach – that is the AdminServer
Next, define a new JMS Module SportsModule.
In the module, create the JMS artifacts jms/sportsCF and jms/volleyballChannel.
Create a subdeployment in the module:
and target the subdeployment to the JMS Server:
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:
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:
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:
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:
Save the changes.
Next, start the Enterprise Message Resource:
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:
5. Create an ADF application
Start JDeveloper, create a new Fusion Web Application. Nothing special at all.
6. Configure a BAM Data Control on top of the BAM Data Object
First, we need to create a connection to the BAM Server:
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.
Choose the Flat Query style for the BAM Data Control:
Define no parameters:
And not calculated fields either:
Select all fields to be included in the Data Control:
And finally refrain from defining any filters:
Click the Finish button to create the Data Control.
7. Create a web page with a Line Graph based on the BAM Data Control
Create a new JSF page:
Drag the Query in the BAM Data Control to the page and drop it as a Graph:
Configure the graph – let’s say a line chart:
Two lines should be displayed, one based on the score for team one and the other based on the score for team two:
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:
Download the JDeveloper application workspace with the MatchReporter and the ADF Web app with the BAM Data Control and the line graph: .
2 thoughts on “Live match report using JMS, BAM, ADF Push and Data Visualization”
Can you please share the download link. Thanks in advance.
Can you please point me to code download link
Comments are closed.