ZEN Engine
Open-source Business Rules Engine
ZEN Engine is business friendly Open-Source Business Rules Engine (BRE) to execute decision models according to the GoRules JSON Decision Model (JDM) standard. It is written in Rust and provides native bindings for NodeJS and Python. ZEN Engine allows to load and execute JSON Decision Model (JDM) from JSON files.
Visit our GitHub ZEN.
Usage
ZEN Engine is built as embeddable BRE for your Rust, NodeJS or Python applications.
Installation
- Rust
- NodeJS
- Python
[dependencies]
zen-engine = "0"
NPM
npm i @gorules/zen-engine
Yarn
yarn add @gorules/zen-engine
pip install zen-engine
Evaluating Decision - Simple Usage
ZENEngine parses JDM from JSON content. It is up to you to obtain the JSON content, e.g. from file system, database or service call.
- Rust
- NodeJS
- Python
use serde_json::json;
use zen_engine::DecisionEngine;
use zen_engine::model::DecisionContent;
async fn evaluate() {
let decision_content: DecisionContent = serde_json::from_str(include_str!("jdm_graph.json")).unwrap();
let engine = DecisionEngine::default();
let decision = engine.create_decision(decision_content.into());
let result = decision.evaluate(&json!({ "input": 12 })).await;
}
import { ZenEngine } from '@gorules/zen-engine';
import fs from 'fs/promises';
(async () => {
// Example filesystem content, it is up to you how you obtain content
const content = await fs.readFile('./jdm_graph.json');
const engine = new ZenEngine();
const decision = engine.createDecision(content);
const result = await decision.evaluate({ input: 15 });
})();
import zen
# Example filesystem content, it is up to you how you obtain content
with open("./jdm_graph.json", "r") as f:
content = f.read()
engine = zen.ZenEngine()
decision = engine.create_decision(content)
result = decision.evaluate({"input": 15})
If you are looking for a Decision-as-a-Service (DaaS) over REST, take a look at GoRules Cloud.