[rules-users] About fusion and collections

Esteban Aliverti esteban.aliverti at gmail.com
Mon Mar 15 10:55:41 EDT 2010


I think something like this should work:

rule "raise alarm"
when
  Event($type : eventType)
  exists (ArrayList (size > 10)
            from collect (Event(eventType == $type)))
then
  raise alarm

Of course that you can't use the $events anymore. You can use a flag too:

rule "raise alarm"
when
  not TheAlarmWasAlreadyTriggered()
  Event($type : eventType)
  $events: ArrayList (size > 10)
            from collect (Event(eventType == $type))
then
  raise alarm
  insert(new TheAlarmWasAlreadyTriggered());

best,

2010/3/15 Amit Kumar <amitkumar at gmail.com>

> Hello All,
>
> Was doing some rule writing and am seeing some issues which I want to
> overcome.
>
> In Fusion when we send the facts into working memory.. there seems to be no
> way that rules are automatically getting triggered.
> We have to call fireAllRules after each fact insertion. Is this the way it
> was designed. Its like this in the stocktick example also
>
> This one should be simple for somebody with little more experience than me
> In the following rule
>
> rule "raise alarm"
> when
>   Event($type : eventType)
>   $events: ArrayList (size > 10)
>             from collect (Event(eventType == $type))
> then
>   raise alarm
>
> In the above rule the raise alarm is getting called 10 times. .. How can I
> make it to be called only once.
>
> Thanks
> Amit
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100315/eb763ab6/attachment.html 


More information about the rules-users mailing list