Saturday, December 29, 2012

Sequential convoy using listen shape in biztalk example

What is Sequential Convoy in BizTalk ?

A sequential convoy enables multiple single messages to join together to achieve a required result. A sequential convoy is a set of related messages that have a predefined order. Although the messages do not have to be exactly the same, BizTalk Server must receive them in a sequential order.

Listen Shape in BizTalk Example -:

Listen shape in BizTalk is the most powerful shape available in Orchestration developer toolbox. It can be used in many design patterns for BizTalk Soluton. Listen shape listens for some event to take place in its every branch. Suppose there are 3 branches in Listen shape and an event on 2nd branch takes place then all other branches would get terminated.

Sequential Convoy using Listen Shape 

I am going to demonstrate a sequential convoy using listen shape.
Suppose we have a file for Purchase order (PO) and a second file for Customer detail for that particular PO. We have to concatenate these two files and send it further. 

Schema for 1st File i.e PO :

Since we are using Sequential convoy we need to define a correlation set and type. Therefore I have promoted the PONo field in both the schema.

Schema for 2nd File i.e Customer Details :

Destination Schema :

Orchestration goes like this :

In Orchestration I have used a Uniform Sequential convoy which means that the Orchestration can receive messages from same logical Orchestration port. There are two receive shapes in Orchestration where the 1st receive shape initializes the correlation set and is marked activating. The 2nd receive shape follows the correlation set. The only thing that we need to take care is that ordered delivery property of the receive port must to true.
First branch of Listen shape contain receive shape and transform shape. When Orchestration receives the PO file, the orchestration becomes dehydrate and waits for the 2nd file i.e customer file to arrive. If the file comes before the time specified in the delay shape then the first branch of listen shape executes otherwise second branch of expression shape executes.

Map :

Input Files :

PO file

<ns0:PO xmlns:ns0="http://Working_With_ListenShape.SourceSch">

Customer file :

<ns0:Customer xmlns:ns0="http://Working_With_ListenShape.SourceSch1">

Output : 

Case 1 : When 2nd file arrives before the time specified in delay shape.

Case 2 : When event on Delay branch happens then output in Debug View :

Saturday, December 22, 2012

Parallel shape in biztalk example

Parallel shape in BizTalk is most confusing shape in Orchestration toolbox. I am going to give an example of parallel shape for removing this confusion.

What does Parallel shape in BizTalk do ?

Parallel shape in BizTalk is NOT used for concurrent processing. The Parallel shape enables you to complete different stages of business process without having to wait for another part of the business process to complete. It does not provide a separate thread per branch.

Example :

I have created an orchestration with a parallel shape which have 3 branches containing 3 expression shape. 

1st Expression shape :

2nd Expression Shape :

3rd Expression Shape :

How parallel shape works :

When we drop a file at receive location Orchestration in instantiated and when control reaches the parallel shape, it starts it execution from left to right i.e. the 1st expression shape runs firstly and then rest of them. Even if we insert delay shape after 1st expression shape the 2nd expression shape does not get starts.So therefore parallel shape is not about concurrent execution.

Output in DebugView :