https://github.com/manugraj/wte
A simple spring-native rule engine in ReST
https://github.com/manugraj/wte
graal-native graalvm-native-image rule-engine spring-boot spring-native
Last synced: 3 months ago
JSON representation
A simple spring-native rule engine in ReST
- Host: GitHub
- URL: https://github.com/manugraj/wte
- Owner: manugraj
- Created: 2021-06-15T13:37:26.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-06-15T15:11:28.000Z (almost 4 years ago)
- Last Synced: 2025-01-22T05:41:20.648Z (4 months ago)
- Topics: graal-native, graalvm-native-image, rule-engine, spring-boot, spring-native
- Language: Java
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# When-Then Engine
A straight forward rule engine build in spring-native with graalvm-native build
## Env Setup
Check out [BUILD](BUILD.md) document for setting up dev environment
# Build
- Build by running - `mvn -Pnative-image clean package`
- Binary as `target/wte`# Test
- Go to target folder and
- Run `./wte -Dserver.port=8081` to verify the system running# Docker build and exe
- Set docker memory to high value, since the compilation is AOT and requires greater memory
- Check for error 137 - shows memory insufficiency
- Run `docker-compose build`
- Run `docker swarm init`
- Note down the join-token
- Run `docker swarm join-token` to get the token again
- Run `docker stack deploy -c dcoker-compose.yml re`## Scale
- Run `docker service ls` -> find the running re service
- Run `docker service scale =3`
- Run `docker service ls` to verify new replicas deployed## Sample Requests
```
{
"rules" : [
{
"when": {
"lhs": 2,
"operation": "EQ",
"rhs": 2
},
"then": {
"id": 2,
"name" : "Test -2"
}
},
{
"when": {
"lhs": "$user.points$",
"operation": "GTE",
"rhs": 1000
},
"data": {
"user":{
"points" : 9999
}
},
"then": {
"id": 3,
"name" : "Test - 3"
}
}
]
}```