[rules-users] Howto obtain collection of all matched events in rule

IK81 ml at kofler.me
Mon Sep 30 10:29:18 EDT 2013


I already use the accumulate. Perhaps this example of a rule will 
clarify my issue:

when
   // match a device
   $d : Device ()
   // if there are more than 5 offline events for that device within the 
last 15 minutes
   $x : Number(intValue >= 5)
        from accumulate ( $e : OfflineEvent (deviceId == $d.id) over 
window:time(15m), count ($e))
   $y : SpecialEvent (deviceId == $d.id, code=10)
then
   ... here I need a collection of all events that caused the rule to 
fire
   ... this means all accumulated offline events and the special event

I registered an AgendaListener and get this kind of collection via the 
Match object. But how do I access this
object directly in the rule?

Best Regards,
Ingo


On 2013-09-30 16:05, Wolfgang Laun wrote:
> Have you considered "accumulate" and "from collect"? Or perhaps I
> misinterpreted the question...?
> -W
>
> On 30/09/2013, IK81 <ml at kofler.me> wrote:
>> Dear all,
>>
>> I am looking for a convenient way to obtain all events that lead to 
>> the
>> firing of the rule in the then-part of a rule. I know that I can 
>> build
>> this collection by explicitly creating a collection and adding all 
>> the
>> events listed in the when part, but I am looking for something more
>> convenient.
>>
>> I already discovered that one can access this information in the
>> beforeMatchFired event through getMatch().getObjects(), but I need 
>> to
>> access this in the then-part of the rule. How do I obtain the match
>> object there?
>>
>> Best regards,
>> Ingo
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users



More information about the rules-users mailing list