A powerful, flexible, and scalable rule engine built with Spring Boot 3 and Java 17
The Beas Rule Engine is a high-performance rule evaluation system that allows you to define, manage, and execute complex business rules using MVEL (MVFLEX Expression Language). It provides a RESTful API for rule evaluation, comprehensive caching mechanisms, and robust security features.
The Beas Rule Engine follows a layered architecture pattern:
Controllers, DTOs, Validation
Services, Engine, Cache
Repositories, Models, MongoDB
git clone https://github.com/BEAS-Software-Solutions/BEASRE.git
cd BeasRuleEngine
mvn clean install
mvn spring-boot:run
java -jar target/rule-engine-0.0.1.jar
docker build -t beas-rule-engine .
docker run -p 8070:8070 beas-rule-engine
The main configuration file is located at src/main/resources/application.yaml
:
# Rule Engine Configuration
rule:
container:
name: general
# Cryptography Configuration
cryptography:
key: "your-encryption-key"
iv: "your-iv-vector"
# Spring Configuration
spring:
application:
name: beasre
data:
mongodb:
host: localhost
port: 27017
database: beasre
security:
oauth2:
resourceserver:
jwt:
issuer-uri: https://keycloak.beassolution.com/realms/beas-rule-engine
# Server Configuration
server:
port: 8070
servlet:
context-path: /beasre/v1
You can override configuration using environment variables:
export SPRING_DATA_MONGODB_HOST=your-mongodb-host
export SPRING_DATA_MONGODB_PORT=27017
export SERVER_PORT=8070
export CRYPTOGRAPHY_KEY=your-key
After installation, the application will be available at:
http://localhost:8070/beasre/v1
http://localhost:8070/beasre/v1/swagger-ui.html
http://localhost:8070/beasre/v1/actuator/health
curl -X POST "http://localhost:8070/beasre/v1/rule-engine/evaluate" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-jwt-token" \
-d '{
"ruleName": "discount-rule",
"parameters": {
"orderAmount": 1000,
"customerType": "PREMIUM"
},
"payload": {
"orderId": "12345",
"items": ["item1", "item2"]
}
}'
Access the interactive API documentation through Swagger UI:
For detailed API documentation, see our API Documentation Guide.
# Run all tests
mvn test
# Run specific test class
mvn test -Dtest=RuleEngineServiceTest
# Run tests with coverage
mvn test jacoco:report
# Build Docker image
docker build -t beas-rule-engine .
# Run container
docker run -d \
--name beas-rule-engine \
-p 8070:8070 \
-e MONGODB_HOST=mongodb \
-e CRYPTO_KEY=your-key \
-e CRYPTO_IV=your-iv \
beas-rule-engine
For production deployment, consider: