Monday, March 30, 2015

#387 StreamExplorer --> Source - JMS / Target - JMS


In this blog post I detail the setup/creation of a JMS Stream.
I will create a JMS client that writes credit card TXs to a Queue.
This queue will then be the source for my Stream -

JMS Queue Setup

I need to create the queue and the connection factory via the WLS console.

JMS Client

This is a simple Java JMS client that creates a Map Message to log a credit card transaction.
The input fields are –
  • ccNr – credit card number
  • cardholder
  • merNr – merchant number
  • merCountry – merchant country
  • txAmt – transaction amount.

Note how these map to the message –

The full JMS client code is available here

Test the JMS Client


I have exposed the JMS client as a web service and then called
it from a SOA Composite.

This is essentially a BPEL process that calls the JMS client n times.

The JDev App containing the JMS Client and the SOA project is available here

Now I have 10 messages in the queue.

Create the Stream Explorer artifacts

First I create the Stream -

 Specify the connect info.

Now manually define the shape of the message being received -

Now define the Exploration -

Execute the composite to ensure you have JMS messages.
Then check the Live Output Stream for the transactions -

Create the JMS Target Queue via the WLS console

Here I create a queue called CCTXOutQueue

I now add a target to the Exploration.

Publish the Exploration -

Test again - I execute the composite specifying 10 transactions -

I monitor the out Q -

Tuesday, March 24, 2015

# 386 Stream Explorer - Targets --> Type: CSV File

According to the ORCL docs -

Every exploration must be configured with a target to send the details downstream. Unless the exploration is published, you cannot send the events downstream to the configured target.

Ok, so Targets are required to send data downstream, e.g. via EDN to a SOA composite, or simply via a file. Before we look in detail at Targets, a word about the difference between draft and published.

Per default, Stream Explorer explorations are created as draft.

Again, to quote the docs -

The draft exploration is not available to other users of the application. An exploration moves to a published state when it is published. When a published exploration is deleted or unpublished, the exploration moves to a draft state.

Now that we have cleared that up, let's move on to Targets -

Let's look at our simple exploration again -

I want to write this data to a file so I set up the following Target -

I now have to Publish the Exploration -

Note the Exploration has status Published.

Now, where is the output file?

Here is the data -

#385 Stream Explorer - Preferences

In the previous posts I have covered data manipulation via summaries, group by, filters etc.
I also demonstrated the use of a simple time window - analysing orders over a rolling 5 minute time window.

Now I would like to take a step back and look at the Stream Explorer Preferences and what we can do with them.

Under General - we can set the default page after login -

Amending this setting to Catalog results in me being re-directed directly to the Catalog list after login.

View Mode allows us to select between the following -

Browser and Projector.

Selecting Projector will apply a different skin, appropriate when viewing the app on a projector.

Maybe you can notice the subtle difference.

Notifications -

You are usually notified via a popup box on the UI, when you create, amend artifacts in Stream Explorer. If you do not want to see these messages, then de-select the above.

Catalog -

Let's us configure how we want to view the Catalog.

I want to see my Favourites first -

Exploration / Live Output Stream -

Here I can set the number of rows to be displayed.
Note, the default is 100.

Monday, March 23, 2015

#384 Stream Explorer - References

Let's go back to our order exploration app -

Remember, this is what our input file looked like.

Now, as chance would have it, I have a DB table which contains the inventory status of
our products. We can add data from this table to our exploration as a reference.

To begin with, we need to add a data source definition to OEP -

Now I go to Stream Explorer and create the Reference -

Now we can add this to the Exploration

Just click on the Sources panel -

We now need to add a correlation between the two sources -

Join on Product -

I delete the summary, group by and filter -

Product is listed twice, but we can solve this easily -

Note the colour coding above.

#383 Oracle Stream Explorer / OEP basics

Just to demo Stream Explorer interaction with OEP -
I login to the OEP console -

Note the url http://localhost:9002

Check out the domain -

Here we see the app, created in the previous post -

We see the csv inbound adapter etc.

Now I will show you how to export the app, created in Stream Explorer, and then how
to import the very same app into JDeveloper 12c.

I open the Exploration in Stream Explorer and then click on Actions -
I select Export.

I copy this jar to my OEP home for housekeeping purposes.

I now start JDeveloper and then import the OEP bundle.

First I create an OEP application with a default project.
I then delete the project.

I now do the import -

Point to the exported jar -

Here is the imported App -

Here is the EPN diagram -

Before we check out the generated CQL, here is the query definition
from Stream Explorer  -

Remember, we are looking at the total spend of individual customers,
over a rolling time window of 5 minutes. We are only interested in high
spenders, i.e. those spending more than 10K.

This is our business user friendly definition from Stream Explorer -

Here is the generated CQL in the OEP app -

Great stuff, this Stream Explorer!