[rules-users] How to call Drools as a remote rules executor

Alberto alberto.martinez at grupoica.com
Mon Dec 9 10:32:40 EST 2013


I define my facts in DLR with the declare clause.
The method need the values of the facts to insert it into the knwoledge
base.
You can try this:

[my kbase is injected by spring]

StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
FactType factType = kbase.getFactType("my.package(defined in the DLR)",
"name_of_the_fact");
Object kFact = null;
try {
        kFact = factType.newInstance();
} catch (InstantiationException e) {
	throw new ApplicationException(e);
} catch (IllegalAccessException e) {
	throw new ApplicationException(e);
}
	factType.set(kFact, "fact_property_name(in_DLR)" , "fact_property_value(in
DLR)");
}

FactHandle factHandler = ksession.insert(kFact);
int numRulesFired = ksession.fireAllRules(100);

I hope this help you.



--
View this message in context: http://drools.46999.n3.nabble.com/rules-users-How-to-call-Drools-as-a-remote-rules-executor-tp4027157p4027166.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list