Search code examples
drools

What event will be triggered by 'fireAllRules' of drools?


I'm using Drools 7.73.0.Final and I want to make a time consuming monitor which needs the time when fireAllRules() is triggered(as a base time).

I hope there is a event invoked when using fireAllRules(), so that I can use EventListener instead of adding duplicate timing code.


Solution

  • I'm not sure I'd look into a Listener for this use-case, since it would be difficult to define proper semantic of global entry/exit in case of fireUntilHalt.

    I believe you can easily wrap your call of fireAllRules() and decorate it with entry/exit calls.

    Alternatively, you can consider implementing your own specialization of the FireAllRules Command, again to capture entry/exit, and invoke Session API with the Command.