Quick Introduction to Oracle Stream Explorer Part Two– Business User friendly processing of real time events (enrichment, calculation) image88

Quick Introduction to Oracle Stream Explorer Part Two– Business User friendly processing of real time events (enrichment, calculation)

Very recently, Oracle released the Oracle Stream Explorer product, available from OTN. With Oracle Stream Explorer, business users and citizen developers as well as hard core developers can create explorations on top of live streaming data to filter, enrich, aggregate, inspect them and detect patterns. Stream Explorer provides a business user friendly browser based user interface in which streams are configured, explorations are composed, enrichment is set up and publication to external consumers is defined. Note that Stream Explorer is built on top of Oracle Event Processor – any Stream Explorer exploration is in fact an OEP application. It can be exported as such and refined in JDeveloper. As such, Stream Explorer is also a great way to get going with OEP.

Quick Introduction to Oracle Stream Explorer Part Two– Business User friendly processing of real time events (enrichment, calculation) 2447589

In a previous article, I introduced the very first steps with Stream Explorer. In this article, I set up a stream of events that report people entering or leaving the rooms of a small conference event. The use case is: we are organizing a small conference. In three rooms, sessions take place simultaneously. Our attendees are free to decide which session to attend. We would like to know at virtually any moment how many people are in each room. We have set up simple detectors at the doors of the rooms that produce a signal whenever someone enters or leaves the room. This signal consists of the room identifier (1,2 or 3) and an IN/OUT flag (values +1 or -1).

Quick Introduction to Oracle Stream Explorer Part Two– Business User friendly processing of real time events (enrichment, calculation) conference hall belgrade 4 v

In this first article, I used StreamExplorer to process these events and produce an aggregate per room of the net number of people that entered or left the room. In the article you are reading right now, we will continue from where we left off. We will add enrichment – using a database table with room details that are correlated with the room events and the room capacity is to be used to explore the room occupancy rate and detect Standing Room Only rooms (next article). We will see that not only can we use a stream as the source for an exploration, we can also use one exploration as the source for the next – and correlate explorations in creating a new exploration.

Preparation

I am assuming Stream Explorer is installed on top of the OEP server and that the server is running. Stream Explorer can be accessed at http://host:port/sx. The same file with room events is used as in the previous article. Additionally, a table is created in database schema. It holds details about the rooms used for our conference.

create table rooms
( id number(3,0)
, name varchar2(50)
, maximum_capacity number(3,0)
)

And the data stored in the table

image

In order for Stream Explorer to access database tables, a Data Source has to be configured. This can be done through the Visualizer browser application for OEP, accessible at http://host:port/wlevs.

image

Login. Click on the node defaultserver and on the tab Data Sources.

image

Click on the Add button to create a new Data Source.

Provide the name and the jdbc name for the data source. Set the Global Transaction Protocol to One Phase Commit.

image

Open the Global Transaction Protocol tab. In my case, the database is of type Oracle, hence the following settings:

image

Open the tab Connection Pool. You can specify a query to test the connection:

image

when done, press Save to create the data source. You can now exit the Visualizer again.

 

And Action

In order to be able to use the data from the ROOMS table for enrichment, we have to create a Reference object in Stream Explorer.

In SX, on the Catalog page, create a new item of type Reference.

image

Provide the details for the new reference:

image

Select the data source

image

Select the database table (ROOMS) and click Create:

image

The new Reference object is created:

image

 

Enrich Exploration

With the Rooms reference at our disposal, we can now create a new exploration that uses the findings from NetRoomFlow and enriches them with room details as well as the data to calculate the room occupancy percentage. NOTE: I have not yet figured out how to add a property based on an expression or formula. I have high hopes that this will indeed prove possible.

Create a new Exploration:

image

Enter details and select exploration NetRoomFlow as the source for this new exploration:

image

Press create.

The Exploration page appears. Click on the sources field and select the Rooms reference to add as a source.

image

Configure the correlation condition:

image

RoomId in the NetRoomFlow source should match with Id in the Rooms source.

Next, you can organize the properties reported from the exploration – change their names and the order they are listed in or whether they are listed at all:

image

These settings influence the appearance of the exploration to external targets as well as to downstream explorations using this one as their source.

 

Behind the scenes

When you login to the Visualizer tool, you will find that each exploration (as well as stream and reference) corresponds with an actual OEP application deployed to the OEP server. In fact, every version that is published from SX results in a separate OEP application:

image

We can inspect these OEP application to see how our actions as a business user or citizen developer have been translated by Stream Explorer in OEP configuration and CQL statements. This can be very instructive for when we want to learn how to develop OEP applications of our own.

SNAGHTML3f8a42f