0

We trying to implement timeseries which will have per hour counts of events. We wanted to do per hour counts in CEP and store the output in a datastore/nosql. What is missing is we wanted to store is counts for each hour for a given day.

For this we need to output current timestamp from CEP everytime the timebatch window expires.

Can somebody pls explain how to achieve this with WSO2 CEP ??

Thanks RP

Community
  • 1
  • 1
Rajiv Patil
  • 129
  • 8

3 Answers3

0

I think that you should use BAM instead of CEP, since what you are trying to do looks more like a map-reduce job.

Did you give it a look?

Philippe Sevestre
  • 974
  • 12
  • 18
0

Hope you are you are using WSO2 CEP 3.1.0. At the moment WSO2 CEP 4.0.0 under development, once WSO2 CEP is released, there will be an RDBMS publisher (output adapter) where you can specify the connection and publish output stream values directly.

You can have an execution plan with a siddhi query to implement the timestamp logic. To learn more about siddhi query language please refer WSO2 Siddhi documentation.enter link description here

Following is a sample execution plan with a siddhi query for check room temperature values for within given time window (1 min) and write average temperature along with room number to output stream. If you want to store those in database you can have an RDBMS publisher (output adapter) for output stream.

             /* Enter a unique ExecutionPlan */
            @Plan:name('testPlan')

            /* Enter a unique description for ExecutionPlan */
            -- @Plan:description('ExecutionPlan')

            /* define streams and write query here ... */

            @Import('inStream:1.0.0')
            define stream inStream (temperature double, roomNumber int);

            @Export('outStream:1.0.0')
            define stream outStream (temperature double, roomNumber int);

            from inStream#window.time(1 min)
            select avg(temperature) as temperature,roomNumber
            group by roomNumber
            having temperature>= 70
            insert into outStream;
Tharik Kanaka
  • 2,490
  • 6
  • 31
  • 54
0

You can use time:currentTime() extension at the select to get the time of expiry of the time window from Siddhi 3.0/WSO2CEP 4.0. For a sample have a look at the this test case.

suho
  • 912
  • 6
  • 12