Last couple of weeks, we had some issues in creating rules engine for our aviation requirements using Microsoft WWF(Windows Workflow Foundation), but unfortunately WWF doesn’t fufill our requirements. So, finally we decided to create a customized powerful rules engine and we got recommendation on Drools.NET framework from one of fellow of Microsoft Corporation.
Here, I would like to give brief introduction about Drools.NET framework - Basically, It is a Rules Engine implementation based on Charles Forgy’s Rete algorithm tailored for the Java language. Drools.NET enables .NET developers/Users to exploit the powerful Rule Engine like Drools through a completely managed .NET code base.
Basic sequence of steps to use a RuleBase
//Step 1: include the following namespace
using org.drools.dotnet.io;
using org.drools.dotnet;
//Step 2: Use RuleBaseLoader to load the RuleBase. Many convenience methods, as described in Section 3.1.1, are available to load a RuleBase. Here i’am using ‘loadFromStream’ method
RuleBase ruleBase = RuleBaseLoader.loadFromStream(new FileInputStream(“helloworld.csharp.drl.xml”));
//Step 3: Get an instance of WorkingMemory for the loaded RuleBase
WorkingMemory workingMemory = ruleBase.GetNewWorkingMemory();
//Step 4: Assert facts
workingMemory.AssertObject(“Hello”);
//Step 5: Fire all Rules
workingMemory.FireAllRules();
Download
You might want to check out the latest JBossRules 3. The old Drools2 is only forward chaining, whereas JBossRules 3 is the new version of Drools. The drools guys, which work for JBoss now have put a lot of work into drools3 aka JBossRules3. The performance of the latest BETA is atleast 60x faster than the old Drools2.
there’s also a new eclipse IDE, which should make writing rules easier.
peter lin
@Peter – Drools.Net 3.0 uses Jboss Rules 3.0