easy-rules
easy-rules copied to clipboard
How to set the Priority of the Rule at runtime
Hi,
I am having issue setting the priority of the rule at runtime. I know if I use RuleBuilder, I can set the priority, but then I have to override the when
and then
and then build the rule. But in my case, I am getting the list of rules name (to be executed) at run time and the user can specify the order of these rules should be executed.
Can you please provide some guidance on how to implement this? I am using the annotation at the Rule component creation like @Rule(name = "SomeRule", description = "Description of Rule User", priority = 2)
, the priority of this is hardcoded, and I want to someway set this priority at run time.
Thanks, DS
I think keeping priority of the rules same and then change order before execution should work for you.
@dvgaba Can you share an example? How can we change the order before execution?