deliveredtechnologies/rulebook

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

evasanthan opened this issue · 4 comments

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?...

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

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 )))

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.

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