Skip to content

Jafly. Rule Engine Models

Rule Engine Models

Persist rule definitions, constants, and audit trails with reactive repositories.

Apply the included database migrations, then use RuleDefinitionRepository and ConstantRepository for stored rule evaluation. AuditTrail tracks persistence state explicitly; preserve its new/existing semantics when constructing audit entities.

Maven artifact Packaging Source project
org.fireflyframework:fireflyframework-rule-engine-models jar modules/rule-engine/fireflyframework-rule-engine-models

Part of Business operations.

In the onboarding service

Use these repositories when onboarding rules and constants need a stored, versioned definition. The rule schema and audit trail are separate from the applicant's submitted record.

Add the component

Installation and version availability explains source builds and published releases.

<dependency>
    <groupId>org.fireflyframework</groupId>
    <artifactId>fireflyframework-rule-engine-models</artifactId>
    <version>26.10.20-SNAPSHOT</version>
</dependency>

Quick start

The Java examples in this section are API fragments for application code. Use the stated imports and supply the application-owned collaborators described alongside them.

Apply the three supplied migrations for constants, rule definitions, and audit trails. A service can then inject RuleDefinitionRepository and look up a stored rule by its code:

Mono<RuleDefinition> rule = repository.findByCode("credit-check");

The example code is application-defined; create the corresponding stored rule before evaluating it. The repository is in org.fireflyframework.rules.models.repositories, while the exact entity package is linked in the API table. AuditTrail implements Persistable<UUID> and uses isNew()/markNotNew() to control persistence state; preserve that behavior when mapping existing audit records.

Configuration and wiring

This module declares no @ConfigurationProperties class of its own. Use the constructor/port contracts above and the configuration of the host or related core module.

Public API and extension points

Type Contract and responsibility
RuleDefinition Entity representing a stored YAML DSL rule definition.
Constant Entity representing a system constant that can be used in rule expressions.
AuditTrail Entity representing an audit trail record for rule engine operations.
RuleDefinitionRepository Repository interface for RuleDefinition entities.
AuditTrailRepository Repository interface for AuditTrail entity operations.
Related component Why it belongs nearby
Rule Engine Library Group the YAML rule evaluator, public DTOs, persistence models, HTTP service, and generated SDK.
Rule Engine Interfaces Share request/response DTOs, rule definitions, validation results, and value/result enums for the rule engine.
R2DBC Build reactive repository filtering and pagination on Spring Data R2DBC.

Build and test

Use Java 25. From the repository root, build this component with its required dependencies:

git clone https://github.com/fireflyframework/fireflyframework-jafly.git
cd fireflyframework-jafly
./mvnw -pl :fireflyframework-rule-engine-models -am verify
./mvnw -pl :fireflyframework-rule-engine-models -am install

verify runs the selected projects' tests. install makes the current build available in your local Maven repository.

This subproject has no authored src/test/java suite. Its Maven build still validates the configured compilation/generation and any reactor prerequisites. Use the consuming component tests to validate integration behavior.

API reference excerpt

Contract excerpt from RuleDefinition.java. This fragment needs the full type and its imports.

public class RuleDefinition {
    private UUID id;
    private String code;
    private String name;
    private String description;
    private String yamlContent;
    private String version;
    private Boolean isActive;
    private String tags;
    private String createdBy;
    private String updatedBy;
    private OffsetDateTime createdAt;
    private OffsetDateTime updatedAt;
}

Continue the application

Use the Rule Engine Web guide for the next part of this integration. The runnable submission/query service is in Getting started.

Source and further reading