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.
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:
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:
We can start pushing some messages to it from SoapUI:
based in part on twice sending this SoapUI request:
Next, click on Configure a Target.
Select type REST and set the URL
Click on Finish.
Publish the Exploration.
The dashboard is opened:
Now we can run a test case in SoapUI to send test messages to the Stream Explorer application:
Here is what the live output stream in the Stream Explorer UI shows next to a screenshot taken of the Cinema Monitor dashboard:
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: