Installation
Basic usage
Loader
The loader pattern enables dynamic decision loading from any storage backend. The loader function returnsCompletableFuture<JsonBuffer>. Use ConcurrentHashMap to cache decisions for optimal performance.
File system
AWS S3
Azure Blob Storage
Google Cloud Storage
Async evaluation
Evaluation returnsCompletableFuture for non-blocking execution:
Error handling
Tracing
Enable tracing to inspect decision execution:Expression utilities
Evaluate ZEN expressions outside of a decision context:Performance note
The Java bindings use JNA (Java Native Access) for interoperability with the native Rust engine. This introduces some overhead compared to native Rust or direct bindings. We plan to revisit this when the FFM (Foreign Function & Memory) API becomes more widely adopted.
Best practices
Use try-with-resources.ZenEngine implements AutoCloseable to release native resources.
ZenEngine instance at application startup and reuse it for all evaluations.
Implement a loader for dynamic decisions. The loader pattern centralizes decision loading logic and enables caching with ConcurrentHashMap.
Use CompletableFuture composition. Chain async operations or use allOf for parallel evaluation of multiple decisions.