1

Can we have conditional statements like below in wso2 cep execution plan.

from stream1
select distinct attr1
insert into newStream1;

from stream2
select distinct attr2
insert into newStream2;

if

count(attr1) == count(attr2)

then 

-- do something

else 

-- do something else

Use case explained:

Let's say I have execution plan which takes data from 3 different streams. Stream 1 gives data from device 1, stream 2 from device 2, ... so on.

I have a table stored in database already which stores total number of devices. In this case it stores 3 devices.

Now in the execution plan I get the data for a window of 5 minutes. And within this 5 minutes, only when I get data from all 3 streams, then only it should process the data. Else it should not.

If within 5 minutes window I get data from only 2 streams, then execution plan should discard it.

Community
  • 1
  • 1
Anshul Gupta
  • 490
  • 4
  • 8
  • Welcome to SO. You may want to provide a bit more concrete example in your question. If you have already tried to write something you want, would you please share that? Then, people will be able to help you out. – jazzurro Sep 25 '14 at 06:04
  • Hi jazzurro. I tried explaining my use case above. Let me know if that information is not sufficient or needs more clarity. – Anshul Gupta Oct 01 '14 at 06:25

1 Answers1

0

You can use filters to implement this use case. Add a query with a filter that has the 'if' part and then another query that has the 'else' condition in the filter. You can use the outputs of these queries to do different types of processing separately. You can use chains of queries for complex scenarios.

Rajeev Sampath
  • 2,739
  • 1
  • 16
  • 19