Hello,<div><br></div><div>I'm still quite new to the drools stuffs just getting the examples running. I'm sorry if my question is too basic.</div><div>I have a system that will continuously to receive events sent from some other system. Basically I have two types of events, eventA and eventB. </div>
<div>Both eventA and eventB have two properties, index and timestamp.</div><div><br></div><div>What I want is to capture a pattern to meet the following conditions</div><div><br></div><div>1. every 3 consecutive eventsA without any eventB in between having a same index value ordering by their timestamp. </div>
<div><br></div><div>2. all events in a matched pattern will have the same value of property index.</div><div><br></div><div>3. if a pattern is matched, any of the events in this pattern should not be used again for a new matching.</div>
<div><br></div><div>there are some examples below, the number after a colon stands for the value of its index number and assume those events are already ordered by their timestamp.</div><div><br></div><div>eventB:2 eventA:1 eventA:1 eventA:1 eventB:3 --------- one successful match, we have three eventA with same index value 1 in a row</div>
<div><br></div><div>eventB:2 eventA:1 eventA:1 eventB:1 eventA:1 --------- no match because there's an eventB in between</div><div><br></div><div>eventB:2 eventA:1 eventA:1 eventB:2 eventA:1 --------- one successful match because the in-between eventB has a different index value</div>
<div><br></div><div>eventA:1 eventA:1 eventA:1 eventA:1 eventA:1 --------- only one match, because once matched, the events can not be used for a second match again.</div><div><br></div><div><br></div><div>
I just don't know how to write a rule like this. Is there anyone who can shed some lights on?</div><div><br></div><div>Best Regards,</div><div>Kevin</div><div><br></div><div><br></div>