Sunday, February 3, 2013

Business Rule Engine is a powerful tool in BizTalk stack for creating, testing, publishing, and deploying rule sets for our Business process. I am going to demonstrate how to call a policy from an Orchestration using call rules shape using message as the parameter.

Scenario : Suppose we receive a Customer details message which also contains the CustID. We'll check the CustID and see if the Customer is new or already a member. If the customer is new we'll set the IsNew field to YES.

First of all we'll start with creating FACTS in BizTalk Rule composer.

Open BizTalk Rule composer and go to Vocabularies and create a new Vocabulary and then create a new definition for XMLSchema and select the schema created in the project. For CustID a get operation is created as follows :

For IsNew a set operation is performed as follows :

After creating the vocabularies publish the vocabularies so that it can be

used to create a Policy.

Next step is to create a Policy and a rule in BRE. It goes like this :

This Policy is created such that any CustID greater than 21 would set the

IsNew field to YES. This Policy will be called from the Orchestration using call

The Orchestration contains a receive shape, send shape, logical receive port and send port. A message is created using InputSchema as message type.

Call rules shape :

In call rules shape the policy that we have created is selected and parameters will automatically be populated. In this case Message_2 is shown. This whole message is passed to BRE and in return modified message is received.

Call rule shape not any showing parameters ??

This problem is related to BRE facts that we had created. When developing facts we have to specify the DocumentType property of the fact. This property should be same as the fully qualified name of the schema otherwise the call rule shape will not show the any parameters. This issue is of call rule shape not finding the matching message to the schema which is deployed with the rule.

Saturday, January 12, 2013

What is Parallel convoy ?

Parallel convoy in BizTalk is used to receive messages in any order. The Orchestration process does not start its execution further until all the messages in parallel convoys are received. In Parallel convoy we have a parallel shape as the first shape in the Orchestration and multiple receive shapes for receiving multiple messages.
For example if there is a Online shopping portal which sends several messages to BizTalk like ShoppingDetails, CustomerDetails, BillingAddress and they all need to be received in BizTalk and then only process should continue further and these messages can be receied in any order into BizTalk. This situation can be implemented using Parallel convoy :

SourceSchema for ShoppingDetails message:

SourceSchema1 for BillingAddress messages:

SourceSchema2 for CustomerDetails message:

NOTE : CustID is promoted in all the three schema's. Here is Property schema for CustID :

PropertSchema for CustID:

DestinationSchema :

Orchestration :

In Orchestration we have a Parallel shape with three receive branches and three receive ports for receiving three different types of messages. Now for parallel convoy we have to create Correlation set and correlation type which is done on CustID. All three receive shapes initialize the correlation set because any message can arrive at an time. Suppose 2nd parallel branch's message arrives then the 2nd receive shape initializes the correlation set and the other two follows the correlation set. When all the three messages arrives then only further execution of the Orchestration takes place.