简体   繁体   中英

WSO2 CEP :Siddhi QL: Can i access multiple attributes in a single execution plan

I am pretty new to WSO2 CEP Siddhi QL, I got a requirement to analyze the events of multiple node with multiple parameters. Is this possible with siddi ? if yes, How can I achieve it .?

Execution Plan

@Plan:name('ExecutionPlan')

@Import('InputStream:1.0.0')
define stream InputStream (node string, param1 int, param2 double, param3 string, param4 string, param5 string, param6 string, param7 string,......,param120 string);

@Export('outputStream:1.0.0')
define stream OutputStream (val1 string, param3 string);

from InputStream [(node == 11 AND Param2 < 110) 
                            AND 
                   (node == 12 AND Param3 > 40)
                              AND 
                   (node == x AND Paramx > some value)] #window.time(1 sec)
select node as val1, param2 as param2, param3 as param3  
insert into OutputStream;

As i have to wait to get the data of other nodes.How to handle multiple events..?

I don't think this is possible with Siddhi. Siddhi will process "per event" basis and therefore, such filters which require input from multiple events cannot be evaluated.

However, If you know the event arrival order (ie node 11 followed by node 12, etc...), and node count then you can use Siddhi patterns to achieve this;

eg:

from every( e1=InputStream[node == 11 AND Param2 < 110] ) -> e2=InputStream[node == 12 AND Param3 > 40] -> eX=InputStream[node == X AND ParamY > ZZ]
select e1.node as val1, e1.param2 as param2, e2.param3 as param3
insert into OutputStream;

It is Possible to Access Multi-Node with Multi-Parameter by splitting the Stream into multiple and you can access it. This is done by using patterns from WSO2.

from every (e1=InputStream) -> (e2=InputStream)-> e3=InputStream[(e1.node == '11' AND e1.param1 > 500 AND e1.param2 > 1000 ) AND (e2.node =='12' AND e2.param3 > 200 AND e2.param1 < 100)] within x mins

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM