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">
  <PODetails>
    <PONo>10</PONo>
    <Date>20121229</Date>
  </PODetails>
</ns0:PO>


Customer file :

<ns0:Customer xmlns:ns0="http://Working_With_ListenShape.SourceSch1">
  <Details>
    <ID>99</ID>
    <FirstName>John</FirstName>
    <LastName>Cena</LastName>
    <Address>Nashville,US</Address>
    <PONo>10</PONo>
  </Details>
</ns0:Customer>


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 :















9 comments:

  1. Nice explanation for beginner
    Kapil...

    ReplyDelete
  2. Hi Rahul,

    Would it be possible to get a copy of this project? i am still new to BizTalk but would need a sequential convoy. It would be fun to have a play around in your project before making one from scratch.

    Thanks for the time,

    Andy

    ReplyDelete
    Replies
    1. Hi Andy,

      Please provide me your Email ID so that I can send you the Project.

      Thanks

      Delete
  3. Dear Rahul I am getting following error:
    The published message could not be routed because no subscribers were found. This error occurs if the subscribing orchestration or send port has not been enlisted, or if some of the message properties necessary for subscription evaluation have not been promoted. Please use the Biztalk Administration console to troubleshoot this failure.
    AND
    This service instance exists to help debug routing failures for instance "{7B61BBAD-20FD-4275-B734-2239B3C93466}". The context of the message associated with this instance contains all the promoted properties at the time of the routing failure.

    I have googled these errors. MSDN forum says that you should compare Promoted Properties value and values inside Subscription Detail. How both could be similar

    ReplyDelete
    Replies
    1. Hi Shabbir,

      Following are the points that you should make sure :

      1. Make sure send port & Orchestration are enlisted.
      2. Check that all the input files that you are using have same correlation i.e suppose you are using PONo, then PONo in all files should be same.
      3. Debug the Orchestration to see from which shape this error is thrown.

      Let me know furthur.

      Delete
    2. How Can We handle Zombie situation here..

      if second msg comes first then it will be suspended.

      Thanks,
      Amit Patel

      Delete
  4. HI Rahul,
    plz try the sequential convoy scenario with 3 or more than 3 msg type.
    In that scenario it does not follows the ordered delivery.
    After the first msg received it takes any msg type in any sequence.
    I am not able to find the explanation, for this type of behavior by the biztalk.If possible to find out the explanation for this scenario also.

    Thanks,
    Rahul Bhandari

    ReplyDelete
  5. Hi rahul,
    it's very gud demonstration..plz send me one project copy

    ReplyDelete