Thursday, March 12, 2009

Message Correlation In BizTalk 2006 /2009

What is Correlation?

Suppose let say Microsoft asked HITACHI CONSULTING to host a Hands on training events for Developing an Applications on Windows AZURE Platform. In this case HITACHI CONSULTING will send out an Invitation to the developers nationwide at the same time HITACHI CONUSLTING wants to know how may people will be to attending this events so that they can arrange all facilities for all attendees . To find out number of attendees for this events HITACHI CONSULTING  will match the all of these responses to the Invitation they sent out this is called  Correlation.

Now let see how we can achieve this process using BizTalk Solution.  We will use BizTalk Orchestration to define the process and we define the  Invitation as BizTalk XSD Schema. When we send Initiation we also send Unique reference number the same way the response also should have this reference number this help us to match the request to the response.

For a Invitation that is sent in an orchestration instance we have to define in the orchestration which part of the message correlates the request.  The response to this Invitation should also specify this same reference number, this will allow us to easily match the request to the response. In BizTalk  correlation type is simply a collection of one or more properties that uniquely identify a request and matching response.

Steps needed to implement this Business process in BIZTALK 2009( i am using 2009 you can also use 2004 , 2006).

1) Define a Invitation Message  as  BizTalk XSD Schema .

2) Create a Property schema with Invitation Ref Number as promoted filed .

3) Create  and Configure Orchestration with Receive and Send ports.

4) Create Correlation type and set.

5) Deploy the solution and test it.

Create the Invitation Schema with following attribute . In this Schema InviteRefNumber is Uniquely indentify a attendee.

image

When we wanted to access a message property inside  BizTalk Orchestration we need to promote that particularly property that is called Message Context .  this can be done with special kind of schema called  Property Schema . in this above schema we are going to promote InviteRefNumber once we are done that we can define correlation type.

Add new Property Schema as shown below.

image

Promote the InviteRefNumber field.

image

   Creating a Business process as BizTalk Orchestration and define the message type , ports and correlation type and sets.

image 

  image

Now deploy the BizTalk solution and configure Receive , send ports and Orchestration.  Before that do not forgot to add  SN Key ( strong name key ) file to the BizTalk project. because this BizTalk solution will deployed in GAC

GAC – Global Assembly Cache.

  After configuring  BizTalk solution using BizTalk Admin console .  drop the  Invite message in In Folder  you will see ASAP the BizTalk process picked of the message and send to Out Folder.  now if you query the  message Instances you will see the Orchestration instance status is Dehydrated that means it persisted in BizTalk message box and waiting for response message to arrive.

image

Now you copy the message from OUT folder and  paste into  IN1 ( folder ) then query the  Service Instance you wont find in BizTalk Message DB  this is called Hydrated that means  the persisted Orchestration instance is processed by the corresponding  correlated Response  message .

image

Nandri

Sreenivasaragavan.

[Success is the result of your action –BABA]

1 comment:

Unknown said...

HI,

Thanks for the post and it was very helpfull but when i am pasting the files in the second receive location i am getting errors in the admin console as no subscribers found for the second send port. as the second send port is bound to orchestration and it is in the start mode. can you please clarify how can we acheive this.