microsoft / RulesEngine

A Json based Rules Engine with extensive Dynamic expression support
https://microsoft.github.io/RulesEngine/
MIT License
3.47k stars 530 forks source link

Can support rule interceptors and dynamically query to populate the context before executing the rule? #533

Open contione opened 9 months ago

abbasc52 commented 9 months ago

@contione Can you provide more details on this? Also if you can share some example of expected behavior it will help

ericsalim commented 8 months ago

Hi, I'm not the issue opener, but I have a similar need. I need to log the execution time for each rule. I'm thinking about adding pre and post execution hooks for each rule.

var rule = new Rule
{
    RuleName = "Example rule",
    PreExecution = _ => Debug.WriteLine(DateTime.UtcNow),
    PostExecution = _ => Debug.WriteLine(DateTime.UtcNow);
};

Is it possible do this or something similar to this?

contione commented 8 months ago

@contione Can you provide more details on this? Also if you can share some example of expected behavior it will help

I noticed that RulesEngine mentions workflow, and it may require querying data from a database before executing the process in order to determine the next step and achieve a simplified version of a dynamic workflow. Currently, I have implemented my own simplified version, so I haven’t been able to utilize RulesEngine yet.