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
//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
//Step 5: Fire all Rules