Home > Complex Event Processing, Java, Oracle > Oracle Event Processing – Pattern Matching Example 2

Oracle Event Processing – Pattern Matching Example 2

In previous post I showed off one of the pattern matching feature of Oracle Event Processing and in this section I am gonna show another example of it.

There are many built-in functions which can be used in CQL. I think one of the most important these functions is the prev function. Prev function facilitates accessing the previous elements in the same stream/partition easily.

Consider this scenario, we have stock values as below and I would like to find out the pattern; firstly average value of previous 3 elements should be greater than 10 and the last value greater than the last value of the previous condition.

If we want to write to CQL code of our requirements it would look like:

CQL Example

With numbers lets try to understand how the pattern can be matched ( left side: incoming events; right side: expression about pattern matching):

Events and patterns

 

Run the application:

output

As shown in above, after the 13 and 33 pattern has been matched and output was produced.

 

 

  1. No comments yet.
  1. No trackbacks yet.

Leave a comment