<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>- Orchestrations</title>
        <link>http://geekswithblogs.net/LeonidGaneline/category/5982.aspx</link>
        <description>- Orchestrations</description>
        <language>en-US</language>
        <copyright>Leonid Ganeline</copyright>
        <managingEditor>leo.gan.57@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>BizTalk: Ordered Delivery</title>
            <link>http://geekswithblogs.net/LeonidGaneline/archive/2012/01/11/biztalk-ordered-delivery.aspx</link>
            <description>&lt;h1 style="MARGIN: 24pt 0in 0pt"&gt; &lt;/h1&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;It is one more description of the Ordered Delivery (OD) in BizTalk. &lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;The &lt;a href="http://msdn.microsoft.com/en-us/library/aa559637.aspx"&gt;main article about it is in MSDN&lt;/a&gt;.&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;Here I am discussing the BizTalk Ordered Delivery “implementation details”.&lt;/p&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;a name="OD_Considerations"&gt;&lt;/a&gt;OD Considerations &lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Ordered Delivery (sequential) mode is opposite of the “Parallel Delivery” mode. Parallel Delivery is the most productive mode; the Ordered Delivery is less productive mode. 
&lt;/li&gt;&lt;li&gt;Transports such MSMQ and protocols, supporting the WS-ReliableMessaging, are the protocols supporting OD. Other protocols as FTP, File, SQL, SMTP etc. do not have notion of the “order”. 
&lt;/li&gt;&lt;li&gt;BizTalk application usually is a part of the whole message workflow. 
&lt;/li&gt;&lt;li&gt;There are two approaches in the OD implementation: 
&lt;ul&gt;
&lt;li&gt;All steps of the message workflow independently support OD. 
&lt;/li&gt;&lt;li&gt;A Destination System implements the re-sequencing and manages lost and duplicate messages. &lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;Order is relative. Sequences can be ordered regards one or several parameters. For example, OD for the Company or for the Company + Department. &lt;/li&gt;&lt;/ul&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;a name="OD_and_the_BizTalk_Architecture"&gt;&lt;/a&gt;OD and the BizTalk Architecture&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;MessageBox is an implementation of the Message Queue. OD is an intrinsic feature of the MessageBox. 
&lt;/li&gt;&lt;li&gt;The BizTalk Server works in the Parallel Delivery mode by default. 
&lt;/li&gt;&lt;li&gt;There are three parts in the BizTalk message exchange outside of the MessageBox in relation to OD: Receive Locations; Orchestrations; Send ports. 
&lt;ul&gt;
&lt;li&gt;Receive Locations support OD on the Transport level (say, MSMQ and some WCF adapters). 
&lt;/li&gt;&lt;li&gt;OD in Orchestrations is implemented by the sequential convoy pattern. 
&lt;/li&gt;&lt;li&gt;Send ports support OD for all static adapters. &lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;The BizTalk Pipelines (part of Receive and Send Ports) always process messages in order using streams. &lt;/li&gt;&lt;/ul&gt;
&lt;h3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;a name="OD_and_Ports"&gt;&lt;/a&gt;OD and Ports&lt;/h3&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;To force Send Ports work in order we set up a flag the “Ordered Delivery” in Send Ports, then the BizTalk MessageBox takes care of implementing OD.&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;To force Receive Locations work in order we set up flag the “Ordered Delivery” option in the Receive Location &lt;strong&gt;Transports&lt;/strong&gt;, whenever is possible. Then the BizTalk Transport Adapter takes care of implementing OD.&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;Ordered Delivery Send Port instance works as a singleton service. Since start it stays in Running state. It will not recycle if we restart its Host Instance. We could manually terminate it, if we want.&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt; &lt;/p&gt;
&lt;h3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;a name="OD_and_Orchestrations"&gt;&lt;/a&gt;OD and Orchestrations&lt;/h3&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;MessageBox implements the convoy message exchange pattern [See &lt;a href="http://msdn.microsoft.com/en-us/library/aa578692(v=bts.70).aspx"&gt;Using Correlations in Orchestrations&lt;/a&gt;]. See the detail convoy description in the &lt;a href="http://msdn.microsoft.com/en-us/library/ms942189(v=bts.10).aspx"&gt;BizTalk Server 2004 Convoy Deep Dive&lt;/a&gt; article. &lt;br /&gt;It is not just a design pattern that developer should follow. There are special mechanisms inside MessageBox responsible for implementing OD.&lt;/p&gt;
&lt;h3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;a name="OD_and_Orchestration_Sample"&gt;&lt;/a&gt;OD and Orchestration: Sample&lt;/h3&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;Imagine four Orchestrations which implement four approaches to the sequencing. &lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt" dir="ltr"&gt;&lt;a href="http://social.technet.microsoft.com/wiki/cfs-file.ashx/__key/communityserver-wikis-components-files/00-00-00-00-05/4744.OrchestrationParameters.2.gif"&gt;&lt;img style="BORDER-BOTTOM: 0px solid; BORDER-LEFT: 0px solid; BORDER-TOP: 0px solid; BORDER-RIGHT: 0px solid" alt="" src="http://social.technet.microsoft.com/wiki/resized-image.ashx/__size/550x304/__key/communityserver-wikis-components-files/00-00-00-00-05/4744.OrchestrationParameters.2.gif" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The first is the &lt;b&gt;ProcessNoOrder&lt;/b&gt; Orchestration. It processes all messages without any order. One ProcessNoOrder Orchestration instance will be created for &lt;b&gt;each&lt;/b&gt; inbound message.&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;The &lt;b&gt;ProcessInOrder&lt;/b&gt; Orchestration processes all messages in &lt;b&gt;one&lt;/b&gt; sequence. &lt;b&gt;Only one&lt;/b&gt; ProcessInOrder Orchestration instance will be created.&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;The &lt;b&gt;ProcessInOrderByCompany&lt;/b&gt; Orchestration processes messages in sequences &lt;b&gt;correlated &lt;/b&gt;by the&lt;b&gt; Company&lt;/b&gt; value (A, B, C, D, etc.). The separate queue is created for each new value of the Company. Messages inside queues are processed in order. Queues for different Companies are independent. A separate ProcessInOrderByCompany Orchestration instance will be created for each new Company value.&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;The &lt;b&gt;ProcessInOrderByProduct&lt;/b&gt; Orchestration works exactly as the &lt;b&gt;ProcessInOrderByCompany&lt;/b&gt; Orchestration but &lt;b&gt;correlated &lt;/b&gt;by the&lt;b&gt; Product&lt;/b&gt; value (xx, yy, etc.). &lt;/p&gt;
&lt;h2 style="MARGIN: 10pt 0in 0pt"&gt;&lt;a name="Discussions"&gt;&lt;/a&gt;Discussions&lt;/h2&gt;
&lt;h3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;a name="Performance"&gt;&lt;/a&gt;Performance&lt;/h3&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;By default all Orchestration and Messaging Service instances works in the Parallel Delivery mode with maximum performance.&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;If we check up the Ordered Delivery option in Send Port, BizTalk will initiate the Send Port instance as a singleton service. It is always a single instance. We don’t have the flexibility of the Orchestration where we could tune up “the proportion of the sequencing” and could control the recycling of the service instance.&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;Send Port OD could be in two states, on and off: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;OD is off: a service instance per message, one message per queue, maximum performance. 
&lt;/li&gt;&lt;li&gt;OD is on: one infinite service instance, all messages in one queue, minimum performance. &lt;/li&gt;&lt;/ul&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;Orchestration OD could be in two states also, on and off:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;OD is off: a service instance per one activating message, one activating message per queue, maximum performance. 
&lt;/li&gt;&lt;li&gt;OD is on: one or several service instances, one per new correlation set value; all correlated messages per queue; performance is from min to max, depends ot the correlation set.. &lt;/li&gt;&lt;/ul&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;Carefully designing the correlation sets we could tune up the performance of the Orchestration. For example, if we only care of the document order for each separate Company, we include the Company to the Correlation set. If we had thousand documents related to hundreds companies, the performance will be near maximum. If there are only two companies, the performance will be near minimum, and we should consider improving the correlation with one more parameter.&lt;/p&gt;
&lt;h3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;a name="Orchestrations_and_Zombies"&gt;&lt;/a&gt;Orchestrations and Zombies &lt;/h3&gt;
&lt;div style="BORDER-BOTTOM: #aaaaaa 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 2pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BACKGROUND: #f9f9f9; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;
&lt;p style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 10pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BACKGROUND: #f9f9f9; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;Zombies are big problem of Convoy Orchestrations. See &lt;a title="Title of this entry." href="http://geekswithblogs.net/LeonidGaneline/archive/2011/02/05/biztalk-instance-subscription-details.aspx"&gt;&lt;b&gt;BizTalk: Instance Subscription and Convoys: Details&lt;/b&gt;&lt;/a&gt; article with description of this problem. This problem could be mitigated but could not be completely removed. We are waiting a new version of the BizTalk Server where this issue will be targeted.&lt;/p&gt;&lt;/div&gt;
&lt;h3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;a name="BizTalk_Server_version_Next_Ordered_Delivery_and_Zombies"&gt;&lt;/a&gt;BizTalk Server version Next, Ordered Delivery and Zombies&lt;/h3&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;It is possible the BizTalk Server version Next will implement the automatic Ordered Delivery for Orchestrations, with pattern similar to the Ordered Delivery in Send Ports.&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;Three new Orchestration parameters are shown up there: &lt;b&gt;Ordered Delivery&lt;/b&gt;, &lt;b&gt;Stop on Exception&lt;/b&gt;, and &lt;b&gt;Recycle Interval (in seconds)&lt;/b&gt;&lt;b&gt;.&lt;/b&gt; &lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt; &lt;/p&gt;
&lt;blockquote style="MARGIN-RIGHT: 0px" dir="ltr"&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;&lt;a href="http://social.technet.microsoft.com/wiki/cfs-file.ashx/__key/communityserver-wikis-components-files/00-00-00-00-05/7840.OrchestrationParameters.gif"&gt;&lt;img style="BORDER-BOTTOM: 0px solid; BORDER-LEFT: 0px solid; BORDER-TOP: 0px solid; BORDER-RIGHT: 0px solid" alt="" src="http://social.technet.microsoft.com/wiki/resized-image.ashx/__size/526x467/__key/communityserver-wikis-components-files/00-00-00-00-05/7840.OrchestrationParameters.gif" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p style="MARGIN: 0in 0in 10pt" dir="ltr"&gt;&lt;strong&gt;Ordered Delivery&lt;/strong&gt; parameter works in the same way as the Ordered Delivery parameter of the Send Port. Now we don’t have to build the Convoy Orchestration manually. No more Loop inside Orchestration. &lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;If the Ordered Delivery parameter set up to True, the Orchestration is working as a Singleton. The first Receive shape receives all correlated messages in sequence. Correlation set is created implicitly regards of the Activation Subscription expression.&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;There are several limitations for this kind of Orchestration. The most important is: only one Receive shape is permitted here.&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;There are two big advantages of this new feature: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Simplified Orchestration design for the Ordered Delivery. 
&lt;/li&gt;&lt;li&gt;No more Zombies. The Orchestration instance is recycled in controllable way, when no messages, matched the Orchestration Subscription, are placed in the MessageBox. &lt;/li&gt;&lt;/ul&gt;
&lt;h3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;a name="Conclusion"&gt;&lt;/a&gt;Conclusion&lt;/h3&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt;We discussed the Ordered Delivery implemented in the BizTalk Server and ways to improve it.&lt;/p&gt;
&lt;p style="MARGIN: 0in 0in 10pt"&gt; &lt;/p&gt; &lt;img src="http://geekswithblogs.net/LeonidGaneline/aggbug/148315.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Leonid Ganeline</dc:creator>
            <guid>http://geekswithblogs.net/LeonidGaneline/archive/2012/01/11/biztalk-ordered-delivery.aspx</guid>
            <pubDate>Wed, 11 Jan 2012 22:34:36 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LeonidGaneline/comments/148315.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LeonidGaneline/archive/2012/01/11/biztalk-ordered-delivery.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/LeonidGaneline/comments/commentRss/148315.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LeonidGaneline/services/trackbacks/148315.aspx</trackback:ping>
        </item>
        <item>
            <title>BizTalk: Sample: Error Handling</title>
            <link>http://geekswithblogs.net/LeonidGaneline/archive/2012/01/01/biztalk-sample-error-handling.aspx</link>
            <description>&lt;p&gt;Recently I uploaded a "&lt;a title="BizTalk: Sample: Error Handling" href="http://code.msdn.microsoft.com/BizTalk-Sample-Error-69c099be" target="_blank"&gt;BizTalk: Sample: Error Handling&lt;/a&gt;" in MSDN Gallery&lt;/p&gt;
