Kapil Chadha

  Home  |   Contact  |   Syndication    |   Login
  7 Posts | 1 Stories | 3 Comments | 0 Trackbacks

News

Twitter












Archives

Documents

Business rules do not fire even when all match conditions seem to have been evaluated to true

 

Have you ever been in a situation when all match conditions in your business rule evaluated to true and still rules didn’t fire? If yes, then read on; you might have been stuck in same situation as mine.

 

Today I was working to modify a business rule that I wrote a while ago when I got completely stuck with the issue described as below. For a minute I thought that I might have unearthed a bug in Business rules engine. But then after scratching my head for sometime I realise where I was going wrong.

 

Basically, I was trying to test a simple business rule policy which on executing, followed in with all match conditions resulting in a positive outcome (Test Result: True) and still rules didn’t fire. Furthermore, I could see fact (simple .Net component) being asserted and then gracefully retracted after all match conditions have been successfully evaluated. I used DebugTrackingInterceptor to intercept all the events generated by the rule engine.

 

After much confusion, I realised that my business rule policy was configured with a long term fact which was not enabled (via registry switch). This switch and state of long term fact (and hence assertion) is not important. What is important is the fact (not B.R fact) that the event interceptor was not tracking the match conditions corresponding to the long term fact and hence resulting in this confusion. This makes sense as my long term fact being in disabled state never had a chance to assert the long term fact and hence corresponding match conditions never got fired and therefore no events tracking. What I think is missing is the fact (not B.R fact again) that just by looking at the events there is no way to tell why rules did not fire when (presumably) all match conditions resulted in a positive result. May be it is a time to write my own custom Interceptor. However for time being, I thought of sharing this just in case any of you may land up in a similar situation and may be edging towards blaming MS rules engine (like me) for this awkward looking scenario.

posted on Wednesday, May 13, 2009 10:09 PM