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

Samuli Saarinen samuli.saarinen at remion.com
Fri Oct 29 10:08:29 EDT 2010


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



More information about the rules-users mailing list