&lt;p&gt;This sample shows the BizTalk features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Routing Failed Messages in ports &lt;/li&gt;
&lt;li&gt;Catching Failed Messages with Send Port &lt;/li&gt;
&lt;li&gt;Catching Failed Messages with Orchestration &lt;/li&gt;
&lt;li&gt;Handling Exceptions inside Orchestration &lt;/li&gt;
&lt;li&gt;Handling SOAP Fault messages inside Orchestration &lt;/li&gt;&lt;/ul&gt;
&lt;script src="undefinedbroker-config.js?1325447716114"&gt;&lt;/script&gt; &lt;img src="http://geekswithblogs.net/LeonidGaneline/aggbug/148207.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Leonid Ganeline</dc:creator>
            <guid>http://geekswithblogs.net/LeonidGaneline/archive/2012/01/01/biztalk-sample-error-handling.aspx</guid>
            <pubDate>Sun, 01 Jan 2012 19:57:03 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LeonidGaneline/comments/148207.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LeonidGaneline/archive/2012/01/01/biztalk-sample-error-handling.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LeonidGaneline/comments/commentRss/148207.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LeonidGaneline/services/trackbacks/148207.aspx</trackback:ping>
        </item>
        <item>
            <title>BizTalk Orchestration Naming Conventions</title>
            <link>http://geekswithblogs.net/LeonidGaneline/archive/2011/12/28/biztalk-orchestration-naming-conventions.aspx</link>
            <description>&lt;h1&gt;&lt;font style="FONT-WEIGHT: normal" size="3"&gt;&lt;a name="_Toc232937397"&gt; &lt;/a&gt;This is a second part of the BizTalk Naming Convention.&lt;/font&gt;&lt;/h1&gt;
&lt;div&gt;&lt;font style="FONT-WEIGHT: normal" size="3"&gt;Part 1: &lt;/font&gt;&lt;a style="TEXT-ALIGN: left; TEXT-TRANSFORM: lowercase; BACKGROUND-COLOR: rgb(249,249,249); FONT-FAMILY: Arial, Verdana, Tahoma; COLOR: rgb(172,44,43); FONT-SIZE: 1.2em; FONT-WEIGHT: bold; TEXT-DECORATION: none" id="viewpost_ascx_TitleUrl" class="singleposttitle" title="Title of this entry." href="http://geekswithblogs.net/LeonidGaneline/archive/2009/07/31/biztalk-naming-convention-for-the-biztalk-solutions.aspx"&gt;biztalk: BizTalk solution naming convention&lt;/a&gt;&lt;/div&gt;
&lt;h1&gt;&lt;a name="_Toc232937397"&gt;Special Orchestration Objects&lt;/a&gt; &lt;/h1&gt;
&lt;h2&gt;&lt;?xml:namespace prefix = o /?&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;p class="Syntax"&gt;&amp;lt;Message&amp;gt; =: &lt;br /&gt;&lt;b&gt;&lt;span style="WHITE-SPACE: pre" class="Apple-tab-span"&gt;&lt;/span&gt;      msg_&lt;/b&gt; + &amp;lt;ShortMessageType&amp;gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="Syntax"&gt;&amp;lt;Variable&amp;gt; =: &lt;br /&gt;&lt;b&gt;&lt;span style="WHITE-SPACE: pre" class="Apple-tab-span"&gt;&lt;/span&gt;      var_&lt;/b&gt; + &amp;lt;Name&amp;gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="Syntax"&gt;&amp;lt;CorrelationSet&amp;gt; =: &lt;br /&gt;&lt;b&gt;&lt;span style="WHITE-SPACE: pre" class="Apple-tab-span"&gt;&lt;/span&gt;      cor_&lt;/b&gt; + &amp;lt;Name&amp;gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="Syntax"&gt;&amp;lt;OrchestrationParameter&amp;gt; =: &lt;br /&gt;&lt;b&gt;&lt;span style="WHITE-SPACE: pre" class="Apple-tab-span"&gt;&lt;/span&gt;      par_&lt;/b&gt; + &amp;lt; Name&amp;gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="Syntax"&gt;&amp;lt;RoleLink&amp;gt; =: &lt;br /&gt;&lt;b&gt;&lt;span style="WHITE-SPACE: pre" class="Apple-tab-span"&gt;&lt;/span&gt;      roleLink_&lt;/b&gt; + &amp;lt;Name&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="Note"&gt;&lt;b&gt;Note:&lt;/b&gt; &lt;span class="NoteChar"&gt;These objects are special BizTalk objects. They are used in different language context and sometime they use different language syntax. Prefixes help to differentiate the objects in the XLang expressions. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="Syntax"&gt;&amp;lt;Port&amp;gt; =: &lt;br /&gt;&lt;span style="WHITE-SPACE: pre" class="Apple-tab-span"&gt;&lt;/span&gt;      &amp;lt;prefix&amp;gt; + &amp;lt;Name&amp;gt;&lt;span style="FONT-SIZE: 12pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN-LEFT: 0.5in" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;where&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style="BORDER-COLLAPSE: collapse; MARGIN-LEFT: 0.5in; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 0in 0in 0in" class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0"&gt;
&lt;tbody&gt;
&lt;tr style="PAGE-BREAK-INSIDE: avoid; HEIGHT: 34.55pt; mso-yfti-irow: 0; mso-yfti-firstrow: yes"&gt;
&lt;td style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; PADDING-RIGHT: 5.4pt; HEIGHT: 34.55pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" valign="top"&gt;&lt;/td&gt;
&lt;td style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; PADDING-RIGHT: 5.4pt; HEIGHT: 34.55pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-left-alt: inset #D4D0C8 .75pt" valign="top"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;Send &lt;/span&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; PADDING-RIGHT: 5.4pt; HEIGHT: 34.55pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-left-alt: inset #D4D0C8 .75pt" valign="top"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;Receive &lt;/span&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 114.25pt; PADDING-RIGHT: 5.4pt; HEIGHT: 34.55pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-left-alt: inset #D4D0C8 .75pt" valign="top" width="152"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;Send-Receive &lt;br /&gt;(Solicit-Response) &lt;/span&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 139.5pt; PADDING-RIGHT: 5.4pt; HEIGHT: 34.55pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-left-alt: inset #D4D0C8 .75pt" valign="top" width="186"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;Receive-Send &lt;br /&gt;(Request- Response) &lt;/span&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr style="PAGE-BREAK-INSIDE: avoid; mso-yfti-irow: 1; mso-yfti-lastrow: yes"&gt;
&lt;td style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-top-alt: inset #D4D0C8 .75pt" valign="top"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;prefix&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-left-alt: inset #D4D0C8 .75pt; mso-border-top-alt: inset #D4D0C8 .75pt" valign="top"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;S_+&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-left-alt: inset #D4D0C8 .75pt; mso-border-top-alt: inset #D4D0C8 .75pt" valign="top"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;R_+&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 114.25pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-left-alt: inset #D4D0C8 .75pt; mso-border-top-alt: inset #D4D0C8 .75pt" valign="top" width="152"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;SR_+&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 139.5pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-left-alt: inset #D4D0C8 .75pt; mso-border-top-alt: inset #D4D0C8 .75pt" valign="top" width="186"&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;RS_+&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p class="Note"&gt;&lt;b&gt;Notes:&lt;/b&gt;&lt;b&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 1in; mso-list: l0 level1 lfo1" class="Note"&gt;The Port objects are the only objects which can be seen outside orchestration. We see them while bind orchestration with Ports, not the orchestration Ports but Ports created in the BizTalk Administration Console. Sometimes the orchestration Ports are named as Logical Ports and the Ports as the Physical Ports. &lt;a href="http://geekswithblogs.net/LeonidGaneline/archive/2007/09/27/115663.aspx"&gt;Here&lt;/a&gt; are some considerations about this ambiguity with Port names. &lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;&lt;li&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 1in; mso-list: l0 level1 lfo1" class="Note"&gt;Send-receive prefixes help while Orchestration is binding with Ports. Ports with different Communication pattern are using different prefixes. &lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p class="Note"&gt;&lt;b&gt;Example:&lt;/b&gt; S_ OrderAck.&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="Note"&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;Orchestration Object Types&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;p class="Syntax"&gt;&amp;lt;ArtifactType&amp;gt; =:&lt;br /&gt;      &amp;lt;ArtifactName&amp;gt; + “&lt;b&gt;_type&lt;/b&gt;”&lt;span style="FONT-SIZE: 12pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="Note"&gt;&lt;a name="_Toc232937396"&gt;&lt;b&gt;Note:&lt;/b&gt; We can see orchestration types in the Orchestration View window in Types. They are: Port, Multi-part Message, Correlation and Role Link Types. We can use one suffix the “&lt;b&gt;_type&lt;/b&gt;” for all different types because different types are seen only in the different lists and never mixed. For instance, we can never see the port types together with message types.&lt;o:p&gt;&lt;/o:p&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="Note"&gt;&lt;b&gt;Controversial:&lt;/b&gt;Suffixes for types work better than prefixes, because types are mostly used in the drop-down lists not in the XLang expressions.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;h2&gt;Orchestration Workflow Shapes&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;h3&gt;Problems with orchestration shapes:&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;p style="TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo2" class="MsoListParagraphCxSpFirst"&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="LINE-HEIGHT: 115%; TEXT-INDENT: -0.25in; FONT-FAMILY: Symbol; FONT-SIZE: 12pt"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="TEXT-INDENT: -0.25in"&gt;Shapes are too small to display long names (only 12-18 characters are visible).&lt;/span&gt; 
&lt;/li&gt;&lt;li&gt;&lt;span style="LINE-HEIGHT: 115%; TEXT-INDENT: -0.25in; FONT-FAMILY: Symbol; FONT-SIZE: 12pt"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="TEXT-INDENT: -0.25in"&gt;We have to hover a mouse over a shape or click shape to see Properties window and to "understand" this shape, to understand which message is processed.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Useful features:&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;p style="TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo3" class="MsoListParagraphCxSpFirst"&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="LINE-HEIGHT: 115%; TEXT-INDENT: -0.25in; FONT-FAMILY: Symbol; FONT-SIZE: 12pt"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;span style="TEXT-INDENT: -0.25in"&gt;Shapes have names, but names are not the “variable names”, not identifiers. They are descriptions (excluding the Port shapes names, which have not Name parameter but Identifier and Description parameters). Shape names are used only for description not as XLang variable identifiers. Shape names can be long and can include any symbols as spaces, dots, etc.&lt;/span&gt; 
&lt;/li&gt;&lt;li&gt;&lt;span style="LINE-HEIGHT: 115%; TEXT-INDENT: -0.25in; FONT-FAMILY: Symbol; FONT-SIZE: 12pt"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;span style="TEXT-INDENT: -0.25in"&gt;Icons of shapes give us the useful information. Do not repeat the “icon information” by words. For example, we can a name a Construction shape as “Construct OrderAck” or as “OrderAck”. Last variant give us more clear and short definition because we have the Construction icon + name.&lt;/span&gt; 
&lt;/li&gt;&lt;li&gt;&lt;span style="LINE-HEIGHT: 115%; TEXT-INDENT: -0.25in; FONT-FAMILY: Symbol; FONT-SIZE: 12pt"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;span style="TEXT-INDENT: -0.25in"&gt;Shape names are used mainly in Orchestration Editor (excluding the Port shapes names). We don’t need the “well-sorted” names, so we don’t need to use prefixes, because the main purpose of the prefixes is creating well-sorted lists.&lt;/span&gt; 
&lt;/li&gt;&lt;li&gt;&lt;span style="LINE-HEIGHT: 115%; TEXT-INDENT: -0.25in; FONT-FAMILY: Symbol; FONT-SIZE: 12pt"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;span style="TEXT-INDENT: -0.25in"&gt;Group shape is a scalable shape. Nesting other shapes to a Group shape can make a long description visible. Group shape will display as much text as you want. Group shapes add a lot of documentation value to the orchestration.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Rules for shapes&lt;span style="LINE-HEIGHT: 115%; FONT-SIZE: 12pt; mso-fareast-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;p style="TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4" class="MsoListParagraphCxSpFirst"&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="TEXT-INDENT: -0.25in; FONT-FAMILY: Symbol"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;span style="TEXT-INDENT: -0.25in"&gt;Whenever it is possible use the short MessageType as a shape name.&lt;/span&gt; 
&lt;/li&gt;&lt;li&gt;&lt;span style="LINE-HEIGHT: 115%; TEXT-INDENT: -0.25in; FONT-FAMILY: Symbol; FONT-SIZE: 12pt"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;span style="TEXT-INDENT: -0.25in"&gt;Do not repeat a type of shape icon by word.&lt;/span&gt; 
&lt;/li&gt;&lt;li&gt;&lt;span style="LINE-HEIGHT: 115%; TEXT-INDENT: -0.25in; FONT-FAMILY: Symbol; FONT-SIZE: 12pt"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;span style="TEXT-INDENT: -0.25in"&gt;Feel free to use spaces and any other symbols inside the shape names.&lt;/span&gt; 
&lt;/li&gt;&lt;li&gt;&lt;span style="LINE-HEIGHT: 115%; TEXT-INDENT: -0.25in; FONT-FAMILY: Symbol; FONT-SIZE: 12pt"&gt;&lt;span style="FONT: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;span style="TEXT-INDENT: -0.25in"&gt;Feel free to repeat the shape names.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p class="Note"&gt;&lt;b&gt;Note:&lt;/b&gt; Purpose of the orchestration and the most of the shapes is in &lt;strong&gt;processing the messages&lt;/strong&gt;. We can unambiguously describe the messages by the message type. A message type gives us the main information about a message. That is why in the most cases using the message type as the shape name gives us the main information about message flow, about the whole orchestration processing.&lt;br /&gt;&lt;strong&gt;Example&lt;/strong&gt;: Send shape with name "OrderAck" means “send OrderAck message”.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="Note"&gt;&lt;b&gt;Controversial:&lt;/b&gt; &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div class="Note"&gt;Orchestration Naming Convetion works not to make easier the administration and troubleshooting but mostly to make orchestration more readable. Most orchestration names are not visible outside the Orchestration Editor. So, do not force the orchestration naming convention to hard! If your developers use differen conventions, it is fine; of course, if they understand each other. Forcing convention can do more harm than help. It can force team to spend more effort for a little.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div class="Note"&gt;When exception is thrown from a shape, the error description includes a name of the shape. It is a rare case when names are exposed outside of the Orchestration Editor. When we use MessageType as a name of shapes, many shapes can get the same name. So, if we want to differentiate shape names for debugging purpose, we could use numbers or single letters in the end of names. &lt;br /&gt;&lt;strong&gt;Example&lt;/strong&gt;: “OrderAck 2”&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt; &lt;img src="http://geekswithblogs.net/LeonidGaneline/aggbug/148164.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Leonid Ganeline</dc:creator>
            <guid>http://geekswithblogs.net/LeonidGaneline/archive/2011/12/28/biztalk-orchestration-naming-conventions.aspx</guid>
            <pubDate>Wed, 28 Dec 2011 20:38:39 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LeonidGaneline/comments/148164.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LeonidGaneline/archive/2011/12/28/biztalk-orchestration-naming-conventions.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/LeonidGaneline/comments/commentRss/148164.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LeonidGaneline/services/trackbacks/148164.aspx</trackback:ping>
        </item>
        <item>
            <title>BizTalk: Using context for routing</title>
            <link>http://geekswithblogs.net/LeonidGaneline/archive/2011/02/27/biztalk-using-context-for-routing.aspx</link>
            <description>&lt;div style="margin: 0in 0in 10pt"&gt;
