Pawan
Pawan

Reputation: 32331

Drools : Firing Rules using a Session vs WorkingMemory

What is the difference in between these two in Drools ?? Means taht we can fire the rules based on the

Creating the WorkingMemory from the loaded Rules RulesBase and firing rules as shown below :

WorkingMemory  workingmemory = rulebase.newWorkingMemory();
workingmemory.fireAllRules();

vs

Using a Session (Stateful . Stateless ) to fire the rules as shown

KnowledgeBase knowledgebase = createKnowledgeBase();
StatefulKnowledgeSession session = knowledgebase.newStatefulKnowledgeSession();
session.insert(Object);
session.fireRules();

Upvotes: 1

Views: 1465

Answers (1)

Geoffrey De Smet
Geoffrey De Smet

Reputation: 27322

Use KnowledgeBAse and KnowledgeSession, of knowledge-api-.jar. RuleBase and WorkingMemory are the legacy interfaces and will be removed in the future.

Upvotes: 5

Related Questions