admin管理员组

文章数量:1391947

Please use Drools to write an association rule with the following requirements: There are four Event objects A, B, C, and D that arrive within a time window of 10 seconds, and in no particular order (random order). In Flink streaming processing, the processing mode is:

KieHelper kieHelper = new KieHelper();
kieHelper.addContent(drl, ResourceType.DRL);
KieServices kieServices = KieServices.Factory.get();
KieBaseConfiguration config = KieServices.Factory.get().newKieBaseConfiguration();
config.setOption(EventProcessingOption.STREAM);

class Event {
   int a;
   int b;
   int c;
   int d;
}


Conditions to be met:
When event A arrives, A.a>100 is satisfied
When event B arrives, B.b<100 is satisfied
When event C arrives, C.c>20 is satisfied
When event D arrives, D.d==10 is satisfied

The associated conditions must be met:
A.b==C.d && B.a==D.c

If the above conditions are met within the time window of 10 seconds, the alarm rule will be triggered. Please write the rule below, requiring high performance under streaming processing.

I tried to use drools cep grammar rules to write such a rule, but failed. I hope the experts in the forum can help me write this multi-event association rule. Thank you.

本文标签: How to implement multievent object association rules in drools cepStack Overflow