&lt;p&gt;[See &lt;a href="http://geekswithblogs.net/LeonidGaneline/archive/2011/02/27/biztalk-sample-context-routing-and-throttling-with-orchestration.aspx"&gt;Sample: Context routing and throttling with orchestration&lt;/a&gt;]&lt;/p&gt;
&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Imagine the project where most of the routing happens between orchestrations. I.e. routing is mostly between the MessageBox and orchestration with direct endpoints.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Imagine also the most of the messages are with the same Message type.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Usually in this case messages got the special node only for the routing. For example, the field can be the “Originator” or “Recipient” or “From” or “To”.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;What wrong is with this approach, it creates the dependency between the message and the message processing. Message “knows” something about Originator or Recipient.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;So what we can do with it? How can we “colorize” the same message to route it to the different places without changing the message itself?&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;One of the decisions is to use the message context.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;span style="font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-bidi-font-size: 10.0pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;BizTalk uses the promoted properties for routing. &lt;/span&gt; There are two kinds of the properties: the content properties and the context properties. The &lt;b&gt;content property&lt;/b&gt; extracts its value from inside the message, it is a value of the element or attribute. [See &lt;a href="http://msdn.microsoft.com/en-us/library/aa561535(v=BTS.70).aspx"&gt;MSDN&lt;/a&gt;] The &lt;b&gt;context property&lt;/b&gt; gets its value from the message environment. It can be the port name that receive this message, it can be the message Id, created by the BizTalk. Context properties look like the headers in the SOAP message. Actually they are not the headers but behave like headers. The context properties are the good match for our case.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;First, we don’t have to change the message itself to set or change the routing property. The context is stored outside the message body.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt; vertical-align: top"&gt;Second, we don’t have to create the property schema to use the context properties. [See &lt;a href="http://msdn.microsoft.com/en-us/library/aa559209(v=BTS.70).aspx"&gt;MSDN: How to create Property schema&lt;/a&gt;] BizTalk has the predefined schema set for the context properties. [See &lt;a href="http://msdn.microsoft.com/en-us/library/aa562116(BTS.70).aspx"&gt;MSDN: Message Context Properties&lt;/a&gt;] Use one of them and that's it.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;The main purpose of the context properties is working on behalf of the BizTalk internals. But we can read, create and change them. Just do not interfere with BizTalk internals on this way.&lt;/div&gt;
&lt;p&gt; &lt;/p&gt; &lt;img src="http://geekswithblogs.net/LeonidGaneline/aggbug/144129.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Leonid Ganeline</dc:creator>
            <guid>http://geekswithblogs.net/LeonidGaneline/archive/2011/02/27/biztalk-using-context-for-routing.aspx</guid>
            <pubDate>Mon, 28 Feb 2011 00:26:18 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LeonidGaneline/comments/144129.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LeonidGaneline/archive/2011/02/27/biztalk-using-context-for-routing.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LeonidGaneline/comments/commentRss/144129.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LeonidGaneline/services/trackbacks/144129.aspx</trackback:ping>
        </item>
        <item>
            <title>BizTalk: Sample: Context routing and Throttling with orchestration </title>
            <link>http://geekswithblogs.net/LeonidGaneline/archive/2011/02/27/biztalk-sample-context-routing-and-throttling-with-orchestration.aspx</link>
            <description>&lt;div style="margin: 0in 0in 10pt"&gt;[See &lt;a href="http://geekswithblogs.net/LeonidGaneline/archive/2011/02/27/biztalk-using-context-for-routing.aspx"&gt;BizTalk: Using context for routing&lt;/a&gt;]&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;The sample demonstrates using orchestration for throttling and using context routing.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Usually throttling is implemented on the host level (in BizTalk 2010 we can also use the host instance level throttling). This sample demonstrates the &lt;b&gt;throttling with orchestration convoy,&lt;/b&gt; that slows down a message flow from some customers. Sample implements sort of quality service agreement layer for different kind of customers.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;The sample demonstrates the &lt;b&gt;context routing&lt;/b&gt; between orchestrations. It has several advantages over the content routing. For example, we don’t have to create the property schema and promote properties on the schemas; we don’t have to change the message content to change routing.&lt;/div&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="4"&gt;&lt;font color="#17365d"&gt;&lt;font size="3"&gt;Use case:&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt; The BizTalk application has a main processing orchestration that process all input messages. The application usually works as an OLTP application. Input messages came in random order without peaks, typical scenario for the on-line users.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;But sometimes the big data batch payloads come. These batches overload processing orchestrations. All processes, activated by on-line users after the payload, come to &lt;b&gt;the same queue&lt;/b&gt; and are processed only &lt;b&gt;after&lt;/b&gt; the payload. Result is on-line users can see significant delay in processing. It can be minutes or hours, depending of the batch size.&lt;/div&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="4"&gt;&lt;font color="#17365d"&gt;&lt;font size="3"&gt;Requirements:&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;On-line user’s processing should work without delays. Big batches cannot disturb on-line users. There should be higher priority for the on-line users and the lower priority for the batches.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2011/02/biztalk-contextrouting.jpg" /&gt;&lt;/div&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="4"&gt;&lt;font color="#17365d"&gt;&lt;font size="3"&gt;Design:&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Decision is to divide the message flow in two branches, one for on-line users and second for batches. Branch with batches provides messages to the processing line with low priority, and the on-line user’s branch – with high priority.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;All messages are provided by one hi-speed receive port.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;BTS.ReceivePortName context property is used for routing. The &lt;b&gt;Router&lt;/b&gt; orchestration separates messages sent from on-line users and from the batch messages.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2011/02/router.jpg" /&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;span style="font-size: 9pt"&gt;But the Router does not use the BizTalk provided value of this property, the Router set up this value by itself. Router uses the content of the messages to decide if it is from on-line users or from batches.&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;span style="font-size: 9pt"&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;span style="font-size: 9pt"&gt;The message context property the BTS.ReceivePortName is changed respectively, its value works as a recipient address, as the “To” address for the next recipient orchestrations. Ideally we should use two receive ports or two receive locations and BizTalk set up the context property for us. If we use the same context for both messages (the same port and location), we need to use orchestration to modify the context property using content of the messages or something else.&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;span style="font-size: 9pt"&gt;Those next orchestrations are the &lt;/span&gt;BatchBottleneck and the MainProcess orchestrations.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Messages with context equal “ToBatch” are filtered up by the &lt;b&gt;BatchBottleneck&lt;/b&gt; orchestration. It is a unified convoy orchestration and it throttles the message flow, delaying the message delivery to the MainProcess orchestration.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2011/02/batchbottleneck.jpg" /&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;The BatchBottleneck orchestration changes the message context to the “ToProcess” and sends messages one after another with small delay in between. Delay can be configured in the BizTalk config file as:&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt 40px"&gt;&lt;br /&gt;
                &amp;lt;appSettings&amp;gt;&lt;br /&gt;
                                &amp;lt;add key="GLD_Tests_TwoWayRouting_BatchBottleneck_DelayMillisec" value="100"/&amp;gt;&lt;br /&gt;
                &amp;lt;/appSettings&amp;gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Of course, messages with context equal “ToProcess” are filtered up by the &lt;b&gt;MainProcess&lt;/b&gt; orchestration.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt; &lt;img alt="" src="http://ganeline.files.wordpress.com/2011/02/mainprocess-filter.jpg" /&gt;&lt;/div&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;b&gt;&lt;font size="1"&gt;&lt;font size="2"&gt;&lt;font color="#17365d"&gt;NOTES:&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;ul&gt;
    &lt;li&gt;Filters with string values: In Orchestrations (the first Receive shape in orchestration) use string values WITH quotes; in Send Ports use string values WITHOUT quotes.&lt;/li&gt;
    &lt;li&gt;Filters on the Send Ports are dynamic; we can change them in run-time. Filters on the Orchestrations are static; we can change them only in design-time.&lt;/li&gt;
    &lt;li&gt;To check the existence of the promoted property inside orchestration use the Expression shape with construction like this:&lt;br /&gt;
          if (&lt;span style="font-size: 9pt"&gt;BTS.ReceivePortName exists myMessage) { …; }&lt;br /&gt;
    &lt;/span&gt;&lt;span style="font-size: 9pt"&gt;It is not possible in the Message Assignment shape because using the “if” statement inside Message Assignment is prohibited. &lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;Several predefined context properties can behave in specific way. Say MessageTracking.OriginatingMessage or XMLNORM.DocumentSpecName, they are required some internal rules should be applied to the format or usage of this properties. MessageTracking.* parameters require you have to use tracking and you can get unexpected run-time errors in some cases. My recommendation is - use very limited set of the predefined context properties.&lt;/li&gt;
    &lt;li&gt;To “attach” the new promoted property to the message, we have to use correlation. The correlation type should include this property. [&lt;a href="http://blogs.digitaldeposit.net/saravana/post/2007/01/08/Property-Promotion-inside-Orchestration.aspx"&gt;Here is a good explanation by Saravana &lt;/a&gt;]&lt;/li&gt;
    &lt;li&gt;Say we have two correlation types, each with one parameter inside. If we want to correlate to both parameters simultaneously, we cannot use both correlation types, we have to create the correlation type with both parameters and use this type. Otherwise only one correlation type would be chosen for correlation, that means only parameter would be used for correlation.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;[&lt;a href="http://code.msdn.microsoft.com/BizTalk-Sample-Context-c1c34a00"&gt;The sample source code is here&lt;/a&gt;].&lt;/div&gt;
