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

Edson Tirelli tirelli at post.com
Mon Nov 8 09:43:15 EST 2010


   Please open a JIRA. If it is not creating a new fact type, i.e.,
only attaching metadata to existing types, it should either "merge"
metadata or raise errors.

   Also, documentation was not updated in that place. Can you mention
that please, as we need to fix as well. Explicit expiration policies
override implicit ones.

   Thanks,
      Edson

2010/11/8 Samuli Saarinen <samuli.saarinen at remion.com>:
> Hi Edson,
>
> I dig this a little deeper and found out that event declaration in
> separate file works correctly if file declaring the event and file
> containing a rule using the event have the same package. Is there a
> reason it should work only within the same package or should I open a JIRA?
>
> Cheers,
> Samuli
>
> On 29.10.2010 19:11, Edson Tirelli wrote:
>>     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