With the latest version 5.1.0 the Imixs-Workflow project introduces a BPMN based Rule Engine.
The BPMN Rule Engine uses Conditional Events to evaluate a business rule. This is a powerful mechanism to describe rules in a BPMN model and evaluate a given workitem.
The BPMN Rule Engine provides an easy way to describe also complex business rules based on a visual model. The rules are evaluated as a chain of conditional events. The engine evaluates the data of a given workitem.
A single condition is defined in a conditional sequence flow. The conditional expression is based on JavaScript but other Script languages are also supported.
To initialize a BPMN Rule Engine a Imixs BPMN Model instance need to be loaded first.
bpmnRuleEngine=new BPMNRuleEngine(model); workitem = new ItemCollection().model(MODEL_VERSION).task(100).event(10); workitem.setItemValue("a", 1); workitem.setItemValue("b", "DE"); // evaluate rule Assert.assertEquals(200, bpmnRuleEngine.eval(workitem));
The model instance can either be taken from a running instance of the Imixs-Workflow engine or loaded on demand from the file system:
// load BPMN model from input stream Model model = BPMNParser.parseModel(inputStream, "UTF-8");
The workitem can contain any kind of data to be evaluated by the business rules. Internally the Imixs BPMN Rule Engine is based on the Core-RuleEngine which supports various script languages to describe a rule.
The example BPMN model can be downloaded from Github . Install the Imixs-BPMN Modeler to examine the example.
More details about the Imixs BPMN Rule Engine can be find on the project site.