&lt;p&gt; &lt;/p&gt; &lt;img src="http://geekswithblogs.net/LeonidGaneline/aggbug/144128.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Leonid Ganeline</dc:creator>
            <guid>http://geekswithblogs.net/LeonidGaneline/archive/2011/02/27/biztalk-sample-context-routing-and-throttling-with-orchestration.aspx</guid>
            <pubDate>Sun, 27 Feb 2011 23:04:53 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LeonidGaneline/comments/144128.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LeonidGaneline/archive/2011/02/27/biztalk-sample-context-routing-and-throttling-with-orchestration.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/LeonidGaneline/comments/commentRss/144128.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LeonidGaneline/services/trackbacks/144128.aspx</trackback:ping>
        </item>
        <item>
            <title>BizTalk: Suspend shape and Convoy</title>
            <link>http://geekswithblogs.net/LeonidGaneline/archive/2011/02/09/biztalk-suspended-shape-and-convoy.aspx</link>
            <description>&lt;div style="margin: 0in 0in 10pt"&gt;Part 1: &lt;font color="#0000ff"&gt;&lt;a href="http://geekswithblogs.net/LeonidGaneline/archive/2011/02/05/biztalk-instance-subscription-details.aspx"&gt;BizTalk: Instance Subscription and Convoys: Details&lt;/a&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;This is a Part 2.&lt;/div&gt;
&lt;hr /&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;I am discussing the Suspend shape together with Convoys and going to show that using them together is undesirable.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;In previous article we investigated the Instance Subscriptions and how they could create situation with dangerous zones in processing. &lt;/div&gt;
&lt;hr /&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Let' start with &lt;b&gt;Suspend shape&lt;/b&gt;. [&lt;a href="http://msdn.microsoft.com/en-us/library/aa560868(BTS.70).aspx"&gt;See the BizTalk Help&lt;/a&gt;]&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;"&lt;em&gt;You can use the Suspend shape to make an orchestration instance stop running until an administrator explicitly intervenes, perhaps to reflect an error condition that requires attention beyond the scope of the orchestration. All of the state information for the orchestration instance is saved, and will be reinstated when the administrator resumes the orchestration instance.&lt;/em&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;em&gt;When an orchestration instance is suspended, an error is raised. You can specify a message string to accompany the error to help the administrator diagnose the situation&lt;/em&gt;."&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;On the Suspend shape the orchestration is stopped in the Suspended (Resumable) state. Next we have two choices, one is to &lt;b&gt;resume&lt;/b&gt; and the second is to &lt;b&gt;terminate&lt;/b&gt; the orchestration.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Is the orchestration is stopped or unenlisted? You don't find a note about it anywhere. The fact is the Orchestration &lt;b&gt;is stopped and still enlisted&lt;/b&gt;. It is very important.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;So again, the suspended orchestration can be resumed or terminated. The moment when the operator or the operation script resumes or terminates can be far away. It is also important.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Let's go back to the case from previous article. Make sure you notice the convoy and the dangerous zone after the last Receive shape.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt; &lt;img alt="" src="http://ganeline.files.wordpress.com/2011/02/convoyandsuspend-1.jpg" /&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Now we have a &lt;b&gt;Suspend shape&lt;/b&gt; inside the orchestration.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2011/02/convoyandsuspend-2.jpg" /&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;The first orchestration instance is suspended. Next messages start new orchestration instance and have been consumed by this orchestration, right? Wrong!&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2011/02/convoyandsuspend-3.jpg" /&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;The orchestration is stopped on the Suspend shape but still enlisted. Now the dangerous zone, the "zombie zone" is expanded to the interval between the last receive and the moment of termination or end of the orchestration. The new orchestration instance for this convoy will not start till this moment. How fast operator finds out this suspended orchestration? Maybe hours or days. All this time orchestration is still enlisted and gathering the convoy messages. We can resume the orchestration but we cannot resume these messages together with orchestration.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Seems the name Suspended of the orchestration is misleading. The orchestration can be in the Started (and Enlisted)/Stopped (and Enlisted)/Unenlisted state. The Suspend shape switches orchestration exactly to the Stopped state. The &lt;b&gt;Stop&lt;/b&gt; name would describe the shape clearly and unambiguously and the &lt;b&gt;Stopped&lt;/b&gt; state would describe the orchestration.&lt;/div&gt;
&lt;hr /&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="2"&gt;&lt;em&gt;&lt;font color="#17365d"&gt;&lt;font size="3"&gt;Imagine we can change the BizTalk. &lt;/font&gt;&lt;/font&gt;&lt;/em&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;ul&gt;
    &lt;li&gt;The Orchestration editor can search these situations and returns the compile error. In similar case the Orchestration Editor forces us to use only ordered delivery port with convoys.&lt;/li&gt;
    &lt;li&gt;The run-time core can force the orchestration with convoy be suspended in Unresumable state, that means the run-time unenlists the orchestration instance subscriptions.&lt;/li&gt;
    &lt;li&gt;The Suspend shape name should be changed. The "Suspend" name is misleading. The "Stop" name is clear and unambiguous. The same for the orchestration state, it should be “Stopped” not “Suspended (Resumable)”.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="3"&gt; &lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;hr /&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="3"&gt;&lt;font color="#17365d"&gt;Conclusion:&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;span&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt; &lt;/span&gt;&lt;/span&gt;It is not recommended using a Suspend shape together with the convoy orchestrations.&lt;/li&gt;
&lt;/ul&gt; &lt;img src="http://geekswithblogs.net/LeonidGaneline/aggbug/143881.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Leonid Ganeline</dc:creator>
            <guid>http://geekswithblogs.net/LeonidGaneline/archive/2011/02/09/biztalk-suspended-shape-and-convoy.aspx</guid>
            <pubDate>Thu, 10 Feb 2011 06:06:53 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LeonidGaneline/comments/143881.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LeonidGaneline/archive/2011/02/09/biztalk-suspended-shape-and-convoy.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/LeonidGaneline/comments/commentRss/143881.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LeonidGaneline/services/trackbacks/143881.aspx</trackback:ping>
        </item>
        <item>
            <title>BizTalk: Instance Subscription and Convoys: Details</title>
            <link>http://geekswithblogs.net/LeonidGaneline/archive/2011/02/05/biztalk-instance-subscription-details.aspx</link>
            <description>&lt;div style="border-bottom: #fdbd5e 1pt solid; border-left: #fdbd5e 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #fdeb9f; border-top: #fdbd5e 1pt solid; border-right: #fdbd5e 1pt solid; padding-top: 1pt"&gt; &lt;/div&gt;
&lt;div style="border-bottom: #4f81bd 1pt solid; border-left: medium none; padding-bottom: 2pt; padding-left: 0in; padding-right: 0in; border-top: medium none; border-right: medium none; padding-top: 0in"&gt;
&lt;div style="margin: 2pt 0in 0pt"&gt;This is Part 1.&lt;/div&gt;
&lt;div style="margin: 2pt 0in 0pt"&gt;Part 2. &lt;a href="http://geekswithblogs.net/LeonidGaneline/archive/2011/02/09/biztalk-suspended-shape-and-convoy.aspx"&gt;&lt;strong&gt;&lt;font color="#002c99"&gt;BizTalk: Suspend shape and Convoy&lt;/font&gt;&lt;/strong&gt; &lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style="margin: 0in 0in 6pt"&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Convoys are frequently used in the in the orchestrations in BizTalk Server. Sometimes we have got contra intuitive behavior in the convoys, when messages and orchestrations get suspended in unpredictable manner. This issue is well-known, the suspended messages get name the "&lt;strong&gt;zombie&lt;/strong&gt;". The name is unofficial, but issue is still there. Here I would describe in details, what, when and why this zombie situations are happen.&lt;/div&gt;
&lt;hr /&gt;
&lt;div style="margin: 0in 0in 10pt"&gt; An orchestration can be enlisted with many subscriptions. In other word it can have several Receive shapes. Usually the first Receive uses the &lt;b&gt;Activation&lt;/b&gt; &lt;b&gt;subscription&lt;/b&gt; but other Receives create the &lt;b&gt;Instance&lt;/b&gt; &lt;b&gt;subscriptions&lt;/b&gt;. [&lt;a href="http://msdn.microsoft.com/en-us/library/dd800438(v=bts.10).aspx"&gt;See “Publish and Subscribe Architecture” in MSDN&lt;/a&gt;]&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Here is a sample process.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2011/02/sampleprocess.jpg" /&gt;&lt;/div&gt;
&lt;div&gt;This orchestration has two receives. It is a typical Sequential Convoy. [&lt;a href="http://msdn.microsoft.com/en-us/library/ms942189(v=bts.10).aspx"&gt;See "BizTalk Server 2004 Convoy Deep Dive" in MSDN by Stephen W. Thomas&lt;/a&gt;].&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Let's experiment started.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;There are three possible scenarios depended of the message sequences.&lt;/div&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="4"&gt;&lt;font color="#17365d"&gt;&lt;font size="3"&gt;First scenario: everything is OK&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;b&gt;&lt;font size="4"&gt;&lt;font color="#17365d"&gt;&lt;font size="3"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2011/02/instancesubscription-case11.jpg" /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Activation subscription for the Sample message is created when the orchestration the SampleProcess is enlisted.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;The Instance subscription is created only when the SampleProcess orchestration instance starts and this subscription is removed when the orchestration instance ends.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;So far so good, the Message_2 is delivered exactly in this time interval and consumed.&lt;/div&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="4"&gt;&lt;font color="#17365d"&gt;&lt;font size="3"&gt;Second scenario: no consumers&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="4"&gt;&lt;font color="#17365d"&gt;&lt;font size="3"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2011/02/instancesubscription-case21.jpg" /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Three Sample_2 messages are delivered. The first one is delivered before the SampleProcess starts and before the instance subscription is created. Second message is delivered in the correct time interval. The third one is delivered after the SampleProcess orchestration ended and the instance subscription was removed.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt 0.5in"&gt;Note:&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 10pt 1in"&gt;&lt;span&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;It is &lt;b&gt;not the first&lt;/b&gt; Sample_2 consumed. It was first in the queue but it was not waiting, it was suspended when it had been delivered to the Message Box and didn’t have any subscribers at this moment.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;The first and the last Sample_2 messages are Suspended (Nonresumable) in the Message Box. For each of them two (!) service instances have created. One service instance has the ServiceClass of &lt;b&gt;Messaging&lt;/b&gt;, and its Error Description is:&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt; &lt;img alt="" src="http://ganeline.files.wordpress.com/2011/02/case2-servicedetails-errorinformation-sample_21.jpg" /&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;The second service instance has the ServiceClass of &lt;b&gt;RoutingFailureReport&lt;/b&gt;, and its Error Description is:&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt; &lt;img alt="" src="http://ganeline.files.wordpress.com/2011/02/case2-servicedetails-errorinformation-sample_2-routingreport1.jpg" /&gt;&lt;/div&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="4"&gt;&lt;font color="#17365d"&gt;&lt;font size="3"&gt;Third scenario: something goes wrong&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="4"&gt;&lt;font color="#17365d"&gt;&lt;font size="3"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2011/02/instancesubscription-case31.jpg" /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Two Sample_2 messages are delivered. Both are delivered in the same interval, while the SampleProcess orchestration is working and the instance subscription has created.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;First Sample_2 is consumed. The second Sample_2 has the subscription, but the subscriber, the SampleProcess orchestration, will not consume it. After the SampleProcess orchestration is ended (And only &lt;b&gt;after&lt;/b&gt;! I will discuss this in the next article.), it is suspended (Nonresumable). Now only one service instance is suspended. This service instance has the ServiceClass of &lt;b&gt;Orchestration&lt;/b&gt;, and its Error Description is:&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2011/02/case3-servicedetails-errorinformation-orchestration1.jpg" /&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;In the Message tab the Sample_2 message is in the Suspended (Resumable) status.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt 0.5in"&gt;Notes:&lt;/div&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;span&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt; &lt;/span&gt;&lt;/span&gt;The orchestration consumes the extra message(s) and gets suspended together with these extra messages. These messages are not consumed in term of “processed by orchestration”. But they are consumed in term of the “delivered to the subscriber”. The receive shape in the orchestration does not receive these extra messages. But these messages are routed to the orchestration. The Error information looks ambiguous.&lt;/li&gt;
    &lt;li&gt;The time zone between the last receive shape and the end of the orchestration is a "&lt;strong&gt;dangerous zone&lt;/strong&gt;". The message delivery pattern should be scrutinized to avoid it.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style="margin: 0in 0in 10pt"&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt; &lt;/div&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="4"&gt;&lt;font color="#17365d"&gt;&lt;font size="3"&gt;Unified Sequential convoy&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt; Now one more scenario.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2011/02/instancesubscription-case41.jpg" /&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;It is a &lt;strong&gt;unified sequential convoy&lt;/strong&gt;. The activation subscription is for the same message type as it for the instance subscription. The Sample_2 message now is the Sample message. For simplicity the SampleProcess orchestration consumes only two Sample messages. Usually the orchestration consumes a lot of messages inside a loop in this scenario, but now there are only two of them.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;First message starts the orchestration, the second message goes inside this orchestration. Then the next pair of messages follows, and so on.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;But if the input messages follow in shorter intervals we have got the problem.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2011/02/instancesubscription-case51.jpg" /&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;We lose messages in unpredictable manner.&lt;/div&gt;
