easy-rules icon indicating copy to clipboard operation
easy-rules copied to clipboard

How to set the Priority of the Rule at runtime

Open deepaksmailgithub opened this issue 2 years ago • 2 comments

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

deepaksmailgithub avatar Mar 14 '22 02:03 deepaksmailgithub

I think keeping priority of the rules same and then change order before execution should work for you.

dvgaba avatar Apr 10 '22 18:04 dvgaba

@dvgaba Can you share an example? How can we change the order before execution?

alishaarora avatar Feb 24 '24 23:02 alishaarora