Add the Dependency
Add the GoRules engine to your Maven or Gradle project.
// Maven
<dependency>
<groupId>io.gorules</groupId>
<artifactId>zen-engine</artifactId>
<version>$version</version>
</dependency>
// Gradle
implementation 'io.gorules:zen-engine:$version'Load a Decision
Create an engine and load your decision graph from a JSON file.
import io.gorules.zen.ZenEngine;
import io.gorules.zen.ZenDecision;
import java.nio.file.Files;
import java.nio.file.Path;
ZenEngine engine = new ZenEngine();
String content = Files.readString(Path.of("./decision.json"));
ZenDecision decision = engine.createDecision(content);Evaluate Rules
Pass your input data and receive the decision result.
Map<String, Object> input = Map.of(
"customer", Map.of("tier", "premium", "country", "US"),
"cart", Map.of("total", 150, "items", 3)
);
ZenResult result = decision.evaluate(input);
System.out.println(result.getResult());
// {discount=15, freeShipping=true}Why Java?
Built for performance and developer experience
JNI Native Bindings
Direct native bindings through JNI for maximum performance. No JNA overhead or reflection costs.
Spring Boot Integration
First-class support for Spring Boot with auto-configuration and dependency injection.
Thread Safe
Fully thread-safe engine designed for concurrent JVM applications. Share one engine across threads.
About the Java SDK
GoRules delivers a production-ready business rules engine for Java applications. The SDK provides native bindings through JNI, connecting your Java code directly to our high-performance Rust core while maintaining the familiar Java development experience.
Designed for enterprise workloads, the engine integrates seamlessly with Spring Boot, Quarkus, and other popular Java frameworks. Whether you're building microservices, batch processing systems, or traditional enterprise applications, GoRules handles complex decision logic with consistent sub-millisecond performance.
The SDK supports all GoRules features including decision tables, expressions, and complex rule graphs. Decision definitions created in the visual editor work directly with the Java SDK, enabling business users to modify rules without requiring code deployments or developer intervention.