&lt;hr /&gt;
&lt;h3&gt;Conclusion:&lt;/h3&gt;
&lt;ul&gt;
    &lt;li&gt;Maybe the better behavior would be if the orchestration removes the instance subscription after the message is consumed, not in the end on the orchestration. This behavior looks like a bug. But right now it is a “feature” of the BizTalk subscription mechanism.&lt;/li&gt;
    &lt;li&gt;The time zone between the last receive shape and the end of the orchestration is a "&lt;strong&gt;dangerous zone&lt;/strong&gt;". The message delivery pattern should be scrutilized to avoid this zone as much as possible.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style="margin: 0in 0in 10pt"&gt; &lt;/div&gt;
&lt;hr /&gt;
&lt;h5&gt; Note [2011-2-9]:&lt;/h5&gt;
&lt;ul&gt;
    &lt;li&gt;I saw several times the explanation of the zombies, where the zombie can be created in the time zone between the moment an orchestration is scheduled to dispose and the moment the orchestration is disposed. I.e. the average dangerous time zone is about half of the MessageBox polling interval (by default it is 1 sec), that means 0.5 sec. It is not correct. The dangerous zone is between the last receive (for the message with the instance subscription) and end of orchestration, and this zone could be much bigger than a second.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;See more about zombies in BizTalk from the &lt;a href="http://blogs.msdn.com/b/biztalk_core_engine/archive/2004/06/30/169430.aspx"&gt;BizTalk Core Engine Blog&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt; &lt;img src="http://geekswithblogs.net/LeonidGaneline/aggbug/143826.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Leonid Ganeline</dc:creator>
            <guid>http://geekswithblogs.net/LeonidGaneline/archive/2011/02/05/biztalk-instance-subscription-details.aspx</guid>
            <pubDate>Sun, 06 Feb 2011 01:10:28 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LeonidGaneline/comments/143826.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LeonidGaneline/archive/2011/02/05/biztalk-instance-subscription-details.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/LeonidGaneline/comments/commentRss/143826.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LeonidGaneline/services/trackbacks/143826.aspx</trackback:ping>
        </item>
        <item>
            <title>BizTalk: History of one integration project</title>
            <link>http://geekswithblogs.net/LeonidGaneline/archive/2010/12/24/biztalk-history-of-one-project-architecture.aspx</link>
            <description>&lt;div style="margin: 0in 0in 10pt"&gt;[&lt;a href="http://ganeline.wordpress.com/2011/01/01/biztalk-history-of-the-sync-project/"&gt;Russian version of the article&lt;/a&gt;]&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt 40px"&gt;"In the beginning God made heaven and earth. Then he started to integrate." At the very start was the requirement: integrate two working systems. [fairy tale of the system integrators]&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Small digging up: It was one system. It was good but IT guys want to change it to the new one, much better, chipper, more flexible, and more progressive in technologies, more suitable for the future, for the faster world and hungry competitors.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;One thing. One small, little thing. We cannot turn off the old system (call it A, because it was the first), turn on the new one (call it B, because it is second but not the last one). The A has a hundreds users all across a country, they must study B. A still has a lot of nice custom features, home-made features that cannot disappear. These features have to be moved to the B and it is a long process, months and months of redevelopment.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;So, the decision was simple. Let’s move slowly not jump, let’s both systems working side-by-side several months. In this time we could teach the users and move all custom A’s special functionality to B.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;That automatically means &lt;span style="background: yellow"&gt;both systems should work side-by-side all these months and use the same data. Data in A and B must be in sync&lt;/span&gt;. That’s how the integration projects get birth.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Moreover, the specific of the user tasks requires the &lt;span style="background: yellow"&gt;both systems must be in sync in real-time&lt;/span&gt;. Nightly synchronization is not working, absolutely.  &lt;/div&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="4"&gt;&lt;font color="#4f81bd"&gt;&lt;font size="3"&gt;First draft&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2010/12/projecthistory-pict11.jpg" /&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;The first draft seems &lt;span style="line-height: 115%; font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-ansi-language: EN-US; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 'Times New Roman'; mso-hansi-theme-font: minor-latin; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;absolutely cool&lt;/span&gt;. Both systems keep data in SQL databases. When data changes, the Create, Update, Delete operations performed on the data, and the sync process could be started. The obvious decision is to use triggers on tables. When we are talking about data, we are talking about several entities. For example, Orders and Items [in Orders].&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;The decision was to use the BizTalk Server to synchronize systems. Why it was chosen is another story.&lt;/div&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="4"&gt;&lt;font color="#4f81bd"&gt;&lt;font size="3"&gt;Second draft &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2010/12/projecthistory-pict21.jpg" /&gt;&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Let’s take an example how it works in more details.&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;1.&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;User creates a new entity in the A system. This fires an insert trigger on the entity table. Trigger has to pass the message “Entity created”. This message includes all attributes of the new entity, but I focused on the Id of this entity in the A system. Notation for this message is &lt;strong&gt;id.A&lt;/strong&gt;. System A sends id.A to the BizTalk Server.&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;2.&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;BizTalk transforms id.A to the format of the system B. This is easiest part and I will not focus on this kind of transformations in the following text. The message on the picture is still id.A but it is in slightly different format, that’s why it is changing color. BizTalk sends id.A to the system B.&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;3.&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;The system B creates the entity on its side. But it uses different id-s for entities, these id-s are id.B. System B saves id.A+id.B. System B sends the message &lt;strong&gt;id.A+id.B&lt;/strong&gt; back to the BizTalk.&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;4.&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;BizTalk sends the message id.A+id.B to the system A.&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 10pt 0.5in"&gt;&lt;span&gt;5.&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;System A saves id.A+id.B.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Why both id-s should be saved on both systems? It was one of the next requirements. &lt;span style="background: yellow"&gt;Users of both systems have to know the systems are in sync or not in sync&lt;/span&gt;. Users working with the entity on the system A can see the id.B and use it to switch to the system B and work there with the copy of the same entity. The decision was to store the pairs of entity id-s on both sides. If there is only one id, the entities are not in sync yet (for the Create operation).&lt;/div&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="4"&gt;&lt;font color="#4f81bd"&gt;&lt;font size="3"&gt;Third draft&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Next problem was the reliability of the synchronization. The synchronizing process can be interrupted on each step, when message goes through the wires. It can be communication problem, timeout, temporary shutdown one of the systems, the second system cannot be synchronized by some internal reason. There were several potential problems that prevented from enclosing the whole synchronization process in one transaction.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Decision was to restart the whole sync process if it was not finished (in case of the error). For this purpose was created an additional service. Let’s call it the &lt;b&gt;Resync&lt;/b&gt; service.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2010/12/projecthistory-pict31.jpg" /&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;We still keep the id pairs in both systems, but only for the fast access not for the synchronization process. For the synchronizing these id-s now are kept in one main place, in the Resync service database.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;The Resync service keeps record as:&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;Id.A&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;Id.B&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;Entity.Type&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;Operation (Create, Update, Delete)&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;IsSyncStarted (true/false)&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 10pt 0.5in"&gt;&lt;span&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;IsSyncFinished (true/false0&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;The example now looks like:&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;1.&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;System A creates id.A. id.A is saved on the A. Id.A is sent to the BizTalk.&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;2.&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;BizTalk sends id.A to the Resync and to the B. id.A is saved on the Resync.&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;3.&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;System B creates id.B. id.A+id.B are saved on the B. id.A+id.B are sent to the BizTalk.&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;4.&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;BizTalk sends id.A+id.B to the Resync and to the A. id.A+id.B are saved on the Resync.&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 10pt 0.5in"&gt;&lt;span&gt;5.&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;id.A+id.B are saved on the B.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Resync changes the IsSyncStarted and IsSyncFinished flags accordingly.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;The Resync service implements three main methods:&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 0pt 38.25pt"&gt;&lt;span&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;Save (id.A, Entity.Type, Operation)&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 0pt 38.25pt"&gt;&lt;span&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;Save (id.A, id.B, Entity.Type, Operation)&lt;/div&gt;
&lt;div style="text-indent: -0.25in; margin: 0in 0in 10pt 38.25pt"&gt;&lt;span&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;Resync ()&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Two Save() are used to save id-s to the service storage. See in the above example, in 2 and 4 steps.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;What about the Resync()? It is the method that finishes the interrupted synchronization processes. If Save() is started by the trigger event, the Resync() is working as an independent process. It periodically scans the Resync storage to find out “unfinished” records. Then it restarts the synchronization processes. It tries to synchronize them several times then gives up.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2010/12/projecthistory-pict41.jpg" /&gt;&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;One more thing, both systems A and B must tolerate duplicates of one synchronizing process. Say on the step 3 the system B was not able to send id.A+id.B back. The Resync service must restart the synchronization process that will send the id.A to B second time. In this case system B must just send back again also created id.A+id.B pair without errors. That means “tolerate duplicates”.&lt;/div&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="4"&gt;&lt;font color="#4f81bd"&gt;&lt;font size="3"&gt;Fourth draft&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Next draft was created only because of the &lt;span style="line-height: 115%; color: black; font-size: 10pt"&gt;aesthetics&lt;/span&gt;. As it always happens, aesthetics gave significant performance gain to the whole system.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;First was the stupid question. Why do we need this additional service with special database? Can we just master the BizTalk to do something like this Resync() does?&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;So the &lt;b&gt;Resync orchestration&lt;/b&gt; is doing the same thing as the Resync service.&lt;br /&gt;
It is started by the Id.A and finished by the id.A+id.B message. The first works as a &lt;b&gt;Start&lt;/b&gt; message, the second works as a &lt;b&gt;Finish&lt;/b&gt; message.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2010/12/projecthistory-pict51.jpg" /&gt;&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Here is a diagram the whole process without errors. It is pretty straightforward.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;The Resync orchestration is waiting for the Finish message specific period of time then resubmits the Id.A message. It resubmits the Id.A message specific number of times then gives up and gets suspended. It can be resubmitted then it starts the whole process again: &lt;br /&gt;
waiting [, resubmitting [, get suspended]], finishing.&lt;/div&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="4"&gt;&lt;font color="#4f81bd"&gt;&lt;font size="3"&gt;Tuning up&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;The Resync orchestration resubmits the id.A message with special “Resubmitted” flag. The subscription filter on the Resync orchestration includes predicate as (Resubmit_Flag != “Resubmitted”). That means only the first Sync orchestration starts the Resync orchestration. Other Sync orchestrations instantiated by the resubmitting can finish this Resync orchestration but cannot start another instance of the Resync.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2010/12/projecthistory-pict61.jpg" /&gt;&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Here is a diagram where system B was inaccessible for some period of time. The Resync orchestration resubmitted the id.A two times. Then system B got the response the id.A+id.B and this finished the Resync service execution.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;What is interesting about this, there were submitted several identical id.A messages and only one id.A+id.B message. Because of this, the system B and the Resync must tolerate the duplicate messages. We also told about this requirement for the system B. Now the same requirement is for the Resunc.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;&lt;img alt="" src="http://ganeline.files.wordpress.com/2010/12/projecthistory-pict71.jpg" /&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Let’s assume the system B was very slow in the first response and the Resync service had time to resubmit two id.A messages. System B responded not, as it was in previous case, with one id.A+id.B but with two id.A+id.B messages.&lt;br /&gt;
First of them finished the Resync execution for the id.A. What about the second id.A+id.B? Where it goes? So, we have to add one more internal requirement. The whole solution must tolerate many identical id.A+id.B messages. It is easy task with the BizTalk. I added the “SinkExtraMessages” subscriber (orchestration with one receive shape), that just get these messages and do nothing.&lt;/div&gt;
&lt;div style="margin: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="5"&gt;&lt;font size="4"&gt;&lt;font color="#4f81bd"&gt;Real design&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Real architecture is much more complex and interesting.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;In reality each system can submit several id.A almost simultaneously and completely unordered.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;There are not only the “Create entity” operation but the Update and Delete operations. And these operations relate each other. Say the Update operation after Delete means not the same as Update after Create.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;In reality there are entities related each other. Say the Order and Order Items. Change on one of it could start the series of the operations on another. Moreover, the system internals are the “black boxes” and we cannot predict the exact content and order of the operation series.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;It worth to say, I had to spend a time to manage the zombie message problems. The zombies are still here, but this is not a problem now. And this is another story.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;What is interesting in the last design? One orchestration works to help another to be more reliable. Why two orchestration design is more reliable, isn’t it something strange? The Synch orchestration takes all the message exchange between systems, here is the area where most of the errors could happen. The Resync orchestration sends and receives messages only within the BizTalk server.&lt;/div&gt;
&lt;div style="margin: 0in 0in 10pt"&gt;Is there another design? Sure. All Resync functionality could be implemented inside the Sync orchestration. Hey guys, some other ideas?&lt;/div&gt;
&lt;p&gt; &lt;/p&gt; &lt;img src="http://geekswithblogs.net/LeonidGaneline/aggbug/143236.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Leonid Ganeline</dc:creator>
            <guid>http://geekswithblogs.net/LeonidGaneline/archive/2010/12/24/biztalk-history-of-one-project-architecture.aspx</guid>
            <pubDate>Fri, 24 Dec 2010 21:26:31 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LeonidGaneline/comments/143236.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LeonidGaneline/archive/2010/12/24/biztalk-history-of-one-project-architecture.aspx#feedback</comments>
            <slash:comments>6</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/LeonidGaneline/comments/commentRss/143236.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LeonidGaneline/services/trackbacks/143236.aspx</trackback:ping>
        </item>
        <item>
            <title>BizTalk: Compensation Model</title>
            <link>http://geekswithblogs.net/LeonidGaneline/archive/2010/02/25/biztalk-compensation-model.aspx</link>
            <description>&lt;div style="MARGIN: 24pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="6"&gt;&lt;font size="5"&gt;&lt;font color="#365f91"&gt;BizTalk: Compensation Model&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="MARGIN: 24pt 0in 0pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;
