[rules-users] Do events have to be unique in terms of their field values?

Brecht De Rooms bderooms at vub.ac.be
Tue Mar 4 10:39:12 EST 2014


Dear drools users,

when using a rule to add events such as the rule below, I noticed that  
they are not inserted if the event has identical field values. When I  
change one of the values to another number they are inserted. Is this  
normal behavior? I assumed that the timestamp would determine them to be  
unique.

rule "insertevents0"
   when
   then
     insert(new (TestFloatEvent(0));
     insert(new (TestFloatEvent(0));
   end

I figured it might be that the timestamp is equal since they are inserted  
in the same rule. To be sure I waited and entered a second rule to be  
picked up by the scanner.

rule "insertevents1"
   when
   then
     insert(new (TestFloatEvent(0));
     insert(new (TestFloatEvent(0));
   end

Yet, the amount of events when I query the factbase is still 1 where I  
thought it would ahave been 4.
Is the best way to fix this to add an explicit time attribute?

The TestFloatEvents are declared as:

package dynamictypesnetworktest

declare TestFloatEvent
	@role(event)
	value : float @key
end

---
Dit e-mailbericht bevat geen virussen en malware omdat avast! Antivirus-bescherming actief is.
http://www.avast.com



More information about the rules-users mailing list