[rules-users] Accumulate a on event combinations

gboro54 gboro54 at gmail.com
Wed Oct 3 13:54:28 EDT 2012


Understood. Basically EventA is a connection lost event and EventB is a
connection reopened event. In some situations the connection may be try
several times and in this case we want to notify the system of a "pulsing"
connection. So the ClosedConnectionEvent happens and then if a
OpenConnectionEvent happens within 5 seconds we do nothing(if it's after 5
second we tell the system and a failover would occur).  With that in mind I
feel this will accomplish what I am looking for...thoughts?


rule "Pulsing Connection"
when
    accumulate($close:ConnectionEvent(connectionEventType ==
ConnectionEventType.CLOSE, $closedConnectionId:connectionInformationId) 
                and ConnectionEvent(connectionInformationId==
$closedConnectionId,connectionEventType == ConnectionEventType.OPEN, this
after [0s,5s] $close);
                $count: count($close); 
                $count>1)
then
	//TODO: Disconnect and go to failover
   
end



laune wrote
> The number of "*pairs *of events A, B in the last 5 seconds" (according
> to your first post)  is not what you have formulated in  your rule "Raise
> alarm".
> This rule (if it were possible to write in this way) appears to count
> EventAs,
> where there is a (== at least one) matching (same id) EventB in the next 5
> seconds, without any limit into the past.
> 
> If you are sure that after an EventA there is at most one matching EventB,
> it might simplify matters.
> 
> Anyway, make sure to get the requirements right, otherwise it's just
> groping in the dark.
> 
> -W
> 
> 
> On 3 October 2012 19:31, gboro54 <

> gboro54@

> > wrote:
> 
>> I thought it was? Perhaps I worded it wrong. I need to do something
>> similar
>> to what I stated but the accumulate doesn't want to take the syntax
>> stated
>> below. Perhaps this is not possible or I am doing something wrong?
>>
>>
>> laune wrote
>> > On 03/10/2012, gboro54 <
>>
>> > gboro54@
>>
>> > > wrote:
>> >> Doesn't accumulate have a count by itself? I guess I am trying to
>> figure
>> >> out
>> >> if it is possible to do something like:
>> >
>> > Possibly, but that's not what you were asking for in your first post.
>> >
>> >>
>> >> rule "Raise alarm"
>> >> when
>> >>    Number( intValue> 5) from
>> >>     accumulate(  $a:EventA( $id:id )
>> >>                       EventB(eventAId=$id, this after [0s,5s] $a);
>> >>                 count($a) )
>> >> then
>> >>     //do stuff
>> >> end
>> >>
>> >>
>> >> laune wrote
>> >>> An accumulate with explicitly coded init/action/result lets you
>> >>> accumulate
>> >>> into
>> >>> a custom object that provides exactly the information you want: just
>> >>> that there is a matching number of As and Bs, the counts for As and
>> >>> Bs, two lists with As and Bs - anything.
>> >>>
>> >>> See the Expert doc - there's an example for this sort of thing.
>> >>>
>> >>> -W
>> >>>
>> >>> On 03/10/2012, gboro54 <
>> >>
>> >>> gboro54@
>> >>
>> >>> > wrote:
>> >>>> We are using expert and fusion to monitor connection events in our
>> >>>> system.
>> >>>> We
>> >>>> would like to know the most efficient way to know that X number pair
>> of
>> >>>> events have happened in a certain example(i.e eventA and eventB
>> >>>> occurred
>> >>>> 4
>> >>>> times each in the 5 seconds). What is the most efficient way to do
>> >>>> this?
>> >>>>
>> >>>> I
>> >>>> don't believe an accumulate would allow a combination of objects but
>> I
>> >>>> may
>> >>>> be wrong. Perhaps a live query invoked by a rule?
>> >>>>
>> >>>>
>> >>>>
>> >>>> --
>> >>>> View this message in context:
>> >>>>
>> http://drools.46999.n3.nabble.com/Accumulate-a-on-event-combinations-tp4020104.html
>> >>>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> >>>> _______________________________________________
>> >>>> rules-users mailing list
>> >>>>
>> >>
>> >>> rules-users at .jboss
>> >>
>> >>>> https://lists.jboss.org/mailman/listinfo/rules-users
>> >>>>
>> >>> _______________________________________________
>> >>> rules-users mailing list
>> >>
>> >>> rules-users at .jboss
>> >>
>> >>> https://lists.jboss.org/mailman/listinfo/rules-users
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://drools.46999.n3.nabble.com/Accumulate-a-on-event-combinations-tp4020104p4020107.html
>> >> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> >> _______________________________________________
>> >> rules-users mailing list
>> >>
>>
>> > rules-users at .jboss
>>
>> >> https://lists.jboss.org/mailman/listinfo/rules-users
>> >>
>> > _______________________________________________
>> > rules-users mailing list
>>
>> > rules-users at .jboss
>>
>> > https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/Accumulate-a-on-event-combinations-tp4020104p4020114.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> 

> rules-users at .jboss

>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
> 
> _______________________________________________
> rules-users mailing list

> rules-users at .jboss

> https://lists.jboss.org/mailman/listinfo/rules-users





--
View this message in context: http://drools.46999.n3.nabble.com/Accumulate-a-on-event-combinations-tp4020104p4020116.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list