&lt;p style="MARGIN: 0in 0in 10pt" class="MsoNormal"&gt;&lt;span style="mso-ansi-language: EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Charles Young mentioned, the Compensation is one of the most under-used features of the BizTalk. &lt;br /&gt;[“&lt;/font&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;a title="Title of this entry." href="http://geekswithblogs.net/cyoung/articles/100424.aspx"&gt;&lt;span style="COLOR: windowtext; TEXT-DECORATION: none; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; text-underline: none"&gt;&lt;font face="Times New Roman"&gt;BizTalk Server 2006: The Compensation Model&lt;/font&gt;&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;font face="Calibri"&gt;” &lt;/font&gt;&lt;/font&gt;&lt;font size="3" face="Calibri"&gt;] &lt;br /&gt;If you didn’t read his article, I would strictly recommend it. Next article to read is &lt;br /&gt;[&lt;a href="http://blogs.msdn.com/richardbpi/archive/2006/12/06/transactions-and-compensation-using-biztalk-server.aspx"&gt;“&lt;/a&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;span style="mso-ansi-language: EN" lang="EN"&gt;&lt;a href="http://tempuri.org/tempuri.html"&gt;Transactions and Compensation Using BizTalk Server&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-ansi-language: EN-US"&gt;&lt;a href="http://tempuri.org/tempuri.html"&gt;”&lt;/a&gt;] &lt;br /&gt;by Richard Seroter.&lt;?xml:namespace prefix = o /?&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;There are still many questions in using Compensation in BizTalk.&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;·&lt;span style="FONT: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;What is the proper order of the Exception and Compensating blocks (handlers), Compensate shapes?&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;·&lt;span style="FONT: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;Do we have to rethrow the Exceptions?&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;·&lt;span style="FONT: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;Do we have to use Compensate shape for the current transaction or for the internal transactions?&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;·&lt;span style="FONT: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;What exactly does the Compensate shape?&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;·&lt;span style="FONT: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;What is the difference between Atomic and Long-Running transactions from the Compensation point of view?&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 0pt 0.5in"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Let’s start from the theory.&lt;/div&gt;
&lt;div style="MARGIN: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="5"&gt;&lt;font size="4"&gt;&lt;font color="#4f81bd"&gt;Compensation and Rollback&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;I have to use term the &lt;b&gt;Rollback&lt;/b&gt; in this document. It is not from the BizTalk Documentation.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Data_1 &lt;span&gt;--&amp;gt;&lt;/span&gt; [Transaction: Data_1to2] &lt;span&gt;--&amp;gt;&lt;/span&gt; Data_2&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;I use the Rollback term like the same term in the database transactions. There is a Rollback and rollback, the last is the undefined term and undefined process in BizTalk. The &lt;b&gt;Rollback&lt;/b&gt; means &lt;b&gt;restoring&lt;/b&gt; all data to the point before transaction. It is completely automatic, atomic process. We cannot control Rollback. Only one operation is possible, &lt;b&gt;Start Rollback&lt;/b&gt;. It rolls back only the &lt;b&gt;local orchestration data&lt;/b&gt;, orchestration variables and parameters.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;The local orchestration data outside the transaction could be only Data_1 or Data_2. When Transaction is Committed, the data is Data_2. When Transaction is Rollbacked, the data &lt;b&gt;automatically&lt;/b&gt; returns to the pre-transaction state, to the Data_1. We never get the Data_1to2 outside the Transaction. We all know this; it is ABC of the Transaction model.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;But BizTalk is not a data base server as SQL Server and transaction in BizTalk is not a data base transaction. For example the Send shape inside transaction scope can send message to the external system and change data in this system. In general case BizTalk cannot automatically roll back this operation and won’t do this. We have to manually create a code to roll back the external changes. Atomic transaction might change the external system in the same way as Long-Running transaction. BizTalk helps us with managing this roll back procedure. We include the custom roll back code in the Compensation block. This code is invoked automatically by BizTalk or manually by a Compensate shape and the whole process called the &lt;b&gt;Compensation&lt;/b&gt;.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Compensation it is not a Rollback. It is another process.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;b&gt;Compensation&lt;/b&gt; is a controlled process. Here is a typical example: code inside BizTalk transaction inserts rows in the database. BizTalk does not automatically rollback this operation. But it gives us possibility to implement [maybe] complex business process of deleting inserted rows. Plus, the last uncontrolled step of the Compensation is a Rollback. We implement some custom business process of compensation and then BizTalk invoke Rollback.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;All Rollbacks and Compensations are initiated by an Exception. If an Exception is fired inside transaction, BizTalk invokes Rollback, but Compensation for this transaction is usually prohibited.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;BizTalk invokes Rollback, but before that BizTalk invokes the Exception block of this transaction, if there is such block and if this block catches the Exception.&lt;/div&gt;
&lt;div style="MARGIN: 0in 42.75pt 10pt 70.9pt"&gt;&lt;b&gt;Note: Compensation block&lt;/b&gt; and &lt;b&gt;Compensation shape&lt;/b&gt; are different things. Compensation shape is a method to call the Compensation block.&lt;/div&gt;
&lt;div style="MARGIN: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="5"&gt;&lt;font size="4"&gt;&lt;font color="#4f81bd"&gt;Atomic and Long-Running transactions&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;By design Atomic transaction should be used for the fast and simple procedures. The data &lt;em&gt;before&lt;/em&gt; Atomic transaction is persisted on the disk, it is &lt;em&gt;not persisted inside&lt;/em&gt; transaction regardles of operations inside. Atomic transaction is quick that’s why it does not damage the total reliability. You can mention that Atomic transaction Timeout property by default set up to 60 sec, but not for the Long-Running transaction. Moreover only the Atomic transaction has the Property the Retry because it makes sense to automatically retry only the short process not the long one.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;The likelihood of the system crash is bigger in the durations of hours and days than in seconds. That’s why data &lt;i&gt;inside &lt;/i&gt;Long-Running transaction persisted to disk. That’s why the orchestration data used in the Long- Running transaction must be &lt;i&gt;serializable&lt;/i&gt;. That’s why the Long-Running transaction theoretically slower than Atomic transaction.&lt;/div&gt;
&lt;div style="MARGIN: 0in 42.75pt 10pt 70.9pt"&gt;&lt;b&gt;Note: &lt;/b&gt;Atomic transaction in BizTalk is not atomic in strict sense. It can include requests to the external processes, calls to the .NET classes, etc. Each of these processes could change something outside the orchestration and the transaction Rollback does not automatically roll back all these changes. It would be dangerous.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;The Atomic transaction is short by definition. It cannot nest other transactions inside. The Atomic transaction is processed as a single unit of work. If Exception is fired inside the Atomic transaction, all we have to do is to roll back this transaction. And BizTalk makes this automatically. We cannot change this roll back process no matter what sort of Exception was fired.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Seems this is the main difference between n the Atomic and Long-Running transactions in BizTalk, how they behave in case of the &lt;b&gt;internal&lt;/b&gt; Exception. Atomic transaction always automatically performs Rollback. We cannot avoid this Rollback and cannot do something else. Long-Running transaction could catch the Exception in the optional Exception block and process additional rollback operations in specific custom code. But the Exception block cannot prevent the automatic Rollback. The Rollback occurs &lt;i&gt;after&lt;/i&gt; executing the Exception block. If a Long-Running transaction does not have the Exception blocks it processes an Exception the same way as an Atomic transaction.&lt;/div&gt;
&lt;div style="MARGIN: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="5"&gt;&lt;font color="#4f81bd" size="4"&gt;Compensations and Exceptions&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 42.75pt 10pt 70.9pt"&gt;&lt;b&gt;Rule 1:&lt;/b&gt; Transaction block can get only one &lt;b&gt;custom&lt;/b&gt; Compensation block.&lt;/div&gt;
&lt;div style="MARGIN: 0in 42.75pt 10pt 70.9pt"&gt;&lt;b&gt;Rule 2:&lt;/b&gt; If the Compensation block is not defined, the Transaction uses the &lt;b&gt;default Compensation&lt;/b&gt;. Default Compensation is the Compensation for the current Transaction. That means the unwiring the Compensations for the nested Transactions and Rollback (restoring the Orchestration variables).&lt;/div&gt;
&lt;div style="MARGIN: 0in 42.75pt 10pt 70.9pt"&gt;&lt;b&gt;Rule 3:&lt;/b&gt; Firing an Exception is the only way to initialize the Compensation process.&lt;/div&gt;
&lt;div style="MARGIN: 0in 42.75pt 10pt 70.9pt"&gt;&lt;b&gt;Rule 4:&lt;/b&gt; Atomic transaction block cannot get the Exception block.&lt;/div&gt;
&lt;div style="MARGIN: 0in 42.75pt 10pt 70.9pt"&gt;&lt;b&gt;Rule 5:&lt;/b&gt; Long-Running transaction use the &lt;b&gt;default&lt;/b&gt; Exception block for the “General Exception” if the custom Exception block for the “General Exception” is not defined. Default Exception block invokes the Compensation shape for current transaction and rethrow the Exception.&lt;/div&gt;
&lt;div style="MARGIN: 0in 42.75pt 10pt 70.9pt"&gt;&lt;b&gt;Rule 6: Compensation shape &lt;/b&gt;can be inserted only inside &lt;b&gt;Exception block&lt;/b&gt; or &lt;b&gt;Compensation blocks&lt;/b&gt;.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;It seems obvious but anyway…&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;We can include the Compensate shape nowhere but only in the Exception and Compensation blocks. We cannot start the compensation process arbitrary. No exception – no compensation! Sometimes we need to utilize the automatic compensation ability of the BizTalk in the ordinary business process. Firing Exception is not the ordinary situation; an exception should be always indicator of the error in process. But here we have to use exception, there are no other ways.&lt;/div&gt;
&lt;div style="MARGIN: 0in 42.75pt 10pt 70.9pt"&gt;&lt;b&gt;Rule 7: &lt;/b&gt;Transaction that fired the Exception processes a Rollback right after this Exception. We cannot compensate this transaction.*&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;*) As Charles Young mentioned here is a workaround for this rule (see the “Using Compensation Blocks on L-R Transactions” topic in his article), but you have to use undocumented features of the BizTalk. BizTalk is wisely trying to prevent compensating uncommitted transaction.&lt;/div&gt;
&lt;div style="MARGIN: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="5"&gt;&lt;font color="#4f81bd" size="4"&gt;Standard compensation process (Example)&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Let’s cover the standard compensation process.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Below is the simple orchestration with one LR nesting transaction (1---) and two nested transactions (11… and 12…).&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Second nested transaction fired the Exception.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;img alt="" src="http://images42.fotki.com/v1320/file3In9/8ec0e/1/31551/8498337/StandardCompensation_WithMa.gif" /&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Let see what is going on here:&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;1.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;Code generates the &lt;i&gt;DivideByZeroException&lt;/i&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;2.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;The Exception is caught in the Exception block of the same Transaction.&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;3.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;The Exception is rethrown.&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;4.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;BizTalk rolls back the Transaction, that means it restore the orchestration variables and parameters.&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;5.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;The Exception is caught in the Exception block of the nesting, outer Transaction.&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;6.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;Calls to the Compensating of the nested Transactions in the revers order. Compensation of the 12… cannot be executed because this transaction was not Committed (completed).&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;7.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;Compensating of the 11… Transaction.&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in"&gt;&lt;span&gt;8.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;Exception is rethrown. Orchestration is suspended.&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Why the Compensation blocks the Comp12 and Comp 1 were not executed? For different reasons.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Comp12 was not executed because Transaction the 12… was not committed but rollbacked and a try to call the Compensation in the C_Ex 1 block was skiped.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Comp1 was not executed because it could be called only from the outer, nesting transaction. We don’t have such transaction here.&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 1pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; LINE-HEIGHT: normal; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt; &lt;/div&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;The trace log was:&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 1pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; LINE-HEIGHT: normal; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;1 --- &lt;/span&gt;&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; LINE-HEIGHT: normal; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;1 --- 11... &lt;/span&gt;&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; LINE-HEIGHT: normal; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;1 --- 11... 12... &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt;(1)&lt;/span&gt;&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; LINE-HEIGHT: normal; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;1 --- 11... 12...   &amp;gt;&amp;gt;&amp;gt; Exc 12 &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt;(2)&lt;/span&gt;&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; LINE-HEIGHT: normal; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;1 --- 11... 12...   &amp;lt;&amp;lt;&amp;lt; Exc 12 Rethrow Exception ******** &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt;(3) (4)&lt;/span&gt;&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; LINE-HEIGHT: normal; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;1 --- 11...   &amp;gt;&amp;gt;&amp;gt; C_Ex 1 &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt;(5)&lt;/span&gt;&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; LINE-HEIGHT: normal; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;1 --- 11...   &amp;gt;&amp;gt;&amp;gt; Comp 11 &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt;(6) &lt;/span&gt;&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; LINE-HEIGHT: normal; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;1 --- 11...   &amp;lt;&amp;lt;&amp;lt; Comp 11 &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt;(7)&lt;/span&gt;&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; LINE-HEIGHT: normal; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;1 --- 11...   &amp;lt;&amp;lt;&amp;lt; C_Ex 1 Rethrow Exception ******** &lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt;(8)&lt;/span&gt;&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; LINE-HEIGHT: normal; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt; &lt;/div&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt; &lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;Below is the XLANGs code generated by BizTalk Orchestration Editor:&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt; &lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;module GLD.Samples.Compensation&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;    internal service longrunning transaction StandardCompensation&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;    {&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;        port implements PortType_1 Control_R;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;        message System.Xml.XmlDocument msg_XmlDocument;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;        System.Int32 var_int;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;        System.String var_State;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;        body ()&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;        {&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;            activate receive (Control_R.Operation_1, msg_XmlDocument);&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;            var_int = 0;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;            var_State = "";&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;            scope longrunning transaction tx_1&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;            {&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                System.Int32 var_IntLevel1;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                body&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                {&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                    var_IntLevel1 = 0;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                    var_State = "1 --- ";&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                    &lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                    System.Diagnostics.Trace.WriteLine(var_State);&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                    scope longrunning transaction tx_11&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                    {&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        body&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        {&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                            var_State = var_State +&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt; &lt;span style="COLOR: #0070c0"&gt;"11... ";&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                            &lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                            System.Diagnostics.Trace.WriteLine(var_State);&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        }&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        &lt;/span&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;compensation ()&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        {&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                            &lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                            System.Diagnostics.Trace.WriteLine(var_State + " &amp;gt;&amp;gt;&amp;gt; Comp 11");&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                            &lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                            System.Diagnostics.Trace.WriteLine(var_State + " &amp;lt;&amp;lt;&amp;lt; Comp 11");&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        }&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                    }&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                    scope longrunning transaction tx_12&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                    {&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        body&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        {&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                            var_State = var_State +&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt; &lt;span style="COLOR: #0070c0"&gt;"12... ";&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                            System.Diagnostics.Trace.WriteLine(var_State);&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                              // Exception!!!&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                            &lt;/span&gt;&lt;span style="COLOR: #c00000; FONT-SIZE: 10pt"&gt;var_int = var_int / System.Convert.ToInt32("0");&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        }&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        exceptions&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        {&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                            catch&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                            {&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                                System.Diagnostics.Trace.WriteLine(var_State + " &amp;gt;&amp;gt;&amp;gt; C_Ex 12");&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                                System.Diagnostics.Trace.WriteLine(var_State + " &amp;lt;&amp;lt;&amp;lt; C_Ex 12 Rethrow Exception ********");&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                                &lt;/span&gt;&lt;span style="COLOR: red; FONT-SIZE: 10pt"&gt;throw;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                            }&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        }&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        &lt;/span&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;compensation ()&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        {&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                            System.Diagnostics.Trace.WriteLine(var_State + " &amp;gt;&amp;gt;&amp;gt; Comp 12");&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                            System.Diagnostics.Trace.WriteLine(var_State + " &amp;lt;&amp;lt;&amp;lt; Comp 12");&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        }&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                    }&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                }&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                exceptions&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                {&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                    catch&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                    {&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        System.Diagnostics.Trace.WriteLine(var_State + " &amp;gt;&amp;gt;&amp;gt; C_Ex 1");&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        &lt;/span&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;if (succeeded(tx_12))&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;                        {&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;                            compensate tx_12 ();&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;                        }&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;                        if (succeeded(tx_11))&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;                        {&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;                            compensate tx_11 ();&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;                        }&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        System.Diagnostics.Trace.WriteLine(var_State + " C_Ex 1 Rethrow Exception ******** ");&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                        &lt;/span&gt;&lt;span style="COLOR: red; FONT-SIZE: 10pt"&gt;throw;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                    }&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                }&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;                compensation ()&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                {&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                    System.Diagnostics.Trace.WriteLine(var_State + " &amp;gt;&amp;gt;&amp;gt; Comp 1");&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                    &lt;/span&gt;&lt;span style="COLOR: #00b050; FONT-SIZE: 10pt"&gt;compensate tx_1 ();&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                    System.Diagnostics.Trace.WriteLine(var_State + " &amp;lt;&amp;lt;&amp;lt; Comp 1");&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;                }&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;            }&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;        }&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT: normal"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;    }&lt;/span&gt;&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 1pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; LINE-HEIGHT: normal; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;&lt;span style="COLOR: #0070c0; FONT-SIZE: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt; &lt;/div&gt;
&lt;div style="MARGIN: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="5"&gt;&lt;font size="4"&gt;&lt;font color="#4f81bd"&gt;The uncear points in the Compensation Model&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;To me there are several confusing things in the Compensation model.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;First, the &lt;b&gt;Compensation blocks are called outside&lt;/b&gt;. Event to call the Compensation comes outside! It is pretty unusual from the developer experience. One more time: the Compensation block is called outside. We are waiting that methods start from the first operator, and the exceptions catch blocks are placed in the end of code. The Exception blocks in the Orchestration are placed as we are waiting for, in the end of the code. Compensation blocks placed in the same place but worked in opposite manner. It is unintuitive. Now the similar graphic presentation of the Exception and Compensation blocks mixed with different behaviour of the Exception and Compensation blocks. It is misleading.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Second, Rollbacks and Compensation are kind of unsynchronized. I will tell about this in the next sample.&lt;/div&gt;
&lt;div style="MARGIN: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="5"&gt;&lt;font color="#4f81bd" size="4"&gt;Compensation Model process (Example)&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Let’s cover the more complex compensation process.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;This is the transaction tree:&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;img alt="" src="http://images51.fotki.com/v174/photos/1/31551/8498337/TransactionTree_WithMarks-vi.gif" /&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Below is the orchestration picture. Nesting transaction was implemented in nested loops.&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 1pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; LINE-HEIGHT: normal; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt; &lt;img alt="" src="http://images41.fotki.com/v9/fileDy6V/8ec0e/1/31551/8498337/CompensationModel.gif" /&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Exception was fired in the 1222 transaction.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;The trace log was:&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;------------------------------- 5 ---------------------------- &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211... &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211... 1212... &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211... 1212... 1220--- &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211... 1212... 1220--- 1221... &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211... 1212... 1220--- 1221... 1222... &lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211... 1212... 1220--- 1221... 1222... &lt;/span&gt;&lt;span style="COLOR: red"&gt;******* Throw exception&lt;/span&gt;(1)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211... 1212... 1220--- 1221...   &lt;/span&gt;&lt;span style="COLOR: red"&gt;&amp;gt;&amp;gt;&amp;gt; C_Ex 3&lt;/span&gt;(2)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211... 1212... 1220--- 1221...   &amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;Comp 4&lt;/span&gt;(3)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211... 1212... 1220--- 1221...   &amp;lt;&amp;lt;&amp;lt; &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;Comp 4&lt;/span&gt;(4)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211... 1212... 1220--- 1221...   &lt;/span&gt;&lt;span style="COLOR: red"&gt;&amp;lt;&amp;lt;&amp;lt; C_Ex 3 ******* ReThrow exception&lt;/span&gt;(5)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211... 1212...   &lt;/span&gt;&lt;span style="COLOR: red"&gt;&amp;gt;&amp;gt;&amp;gt; C_Ex 2&lt;/span&gt;(6)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211... 1212...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;gt;&amp;gt;&amp;gt; Comp 3&lt;/span&gt;(7)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211... 1212...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;Comp 4&lt;/span&gt;(8)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211... 1212...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;lt;&amp;lt;&amp;lt; Comp 4&lt;/span&gt;(9)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211&lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;... &amp;gt;&amp;gt;&amp;gt; Comp 4&lt;/span&gt;(10)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211... &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;lt;&amp;lt;&amp;lt; Comp 4 &lt;/span&gt;(11)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211... 1212...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;lt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;Comp 3&lt;/span&gt;(12)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122... 1200=== 1210--- 1211... 1212...   &lt;/span&gt;&lt;span style="COLOR: red"&gt;&amp;lt;&amp;lt;&amp;lt; C_Ex 2 ******* ReThrow exception&lt;/span&gt;(13)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122...   &lt;/span&gt;&lt;span style="COLOR: red"&gt;&amp;gt;&amp;gt;&amp;gt; C_Ex 1&lt;/span&gt;(14)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;gt;&amp;gt;&amp;gt; Comp 2&lt;/span&gt;(15)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;gt;&amp;gt;&amp;gt; Comp 3&lt;/span&gt;(16)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;gt;&amp;gt;&amp;gt; Comp 4&lt;/span&gt;(17)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;lt;&amp;lt;&amp;lt; Comp 4&lt;/span&gt;(18)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;gt;&amp;gt;&amp;gt; Comp 4&lt;/span&gt;(19)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;lt;&amp;lt;&amp;lt; Comp 4&lt;/span&gt;(20)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;lt;&amp;lt;&amp;lt; Comp 3&lt;/span&gt;(21)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;gt;&amp;gt;&amp;gt; Comp 3&lt;/span&gt;(22)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;gt;&amp;gt;&amp;gt; Comp 4&lt;/span&gt;(23)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;lt;&amp;lt;&amp;lt; Comp 4&lt;/span&gt;(24)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;gt;&amp;gt;&amp;gt; Comp 4&lt;/span&gt;(25)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;lt;&amp;lt;&amp;lt; Comp 4&lt;/span&gt;(26)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;lt;&amp;lt;&amp;lt; Comp 3&lt;/span&gt;(27)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122...   &lt;/span&gt;&lt;span style="COLOR: #1f497d"&gt;&amp;lt;&amp;lt;&amp;lt; Comp 2&lt;/span&gt;(28)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122...   &lt;/span&gt;&lt;span style="COLOR: red"&gt;&amp;lt;&amp;lt;&amp;lt; C_Ex 1&lt;/span&gt;(29)&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;&lt;span style="COLOR: #00b050"&gt;....................................................................... &lt;/span&gt;&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 1pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 10pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122...&lt;/span&gt; &lt;/div&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 10pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt; &lt;/div&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Picture of whole compensation process:&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt; &lt;img alt="" src="http://images30.fotki.com/v38/photos/1/31551/8498337/TransactionTree-vi.gif" /&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;As an initial exception (1) is fired, there are several stages in the compensation process. A catch block follows after each exception, then compensations (blue arrow) and rollbacks (green arrow) for nested transaction(s). Each compensation is followed by a rollback with nested compensations and rollbacks in between.&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;For example, an Exception (5) in the Catch Exception block the “C_Ex 3” of the transaction 1220 is caught into the Catch Exception block (6) of the Transaction 1200, then follows the Compensation “Comp3” for the Transaction 1210 (7), the Compensation (8) and the Rollback (9) for the Transaction 1212, the Compensation (10) and the Rollback (11) for the Transaction 1211, the Rollback (12) for the Transaction 1210.&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 1pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 10pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;You can mention one interesting detail in the whole compensation process: All compensation blocks were called and all compensation code inside was invoked. But &lt;b&gt;the orchestration data was not returned to the initial state&lt;/b&gt;. The orchestration data was roll backed only for the transaction branch where exceptions were fired, for the transaction 1200 and nested transactions. We could predict the roll backed data would be the “” but it is “&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122...”&lt;/span&gt;&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 10pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;Is it a &lt;b&gt;bug in BizTalk&lt;/b&gt;?&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 10pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;Seems the compensation process is tuned up only for the “default” compensation model for some reason. In this model each implicit Exception block is finished by a Throw Exception operator. As you can remember the Default Exception block invokes the Compensation shape with current transaction and rethrow an initial Exception. If we follow this model we have got a predictable rollback process.&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 10pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;In the preceding example we have to nest the Transaction 1000 in outer Transaction and add a Throw Exception operator in “C-Ex 1” Exception block. In this case the data would be roll backed to the “” value in this outer transaction.&lt;/div&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 42.75pt 10pt 70.9pt"&gt;&lt;b&gt;Rule 7&lt;/b&gt;: The orchestration data is roll backed to the initial point of the transaction where the last exception is rethrown.&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 1pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 10pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;For example, the last exception was rethrown in the Transaction 1200. The initial data for this Transaction was “&lt;span style="COLOR: #00b050"&gt;1000*** 1100=== 1110--- 1111... 1112... 1120--- 1121... 1122...”. The orchestration data was roll backed to this value, not to the initial data for the outer compensated Transaction 1000.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div style="MARGIN: 10pt 0in 0pt"&gt;&lt;b&gt;&lt;font size="5"&gt;&lt;font size="4"&gt;&lt;font color="#4f81bd"&gt;Conclusion&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0in 0in 10pt"&gt;Let’s summarize how to create the standard compensation process.&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;1.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;Define the Compensation blocks for all transaction you want to be compensated. This is the most chalenging task.&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;2.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;Define the Exception blocks where the Exception(s) should be cought.&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in"&gt;&lt;span&gt;3.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;Add the Compensate shape(s) to this Exception block. Define what transaction you want to compensate. The standard way is to define a current transaction. All nested transactions would be compensated automaticaly in the right order.&lt;/div&gt;
&lt;div style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in"&gt;&lt;span&gt;4.&lt;span style="FONT: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;If you need a predictable rollback process for the orchestration data, rethrow an Exception in each Exception block where you added the Compensate shape.&lt;/div&gt;
&lt;div style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 1pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt;
&lt;div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 10pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in"&gt; &lt;/div&gt;&lt;/div&gt; &lt;img src="http://geekswithblogs.net/LeonidGaneline/aggbug/138193.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Leonid Ganeline</dc:creator>
            <guid>http://geekswithblogs.net/LeonidGaneline/archive/2010/02/25/biztalk-compensation-model.aspx</guid>
            <pubDate>Fri, 26 Feb 2010 06:34:58 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LeonidGaneline/comments/138193.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LeonidGaneline/archive/2010/02/25/biztalk-compensation-model.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/LeonidGaneline/comments/commentRss/138193.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LeonidGaneline/services/trackbacks/138193.aspx</trackback:ping>
        </item>
        <item>
            <title>BizTalk: xpath: How to work with empty and Null elements in Orchestration</title>
            <link>http://geekswithblogs.net/LeonidGaneline/archive/2009/11/17/biztalk-xpath-how-to-work-with-empty-and-null-elements.aspx</link>
            <description>&lt;div&gt;The problem is with three Empty-Null cases.&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;Is it possible to separate all these cases in Expression shapes of the Orchestration?&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;For example, we have the record with &amp;lt;name&amp;gt; element, in such flawors:&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;p&gt; &lt;font color="#3333ff"&gt;case: "NonEmpty"&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ns0:People&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
    &amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ns0:Name&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;Name_0&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ns0:Name&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
    &amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ns0:IsDependent&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;IsDependent_0&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ns0:IsDependent&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;..&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#3333ff"&gt;case: "Empty"&lt;/font&gt;&lt;/p&gt;
