Hi i am new to Drools fusion and I have been developing some sample rules to understand working of drools fusion.
I need some help in understanding drools
My rule:
rule "Sample Rule"
when
$t:Test (num == 10) from entry-point Stream
then
System.out.println($t.str);
end
Test is a class having a str
String and num
Integer.
I need event to be fired by some correlation such that it keep inserting test objects and fire event as num
of those objects have sum more than 100 like:
rule "Your First Rule"
when
$t:Test ($tmp:num) from entry-point Stream //store num's value
($tmp>100) // fire if sum of num's more than 100
then
System.out.println($t.str);
end
My code is:
WorkingMemoryEntryPoint entryPoint1=ksession.getWorkingMemoryEntryPoint("Stream")
def eg=new Test()
eg.str="Test"
eg.num=10
EventFactHandle factHandle = (EventFactHandle)entryPoint1.insert(eg)
Ques 2: I want to understand the working of fireAllRules()
. Do i need to trigger by this method everytime I insert an object into drools runtime(entrypoint or session).?
I hope you understand my situation.Please help and thanks in advance