deliveredtechnologies / rulebook

100% Java, Lambda Enabled, Lightweight Rules Engine with a Simple and Intuitive DSL
http://www.deliveredtechnologies.com
Apache License 2.0
716 stars 124 forks source link

How can i write dynamic rules to execute rather than writing in java program .like rules defined in JSON or Yaml? #191

Open evasanthan opened 4 years ago

evasanthan commented 4 years ago

I liked the rulebook concept which is really great library. but

Do we have any option dynamically add rules and conditions in Yaml or JSON rather than writing all rules in POJO or programmatically?...

awattez commented 4 years ago

I do not think that this library is planned to use JSON / YAML files to configure the rules.
I also do not know if there is a RoadMap referenced somewhere, maybe this request can be registered there. This library can probably help you https://github.com/j-easy/easy-rules

lospejos commented 4 years ago

I'm not sure that library mentioned above (easy-rules) has something that this library doesn't. Both libraries has examples of dynamically created rules in runtime. Since you can create rules in runtime, you can parse rules from XML, JSON, YAML, database tables or whatever you want and create rules accordingly. The main challenge is to create a flexible rules description format (especially when you plan to create complex rules combined from conditions set joining them using AND, OR, NOT etc), and to create a error-prone parser of this format.

All written above is just my opinion, of course )))

Clayton7510 commented 3 years ago

JSON, XML or YAML support is not on the roadmap. I agree that if that's specifically what you are looking for, then something like easy-rules might be worth a look.

I don't really like how that was supported in other frameworks - feels like a move away from simplicity. With that being said, there always were plans to have rules loaded at runtime that could be stored somewhere else, but rules that are in an intuitive DSL, like something that could be provided by Groovy or maybe Kotlin. Not a simple task, tho.

Clayton7510 commented 3 years ago

This thread is scheduled to be deleted on 10/22/2020. Further discussion on externalized rules can be handled in issue #9