[rules-users] Removing facts from statefulknowledgeSession's memory

Ayush ayush.vatsyayan at alcatel-lucent.com
Fri Nov 12 05:02:29 EST 2010


Thanks. Actually I did it in different way what I did is I declared my fact
into drl file as declare MyFact and then I'd added an @expires to it. It
works fine but now the problem is that for every fact inserted I'd also
inserted an event for it. 

Now as the drl file can be updated by user so say he'd defined expiry time
for events as 1m and for facts as 10s in this case since I'm using sliding
window for events and based on this event I'm fetching the fact. So now I'll
be getting the event but facts will not be available as the 2nd fact came
after 20s hence the rule will not be fired. below is the sample rule.

declare MyEvent
	@role(event)
	@expires( 1m )
end

declare MyFact
	@expires( 10s )
end
rule "MyCorrelation"
	no-loop true
	dialect "mvel"
	lock-on-active
	when
		$E1 : MyEvent( prop1 == 2, $entityA : entity ) over window:time(60s) from
entry-point NotificationStream
		$E2 : MyEvent( this != $E1, prop1 == 1, $entityB : entity ) over
window:time(60s) from entry-point NotificationStream
		$F2 : MyFact(this.entity == $entityB)
		$F1 : MyFact(this.entity == $entityA)
	then
		System.out.println("I'm executed successfully");
end

Now what I want is that I can define the @expires time at a single location
or I can verify the logic of these rules?

Also if say I'd defined the @expires for event as 10s while in sliding
window I'm using over:time(1m) then also it is not same.
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Removing-facts-from-statefulknowledgeSession-s-memory-tp1875795p1887987.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list