&lt;p&gt; &lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &amp;lt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ns0:People&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
    &amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ns0:Name&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ns0:Name&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
    &amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ns0:IsDependent&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#000000" size="2"&gt;IsDependent_0&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ns0:IsDependent&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;..&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt; &lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;case: "OneTag"&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ns0:People&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
    &amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ns0:Name/&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;br /&gt;
    &amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ns0:IsDependent&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#000000" size="2"&gt;IsDependent_0&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ns0:IsDependent&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;..&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt; &lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;case: "Null"&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ns0:People&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
   &lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;!-- NO NODE: &lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&amp;lt;ns0:Name&amp;gt;Name_0&amp;lt;/ns0:Name&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;--&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;    &amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ns0:IsDependent&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#000000" size="2"&gt;IsDependent_0&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;ns0:IsDependent&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;..&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;strong&gt;Is it possible to separate all these cases in Expression shapes of the Orchestration?&lt;br /&gt;
&lt;/strong&gt;&lt;/div&gt;
&lt;p&gt;There is no information into the MSDN about this [&lt;em&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa561906(BTS.10).aspx"&gt;http://msdn.microsoft.com/en-us/library/aa561906(BTS.10).aspx&lt;/a&gt;&lt;/em&gt;]&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;I tried to use the xpath() function in two variants, one with "string(xpath_expression)" second with "xpath_expression"&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div&gt;&lt;font color="#000000"&gt;Expression Shape:&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color: #808080"&gt;System.Diagnostics.Trace.WriteLine("== with string() ====================================================================");&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color: #808080"&gt;var_xpathString = "&lt;font color="#cc0000"&gt;string(&lt;/font&gt;/*[local-name()='Root' and namespace-uri()='http://MapTest.IncPerson']/*[local-name()='People' and namespace-uri()='http://MapTest.IncPerson']/*[local-name()='Name' and namespace-uri()='http://MapTest.IncPerson']&lt;font color="#cc0000"&gt;)&lt;/font&gt;";&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;span style="color: #808080"&gt;System.Diagnostics.Trace.WriteLine("[" + System.Convert.ToString(xpath (msg_SourceRoot, &lt;span style="color: #808080"&gt;var_xpathString&lt;/span&gt;)) + "]");&lt;br /&gt;
&lt;br /&gt;
if ( xpath (msg_SourceRoot, &lt;span style="color: #808080"&gt;var_xpathString&lt;/span&gt;) == null) &lt;br /&gt;
    { System.Diagnostics.Trace.WriteLine("Name == null"); }&lt;/span&gt;&lt;span style="color: #808080"&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color: #808080"&gt;else if ( xpath (msg_SourceRoot, &lt;span style="color: #808080"&gt;var_xpathString&lt;/span&gt;) == "") &lt;br /&gt;
    { System.Diagnostics.Trace.WriteLine("Name == Empty");}&lt;br /&gt;
&lt;/span&gt;
&lt;div&gt;&lt;span style="color: #808080"&gt;else&lt;br /&gt;
    { System.Diagnostics.Trace.WriteLine("Name != null &amp;amp;&amp;amp; Name != Empty"); }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color: #808080"&gt;&lt;br /&gt;
System.Diagnostics.Trace.WriteLine("-- no string() --------------------------------------------------------------------");&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: #808080"&gt;&lt;span style="color: #808080"&gt;var_xpathString = "/*[local-name()='Root' and namespace-uri()='http://MapTest.IncPerson']/*[local-name()='People' and namespace-uri()='http://MapTest.IncPerson']/*[local-name()='Name' and namespace-uri()='http://MapTest.IncPerson']";&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
System.Diagnostics.Trace.WriteLine("[" + System.Convert.ToString(xpath (msg_SourceRoot, &lt;span style="color: #808080"&gt;&lt;span style="color: #808080"&gt;var_xpathString&lt;/span&gt;&lt;/span&gt;)) + "]");&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color: #808080"&gt;&lt;br /&gt;
if ( xpath (msg_SourceRoot, &lt;span style="color: #808080"&gt;&lt;span style="color: #808080"&gt;var_xpathString&lt;/span&gt;&lt;/span&gt;) == null) &lt;br /&gt;
    { System.Diagnostics.Trace.WriteLine("Name == null"); }&lt;br /&gt;
&lt;/span&gt;
&lt;div&gt;&lt;span style="color: #808080"&gt;else if ( xpath (msg_SourceRoot, &lt;span style="color: #808080"&gt;&lt;span style="color: #808080"&gt;var_xpathString&lt;/span&gt;&lt;/span&gt;) == "") &lt;br /&gt;
    { System.Diagnostics.Trace.WriteLine("Name == Empty"); }&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color: #808080"&gt;else&lt;br /&gt;
    { System.Diagnostics.Trace.WriteLine("Name != null &amp;amp;&amp;amp; Name != Empty");}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;font color="#000000"&gt;&lt;span id="1258502831973E" style="display: none"&gt; &lt;/span&gt;]&lt;/font&gt;&lt;/div&gt;
