[rules-users] Declaring events separately from rules breaks expires

Edson Tirelli tirelli at post.com
Fri Oct 29 12:11:21 EDT 2010


   Samuli,

   Are you adding your event declaration file before the rules that
use them? As of today, you must always do that, but as long as you do,
it should work even if they are in separate files.

   Regarding the update, it is not possible to do that today, but feel
free to open a JIRA. I think it is something we should do.

    Edson

2010/10/29 Samuli Saarinen <samuli.saarinen at remion.com>:
> Hello,
>
> I have the following situation with Drools 5.1.1: 2 drl files where one
> contains an event declaration:
>
> declare Event1
>        @role(event)
>        @expires(1s)
> end
>
> and other has a simple rule:
>
> rule "Evt1"
>        when
>                e: Event1(value == 10)
>        then
>                System.out.println(e);
> end
>
> And I have the following test which fails:
>
> ses.insert(new Event1(1));
> ses.fireAllRules();
> clock.advanceTime(2, TimeUnit.SECONDS);
> ses.fireAllRules();
> assertEquals(ses.getFactCount(), 0L);
>
>
> The same test passes if the rule and event declaration are on the same
> drl file.
>
> Further more if I declare the event in both of the files with different
> @expires the one being used is the one that is added first. I was hoping
> that the first declaration to be a "default expires" that could be
> overwritten later on with a new declaration but it seems that this is
> currently not possible.
>
> Cheers,
> Samuli
>
>
> --
> Remion Oy           Etävalvontajärjestelmät liiketoiminnan
> Samuli Saarinen           tehostamiseen
> gsm +358 (0)50 3560075
> fax +358 (0)3 2125064       www.remion.com
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com




More information about the rules-users mailing list