1
votes

Before anyone goes off the deep end about this has been covered, well not quite. 1st we are using Drools 6.5. Next I'm responsible for the framework that runs the engine, not the rules. 3rd I have a requirement to report real time the rule that failed. RHS not a problem, have that covered. LHS is the problem, NPE, divide by zero, etc, etc,etc.

Obviously any and all exceptions are caught and handled accordingly. As far as I can tell there is not enough information to determine the rule that failed. I have tried injecting a global and setting that as the 1st stmt but that appears not to get copied to application memory from the LHS working memory.

I can leverage some requirements on the rule makers...limited. I can inject stmts at runtime (when I load the rules), but I would prefer not to.

The work items will be varied and unreliable. The processing has to be very high speed. The rules will be hundreds to thousands, and possibly updated near real time, or maybe on the fly is a better description.

Is there a listener available that would be invoked prior to the LHS evaluation? ( I would doubt it but thought I better ask ).

An ErrorListener would be nice, I tried the Consequence Exception Handler but that did not work. Is there another ErrorHandler that I missed?

I assume the JBPM engine has the same constraints, is this the case? That will need to run in the framework as well.

Thanks

1

1 Answers

0
votes

Constraints aren't evaluated in the context of a rule, they are evaluated in the context of the network.

If you don't give the rule makers a rope, they won't be able to hang themselves. If you don't give them Java classes that run into a NPE or a division by zero, they won't be able to do that in their constraint expressions. (All right, they may still be able to explicitly write an expression where a divisor is zero, but so what.)

You have a limited chance to catch a LHS side exception if you write a handler around an insert call. You won't know which rule, though. (What would you do if you knew? Call the Marines?)

Using rules without testing is like using any other SW without testing.