&lt;p&gt;I.e. the "string(xpath_expression)" expression is used in the firs section, the"xpath_expression" is used  in the second.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Result is:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#cc9933"&gt;"NonEmpty" ==&lt;font color="#808080"&gt; with string() &lt;/font&gt;==================================================================== &lt;br /&gt;
[Name_0] &lt;br /&gt;
Name != null &amp;amp;&amp;amp; Name != Empty &lt;br /&gt;
--&lt;font color="#808080"&gt; no string() &lt;/font&gt;-------------------------------------------------------------------- &lt;br /&gt;
[Microsoft.XLANGs.Core.Part+ArrayBasedXmlNodeList] &lt;br /&gt;
Name != null &amp;amp;&amp;amp; Name != Empty &lt;br /&gt;
&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#cc9933"&gt;"Empty"==&lt;font color="#808080"&gt; with string() &lt;/font&gt;==================================================================== &lt;br /&gt;
[] &lt;br /&gt;
Name == Empty &lt;br /&gt;
--&lt;font color="#808080"&gt; no string() &lt;/font&gt;-------------------------------------------------------------------- &lt;br /&gt;
[Microsoft.XLANGs.Core.Part+ArrayBasedXmlNodeList] &lt;br /&gt;
Name != null &amp;amp;&amp;amp; Name != Empty &lt;br /&gt;
&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#cc9933"&gt;"OneTag"==&lt;font color="#808080"&gt; with string() &lt;/font&gt;==================================================================== &lt;br /&gt;
[] &lt;br /&gt;
Name == Empty &lt;br /&gt;
--&lt;font color="#808080"&gt; no string() &lt;/font&gt;-------------------------------------------------------------------- &lt;br /&gt;
[Microsoft.XLANGs.Core.Part+ArrayBasedXmlNodeList] &lt;br /&gt;
Name != null &amp;amp;&amp;amp; Name != Empty &lt;br /&gt;
&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#cc9933"&gt;"Null"==&lt;font color="#808080"&gt; with string() &lt;/font&gt;==================================================================== &lt;br /&gt;
[] &lt;br /&gt;
Name == Empty &lt;br /&gt;
--&lt;font color="#808080"&gt; no string() &lt;/font&gt;-------------------------------------------------------------------- &lt;br /&gt;
[] &lt;br /&gt;
Name == null &lt;/font&gt;&lt;/p&gt;
&lt;div&gt;&lt;strong&gt;&lt;font size="2" face="Arial"&gt;&lt;font size="2" face="Arial"&gt;Conclusion:&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;font size="2" face="Arial"&gt;&lt;font size="2" face="Arial"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2" face="Arial"&gt;&lt;font size="2" face="Arial"&gt;* I cannot separate the cases "Empty" and "OneTag"&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;* I can separate the cases "Empty and "Null" with "xpath_expression", not with "string(xpath_expression)" expression&lt;br /&gt;
* "Null" case does not throw an exception.&lt;br /&gt;
* xpath expression inside string() works fine to get all three cases ("Empty", "OneTag", "Null") under one "if" statement. And here it returns only "" (Empty string).&lt;/div&gt; &lt;img src="http://geekswithblogs.net/LeonidGaneline/aggbug/136371.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Leonid Ganeline</dc:creator>
            <guid>http://geekswithblogs.net/LeonidGaneline/archive/2009/11/17/biztalk-xpath-how-to-work-with-empty-and-null-elements.aspx</guid>
            <pubDate>Tue, 17 Nov 2009 23:55:12 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LeonidGaneline/comments/136371.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LeonidGaneline/archive/2009/11/17/biztalk-xpath-how-to-work-with-empty-and-null-elements.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LeonidGaneline/comments/commentRss/136371.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LeonidGaneline/services/trackbacks/136371.aspx</trackback:ping>
        </item>
    </channel>
</rss>
