StreamExplorer pushing findings as JSON messages to a WebSocket channel for live HTML Dashboard updates image35

StreamExplorer pushing findings as JSON messages to a WebSocket channel for live HTML Dashboard updates

A common desire when doing real time event processing with Stream Explorer and/or Oracle EVent Processor is the ability to present the findings from Stream Explorer in a live dashboard. This dashboard should hold a visualization of whatever information we have set up Stream Explorer to find for us – and it should always show the latest information.

User interfaces are commonly presented in web browsers and created using HTML(5) and JavaScript. As part of the HTML5 evolution that brought today’s browsers, we now have the ability to use Web Sockets through which we can push information from server to browser to have the user interface updated based on messages pushed from the server. This allows us to create a dashboard that listens from the browser to a Web Socket and use whatever messages appear on the web socket to actualize the user interface. Such a dashboard and its implementation using standard Java (EE) was discussed in a recent article: Java Web Application sending JSON messages through WebSocket to HTML5 browser application for real time push. The results from that article provide the foundation for this article you are reading right now.

We will create a Stream Explorer application that exposes a REST interface to which we will publish JSON messages (in this example using SoapUI as the client from which to generate the test events). These messages report on groups of people entering or leaving a specific room in a movie theater. The exploration we create will aggregate the information from the messages – providing us with a constant insight in the total number of people in each room. This information is subsequently pushed to the REST service exposed by a Java EE application that routes that information across the web socket to the HTML5 client. The next figure illustrates the application architecture:

image

In this article, we will assume that Java EE application including the dashboard are already available, as described in the referenced article. All we need to do is

  • Create a Stream exposed as (inbound) REST interface – discussed in this article.
  • Create an Exploration on top of this Stream – to aggregate the events from the Stream.
  • Configure a target for this Exploration using the outbound REST adapter (an example of which is discussed here) and publish the exploration.
  • Run the Java EE application, open the dashboard and publish messages to the Stream Explorer REST service; watch the dashboard as it constantly updates to reflect the actual status

 

After configuring the Stream (as discussed in this article), create an exploration, for example called CinemaExploration. Create a Summary of type SUM based on the property partySize and group by room. Edit the Properties and change the name of property SUM_of_partySize to occupation. The exploration will look like this:

 

image

We can start pushing some messages to it from SoapUI:

image

based in part on twice sending this SoapUI request:

image

 

Next, click on Configure a Target.

image

Select type REST and set the URL

image

Click on Finish.

Publish the Exploration.

image

 

The dashboard is opened:

image

Now we can run a test case in SoapUI to send test messages to the Stream Explorer application:

image

 

Here is what the live output stream in the Stream Explorer UI shows next to a screenshot taken of the Cinema Monitor dashboard:

image

The dashboard is constantly updated with the most recent finding published by Stream Explorer.Note: the notion of having a negative occupancy is one that will require some explaining! I(more careful test data management seems to be called for)

After running some more of the SoapUI Test Cases that publish cinema events to the REST ful entry point to the Stream Explorer application, the situation is as follows:

image