tags:

views:

148

answers:

1

I am facing a problem with Business Rules Engine in Biztalk Server 2006 R2.

I have 1 policy in BRE. A class library is used to invoke the policy.

I have a LongTermFactRetriever implemented.

Everything works fine with the BRE cache getting refreshed if 1 message at a time is sent through the orchestration.

But if we send bulk messages (say 5 at one time concurrently), the BRE cache gets refreshed 4 times (factsHandleIn is null for 4 instances of the orchestration)

Now we have 5 cached objects in BRE working memory. Again, if we send bulk message (5 at one time concurrently), the cached instances are used and no new instance is created.

My query is “should the BRE use the same 1 cached instance for every message flowing through the orchestration or should it create a new instances for concurrent messages if the existing cache is being used by another message”

A: 

The BizTalk BRE can cache more than one instance of your long term facts in certain cases. You are responsible, in your fact retriever, for determining when to update long term facts and for keeping track of which BRE instances are caching which of your long term facts.

Here is the relevant part of the BizTalk documentation (appears just before the "DataTable Binding sample):

"In some batch processing scenarios, several policy instances of the same policy could be created. If a new policy instance is created, you must ensure that the correct long-term facts are asserted.

Additionally, you would need to write custom code to implement the following strategies:

  • Know when to update the long-term facts
  • Keep track of which rule engine instance uses which long-term facts"

The second point (keep track of which rule engine instance uses which long term facts) isn't strictly necessary if you have only one version of the most current facts and can reliably refresh them as necessary - this applies in most simple cases.

Erik Westermann