﻿<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>SQL Server: Service Broker Team Blog</title>
    <atom:link
      href="https://review.docs.microsoft.com/archive/blogs/sql_service_broker/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://review.docs.microsoft.com/archive/blogs/sql_service_broker/feed.xml</link>
    <description>This blog is about the Service Broker feature for the Microsoft SQL Server</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:27:33 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>External Activator Security</title>
      <link>https://review.docs.microsoft.com/archive/blogs/sql_service_broker/external-activator-security</link>
      <pubDate>Mon, 19 Jul 2010 00:54:53 GMT</pubDate>
      <dc:creator><![CDATA[luis vargas [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sql_service_broker/2010/07/19/external-activator-security/</guid>
      <description><![CDATA[This short post deals with security and permission-related aspects of External...]]></description>
      <content:encoded><![CDATA[<p>This short post deals with security and permission-related aspects of External Activator.</p>
<p>
<meta content="Word.Document" name="ProgId" />
<meta content="Microsoft Word 12" name="Generator" />
<meta content="Microsoft Word 12" name="Originator" />
<link href="file:///C:%5CUsers%5Cpamarcin%5CAppData%5CLocal%5CTemp%5C1%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml" rel="File-List" />
<link href="file:///C:%5CUsers%5Cpamarcin%5CAppData%5CLocal%5CTemp%5C1%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx" rel="themeData" />
<link href="file:///C:%5CUsers%5Cpamarcin%5CAppData%5CLocal%5CTemp%5C1%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml" rel="colorSchemeMapping" />

</p>
<h3>Selecting External Activator service account</h3>
<p>When you install External Activator, you are asked to choose the service account (the Windows account that External Activator service will run as). The choice is from well-known Windows service accounts and a custom user with a password. For more information on the well-known accounts, please refer <a target="_blank" href="https://msdn.microsoft.com/en-us/library/ms143170.aspx">Sql Server Books Online</a> or <a target="_blank" href="https://msdn.microsoft.com/en-us/library/ms686005.aspx">MSDN</a> pages. The recommended service account for External Activator is a local or domain user.</p>
<p>
<meta content="Word.Document" name="ProgId" />
<meta content="Microsoft Word 12" name="Generator" />
<meta content="Microsoft Word 12" name="Originator" />
<link href="file:///C:%5CUsers%5Cpamarcin%5CAppData%5CLocal%5CTemp%5C1%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml" rel="File-List" />
<link href="file:///C:%5CUsers%5Cpamarcin%5CAppData%5CLocal%5CTemp%5C1%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx" rel="themeData" />
<link href="file:///C:%5CUsers%5Cpamarcin%5CAppData%5CLocal%5CTemp%5C1%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml" rel="colorSchemeMapping" />

</p>
<h3>Local security groups created by External Activator</h3>
<p>The External Activator setup application will also create one or two (depending on the Operating System) local security groups for administrative purposes.</p>
<p>The first group, <i><span style="color: #0000ff;">SSB EA Admin</span></i>, is created regardless of the OS used. Members of this group have permission to start/stop the service, view the trace (log) file and modify the configuration file. The purpose of this group is to provide sufficient privilege separation so that the user(s) configuring and running External Activator doesn&rsquo;t have to be a box admin.</p>
<p>The second group, <i><span style="color: #0000ff;">SSB EA Service</span></i>, is only created on down-level OSes and its purpose is to make changing External Activator&rsquo;s service account easier (more on that below).</p>
<p>
<meta content="Word.Document" name="ProgId" />
<meta content="Microsoft Word 12" name="Generator" />
<meta content="Microsoft Word 12" name="Originator" />
<link href="file:///C:%5CUsers%5Cpamarcin%5CAppData%5CLocal%5CTemp%5C1%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml" rel="File-List" />
<link href="file:///C:%5CUsers%5Cpamarcin%5CAppData%5CLocal%5CTemp%5C1%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx" rel="themeData" />
<link href="file:///C:%5CUsers%5Cpamarcin%5CAppData%5CLocal%5CTemp%5C1%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml" rel="colorSchemeMapping" />

</p>
<h3>Changing External Activator&rsquo;s service account</h3>
<p>On newer OSes (starting from Vista/Server 2008) changing External Activator&rsquo;s service account is as simple as setting the new account in Services MMC snap-in (Win-R &ndash;&gt; services.msc). The reason it works is that ACLs on External Activator&rsquo;s files are created based on Service SID, which is independent of service&rsquo;s &ldquo;real&rdquo; service account (more about Per Service SID can be found <a target="_blank" href="https://blogs.technet.com/askperf/archive/2008/02/03/ws2008-windows-service-hardening.aspx">here</a>). On down-level OSes using the Services MMC snap-in is not enough, because changing the External Activator&rsquo;s service account there won&rsquo;t automatically change the file ACLs to the new account. This is something you need to do yourself, but in order to make it easier, the <i><span style="color: #0000ff;">SSB EA Service</span></i> local group has been introduced. The files are ACLed to be accessible by members of <i><span style="color: #0000ff;">SSB EA Service</span></i> group rather than by the External Activator&rsquo;s service account directly. Therefore, when changing service account, it&rsquo;s enough to add the new account to that group (and possibly remove the old one), without the need to actually touch any file ACLs. You can do that from a command line window: 
<meta content="Word.Document" name="ProgId" />
<meta content="Microsoft Word 12" name="Generator" />
<meta content="Microsoft Word 12" name="Originator" />
<link href="file:///C:%5CUsers%5Cpamarcin%5CAppData%5CLocal%5CTemp%5C1%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml" rel="File-List" />
<link href="file:///C:%5CUsers%5Cpamarcin%5CAppData%5CLocal%5CTemp%5C1%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx" rel="themeData" />
<link href="file:///C:%5CUsers%5Cpamarcin%5CAppData%5CLocal%5CTemp%5C1%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml" rel="colorSchemeMapping" />

</p>
<p class="MsoNormal"><span style="font-family: 'Courier New';">net localgroup &ldquo;SSB EA Service&rdquo; /add &ldquo;&lt;new account name&gt;&rdquo;<br />net localgroup &ldquo;SSB EA Service&rdquo; /delete &ldquo;&lt;old account name&gt;&rdquo;<o:p></o:p></span></p>
<p>
<meta content="Word.Document" name="ProgId" />
<meta content="Microsoft Word 12" name="Generator" />
<meta content="Microsoft Word 12" name="Originator" />
<link href="file:///C:%5CUsers%5Cpamarcin%5CAppData%5CLocal%5CTemp%5C1%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml" rel="File-List" />
<link href="file:///C:%5CUsers%5Cpamarcin%5CAppData%5CLocal%5CTemp%5C1%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx" rel="themeData" />
<link href="file:///C:%5CUsers%5Cpamarcin%5CAppData%5CLocal%5CTemp%5C1%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml" rel="colorSchemeMapping" />

</p>
<h3>Local security groups created by External Activator</h3>
<p>One of the <a target="_blank" href="https://blogs.msdn.com/sql_service_broker/archive/2009/05/18/get-started-with-using-external-activator.aspx">previous posts</a> provided a detailed description of all the Sql Server permissions that External Activator needs in order to work properly. It all starts with creating a Sql Server login for External Activator to use. There are several options how this login may be created, depending on the topology of the services:</p>
<ol>
<li>External Activator runs on a machine in different domain from the machine hosting Sql Server. Even though External Activator doesn&rsquo;t support Sql authentication when connecting to the notification service, you can still make connections across domain boundaries. The trick is to use <a target="_blank" href="https://msdn.microsoft.com/en-us/library/ff647396.aspx#paght000008_mirroredaccounts">&ldquo;mirrored accounts&rdquo;</a>, which boils down to creating a local/domain windows user on the database server with the same username and password as the External Activator&rsquo;s service account. The service account must be a local or domain user (you can&rsquo;t use e.g. <span style="color: #0000ff;">NT AUTHORITY\NETWORK SERVICE</span>). Once you create a Sql Server login from that user and grant necessary Sql Server permissions to that login, External Activator will be able to connect, even from outside of the database server&rsquo;s domain. </li>
<li>External Activator runs on different machine from Sql Server, but both machines are in the same domain or in trusted domains. <ol>
<li>&nbsp;<ol>
<li>If External Activator runs as <span style="color: #0000ff;">NT AUTHORITY\NETWORK SERVICE</span> or <span style="color: #0000ff;">NT AUTHORITY\SYSTEM</span>, the login may be created from machine account (e.g. <span style="color: #0000ff;">MyDomain\EaMachine$</span> - note the dollar sign necessary for machine accounts). </li>
<li>If External Activator runs as domain user, the login may be created from that user directly (e.g. <span style="color: #0000ff;">MyDomain\EaUser</span>). </li>
<li>If External Activator runs as local user, you have to resort to using mirrored accounts as described above. </li>
<li><span style="color: #0000ff;">NT AUTHORITY\LOCAL SERVICE</span> is not supported as External Activator service account in a multi-machine deployment. </li>
</ol></li>
</ol></li>
<li>External Activator runs on the same machine as the Sql Server it&rsquo;s connecting to. In this case, in addition to the above possibilities, you can also use the following: <ol>
<li>&nbsp;<ol>
<li>If External Activator runs as local user, the login may be created from the local user (e.g. <span style="color: #0000ff;">MachineName\EaUser</span>). </li>
<li>If the OS is Vista or higher, the login may be created using the service SID (i.e. <span style="color: #0000ff;">NT SERVICE\SSBExternalActivator</span>). </li>
<li>If the OS is older than Vista, the login may be created using the <i><span style="color: #0000ff;">SSB EA Service</span></i> local group (i.e. <span style="color: #0000ff;">MyMachine\SSB EA Service</span>). Note however that it won&rsquo;t work if External Activator runs as <span style="color: #0000ff;">NT AUTHORITY\SYSTEM</span>. Local system is a special account and even if it belongs to <i><span style="color: #0000ff;">SSB EA Service</span></i> security group, that group&rsquo;s token won&rsquo;t be passed to Sql Server when External Activator tries to log in, hence the login will fail.<br /><br />The advantage of using Service SID/SSB EA Service group as a base for Sql login is that nothing needs to be done on Sql Server side when External Activator&rsquo;s service account is changed.</li>
</ol></li>
</ol></li>
</ol>]]></content:encoded>
    </item>
    <item>
      <title>Sample activated application</title>
      <link>https://review.docs.microsoft.com/archive/blogs/sql_service_broker/sample-activated-application</link>
      <pubDate>Wed, 10 Mar 2010 11:50:00 GMT</pubDate>
      <dc:creator><![CDATA[pmarciniak]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sql_service_broker/2010/03/10/sample-activated-application/</guid>
      <description><![CDATA[In today’s post we're providing a sample application skeleton that may be used to play with External...]]></description>
      <content:encoded><![CDATA[<P>In today’s post we're providing a sample application skeleton that may be used to play with External Activator, as well as serve as a base for writing custom activated applications.</P>
<P>A&nbsp;file with source&nbsp;code of the application is attached to this post and you can get it by clicking <A href="https://blogs.msdn.com/sql_service_broker/attachment/9976426.ashx" target=_blank mce_href="https://blogs.msdn.com/sql_service_broker/attachment/9976426.ashx">here</A>.</P>
<P>The sample assumes a usage scenario where the activated application is used to offload some CPU-intensive computation from Sql Server. Whenever there’s some work to be done, Sql Server creates a conversation and sends a <EM>RequestMessage</EM> on it. The message contains some application-specific binary payload. The activated application receives such message, performs the computation and sends back a <EM>ResponseMessage</EM> containing the results of the computation.&nbsp; At this point Sql Server may decide to end the conversation or keep sending more <EM>RequestMessages</EM> on the same conversation. Upon receiving error or end conversation messages, the activated application will end its end of the conversation (and write an entry to Windows Event Log in case of error message). For the purpose of this sample, the “CPU-intensive computation” is just calculating an MD5 hash of the incoming payload.</P>
<P>Note that some users may prefer to insert the result directly into database table rather than sending a response message. However, this sample chooses a response message approach, since it provides better decoupling between the activated application and database schema.</P>
<P>The application is somewhat generic in the sense that it is passed the location of the queue it should read messages from as command line arguments. That way, it may be compiled once and used for servicing more than just single application queue. In order to make it work, you need to make sure the first 4 command line arguments External Activator passes to the app are:</P>
<OL>
<LI>The Sql Server instance to connect to.</LI>
<LI>The name of the database where the application queue is located.</LI>
<LI>The name of the schema where the application queue is located.</LI>
<LI>The name of the application queue.</LI></OL>
<P>Luckily, External Activator is able to generate these arguments based on the contents of the event notification message received (the Sql-generated message that triggers launching the user app). All you need to do is to configure the LaunchInfo section of the EAService.config file like this:</P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=2>&lt;LaunchInfo&gt;<BR><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;ImagePath&gt;c:\test\MessageProcessingApplication.exe&lt;/ImagePath&gt;<BR><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;CmdLineArgs&gt; %sqlserver% %database% %schema% %queue% &lt;/CmdLineArgs&gt;<BR><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>&lt;WorkDir&gt;c:\test&lt;/WorkDir&gt;<BR>&lt;/LaunchInfo&gt;</FONT></SPAN></P>
<P>One more thing: The example app requires a specific Windows Event Log source to exist and we didn’t want to force you to play with the code using admin privileges. Therefore, prior to running the main app, the event source needs to be explicitly created. For your convenience, the code includes helpers to create and destroy the event log source. In order to create it, simply execute the app with CreateLogSource command line argument (for deleting the source, use DeleteLogSource). You need to do that as administrator (elevated).</P>
<P>That's it for now; next time we’ll provide a step-by-step guide how to configure External Activator so that this simple app may be tested, as well as how to troubleshoot any issues.</P>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/09/97/64/26/Program.cs" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-09-97-64-26/Program.cs">Program.cs</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Get Started With Using External Activator</title>
      <link>https://review.docs.microsoft.com/archive/blogs/sql_service_broker/get-started-with-using-external-activator</link>
      <pubDate>Mon, 18 May 2009 14:47:00 GMT</pubDate>
      <dc:creator><![CDATA[junan_msft]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sql_service_broker/2009/05/18/get-started-with-using-external-activator/</guid>
      <description><![CDATA[In the blog post Announcing Service Broker External Activator, we introduced Service Broker External...]]></description>
      <content:encoded><![CDATA[<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3 face=Calibri>In the<SPAN style="COLOR: #1f497d"> </SPAN>blog post </FONT><A href="https://blogs.msdn.com/sql_service_broker/archive/2008/11/21/announcing-service-broker-external-activator.aspx" mce_href="https://blogs.msdn.com/sql_service_broker/archive/2008/11/21/announcing-service-broker-external-activator.aspx"><FONT size=3 face=Calibri>Announcing Service Broker External Activator</FONT></A><FONT size=3 face=Calibri>, we introduced Service Broker External Activator and showed what benefits a broker user can get from using it. In this article, we'll get you started with using external activator in four steps:</FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>How to create a notification service</FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>How to create an event notification to associate your user queue with the notification service</FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>How to modify external activator configuration file to connect to the notification service you just defined and to launch applications when messages are arriving at your user queues that are being monitored</FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>A few things External Activator expect you to do </FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3 face=Calibri>To begin with, external activator must connect to a notification service before it can do anything useful. If you don't have a notification service yet, here is the script you can use to create one:</FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">-- switch to the database where you want to define the notification service</SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">USE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> <SPAN style="BACKGROUND: yellow; mso-highlight: yellow">my_db</SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">-- create a queue to host the notification service</SPAN><SPAN style="COLOR: #1f497d"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> <SPAN style="COLOR: blue">QUEUE</SPAN> my_notif_queue<SPAN style="COLOR: gray"> <o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">-- create event notification service</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> <SPAN style="COLOR: blue">SERVICE</SPAN> <SPAN style="BACKGROUND: yellow; mso-highlight: yellow">my_notif_svc</SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">QUEUE</SPAN> my_notif_queue<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt">(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [https://schemas.microsoft.com/SQL/Notifications/PostEventNotification]<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">GO</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3 face=Calibri>Next, let's create an event notification object so whenever messages have arrived at the user queue you are interested in (</FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">my_user_queue</SPAN><FONT size=3 face=Calibri>), notifications will be posted to the notification service we just created above:</FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> <SPAN style="COLOR: blue">EVENT</SPAN> <SPAN style="COLOR: blue">NOTIFICATION</SPAN> my_evt_notif<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">ON</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> <SPAN style="COLOR: blue">QUEUE</SPAN> <SPAN style="BACKGROUND: yellow; mso-highlight: yellow">my_user_queue</SPAN> <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">FOR</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> QUEUE_ACTIVATION<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">TO</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> <SPAN style="COLOR: blue">SERVICE</SPAN> <SPAN style="COLOR: red">'<SPAN style="BACKGROUND: yellow; mso-highlight: yellow">my_notif_svc</SPAN>'</SPAN> <SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">'current database'</SPAN><SPAN style="COLOR: gray"> <o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">GO</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3 face=Calibri>The above&nbsp; example assumes </FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">my_user_queue </SPAN><FONT size=3 face=Calibri>and </FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">my_notif_svc</SPAN><FONT size=3 face=Calibri> reside in the same database. In the case of </FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">my_notif_svc</SPAN><FONT size=3 face=Calibri> is in another database, </FONT><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt">'current database'</SPAN><FONT size=3 face=Calibri> should be replaced with the broker instance GUID where </FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">my_notif_svc</SPAN><FONT size=3><FONT face=Calibri> is defined in.<SPAN style="COLOR: #1f497d"> <o:p></o:p></SPAN></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="COLOR: #1f497d"><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3 face=Calibri>Assume you have already downloaded the Service Broker External Activator MSI package and installed external activator to </FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">C:\Program Files\Service Broker\External Activator\</SPAN><FONT size=3 face=Calibri>. &nbsp;&nbsp;Suppose the message processing application that you want external activator to invoke is in </FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">c:\test\myMessageReceiver.exe</SPAN><FONT size=3 face=Calibri>, and your notification database server is running on </FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">my_pc01</SPAN><FONT size=3 face=Calibri>. Here is what your configuration file will look like (</FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">C:\Program Files\Service Broker\External Activator\config\EAService.config</SPAN><FONT size=3 face=Calibri>):</FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="COLOR: #1f497d"><FONT size=3><FONT face=Calibri>...<o:p></o:p></FONT></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp; &lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">NotificationServiceList</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">NotificationService</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt">name</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">"<SPAN style="BACKGROUND: yellow; COLOR: blue; mso-highlight: yellow">my_notif_svc</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">id</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">100</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">enabled</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">true</SPAN>"<SPAN style="COLOR: blue">&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">Description</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">my notification service<SPAN style="COLOR: blue">&lt;/</SPAN><SPAN style="COLOR: #a31515">Description</SPAN><SPAN style="COLOR: blue">&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">ConnectionString</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">Unencrypted</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">server=</SPAN><SPAN style="BACKGROUND: yellow; COLOR: #1f497d; mso-highlight: yellow"><FONT size=3 face=Calibri>my_pc01</FONT></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">;database=</SPAN><SPAN style="BACKGROUND: yellow; COLOR: #1f497d; mso-highlight: yellow"><FONT size=3 face=Calibri>my_db</FONT></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">;Application Name=External Activator;Integrated Security=true;<SPAN style="COLOR: blue">&lt;/</SPAN><SPAN style="COLOR: #a31515">Unencrypted</SPAN><SPAN style="COLOR: blue">&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">ConnectionString</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; &lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">NotificationService</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp; &lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">NotificationServiceList</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp; &lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">ApplicationServiceList</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">ApplicationService</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt">name</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">"<SPAN style="COLOR: blue">myMessageApp</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">enabled</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">true</SPAN>"<SPAN style="COLOR: blue">&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">OnNotification</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">ServerName</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;</SPAN><SPAN style="BACKGROUND: yellow; COLOR: #1f497d; mso-highlight: yellow"><FONT size=3 face=Calibri>my_pc01</FONT></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">ServerName</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">DatabaseName</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;</SPAN><SPAN style="BACKGROUND: yellow; COLOR: #1f497d; mso-highlight: yellow"><FONT size=3 face=Calibri>my_db</FONT></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">DatabaseName</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">SchemaName</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 10pt; mso-highlight: yellow">dbo</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">SchemaName</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">QueueName</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 10pt; mso-highlight: yellow">my_user_queue</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">QueueName</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">OnNotification</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">LaunchInfo</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">ImagePath</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 10pt; mso-highlight: yellow">c:\test\myMessageReceiver.exe</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">ImagePath</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">CmdLineArgs</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 10pt; mso-highlight: yellow">whatever cmd-line arguments you need to pass to your receiver application</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">CmdLineArgs</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">WorkDir</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; BACKGROUND: yellow; FONT-SIZE: 10pt; mso-highlight: yellow">c:\test</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">WorkDir</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">LaunchInfo</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">Concurrency</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt">min</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">"<SPAN style="COLOR: blue">1</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">max</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">4</SPAN>"<SPAN style="COLOR: blue"> /&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; &lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">ApplicationService</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp; &lt;/</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">ApplicationServiceList</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&gt;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="COLOR: #1f497d"><FONT size=3><FONT face=Calibri>...<o:p></o:p></FONT></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3 face=Calibri>We now have specified notification service name, notification database connection string, the four-part user queue name whose activities we like to watch, and the message-receiving application we like External Activator to invoke when messages are coming in. We have also configured the </FONT><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt">min</SPAN><FONT size=3 face=Calibri> attribute of the </FONT><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&lt;</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt">Concurrency</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">/&gt; </SPAN><FONT size=3 face=Calibri>element to </FONT><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">1</SPAN><FONT size=3><FONT face=Calibri><SPAN style="COLOR: #1f497d">, </SPAN>which means External Activator will launch a single instance of </FONT></FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">c:\test\myMessageReceiver.exe</SPAN><FONT size=3><FONT face=Calibri> upon the first QUEUE_ACTIVATION notification message received for<SPAN style="COLOR: #1f497d"> </SPAN></FONT></FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">my_user_queue</SPAN><FONT size=3 face=Calibri>. The </FONT><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt">max</SPAN><FONT size=3><FONT face=Calibri><SPAN style="COLOR: #1f497d"> </SPAN>attribute is set to </FONT></FONT><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">4</SPAN><FONT size=3><FONT face=Calibri>, meaning as many as four instances of the same application<SPAN style="COLOR: #1f497d"> </SPAN>can be launched<SPAN style="COLOR: #1f497d"> </SPAN>if service broker sees<SPAN style="COLOR: #1f497d"> </SPAN></FONT></FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">my_user_queue</SPAN><FONT size=3><FONT face=Calibri><SPAN style="COLOR: #1f497d"> </SPAN>are not being drained fast enough (e.g., messages keep accumulating). We recommend </FONT></FONT><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt">max</SPAN><FONT size=3 face=Calibri> to be set to the number of CPU cores of the machine where External Activator is deployed (</FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">my_pc01</SPAN><FONT size=3 face=Calibri>) to take<SPAN style="COLOR: #1f497d"> </SPAN>full advantage of the machine power<SPAN style="COLOR: #1f497d">.</SPAN> </FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3 face=Calibri>A couple of things External Activator expects you to do it right include:</FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.25in; mso-list: l1 level1 lfo2" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>The windows login-account external activator service is running under needs to have the set of permissions that are <SPAN style="COLOR: black">listed</SPAN> in <B>Security Implications</B> section of </FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">C:\Program Files\Service Broker\External Activator\bin\&lt;language_id&gt;\ssbea.doc</SPAN><FONT size=3 face=Calibri> in order to connect to the notification service and database to read notification messages from the notification service queue (</FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">my_notif_queue</SPAN><FONT size=3><FONT face=Calibri>)<SPAN style="COLOR: #1f497d">. </SPAN>Assuming the service account is <B>my_domain\my_username</B>, we have provided the SQL scripts below that can be used to set up the minimum set of permissions required by external activator.<SPAN style="COLOR: #1f497d"> </SPAN><SPAN style="COLOR: black">Please refer to <A href="https://msdn.microsoft.com/en-us/library/ms166045.aspx" mce_href="https://msdn.microsoft.com/en-us/library/ms166045.aspx">Service Broker Identity and Access Control</A> page for </SPAN>more information about<SPAN style="COLOR: #1f497d"> </SPAN><SPAN style="COLOR: black">what permissions are expected by service broker applications, and <A href="https://msdn.microsoft.com/en-us/library/bb839489.aspx" mce_href="https://msdn.microsoft.com/en-us/library/bb839489.aspx">Service Broker Tutorials</A> for more information about broker programming in general</SPAN><SPAN style="COLOR: #1f497d">.</SPAN></FONT></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">-- switch to master database</SPAN><SPAN style="COLOR: #1f497d"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">USE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> <SPAN style="COLOR: blue">master<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">-- create a sql-login for the same named service account from windows</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> <SPAN style="COLOR: blue">LOGIN</SPAN> [my_domain\my_username] <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: blue">WINDOWS<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">-- switch to the notification database</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">USE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> my_db<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">-- allow CONNECT to the notification database</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">GRANT</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> <SPAN style="COLOR: blue">CONNECT</SPAN> <SPAN style="COLOR: blue">TO</SPAN> [my_domain\my_username]<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">-- allow RECEIVE from the notification service queue</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">GRANT</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> <SPAN style="COLOR: blue">RECEIVE</SPAN> <SPAN style="COLOR: blue">ON</SPAN> my_notif_queue <SPAN style="COLOR: blue">TO</SPAN> [my_domain\my_username]<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">-- allow VIEW DEFINITION right on the notification service</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">GRANT</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> <SPAN style="COLOR: blue">VIEW</SPAN> <SPAN style="COLOR: blue">DEFINITION</SPAN> <SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">SERVICE</SPAN><SPAN style="COLOR: gray">::</SPAN>my_notif_svc <SPAN style="COLOR: blue">TO</SPAN> [my_domain\my_username]<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">-- allow REFRENCES right on the notification queue schema</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">GRANT</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> <SPAN style="COLOR: blue">REFERENCES</SPAN> <SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">SCHEMA</SPAN><SPAN style="COLOR: gray">::</SPAN>dbo <SPAN style="COLOR: blue">TO</SPAN> [my_domain\my_username]<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">GO</SPAN><SPAN style="COLOR: #1f497d"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.25in" class=MsoNormal><SPAN style="COLOR: #1f497d"><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></SPAN></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.25in; mso-list: l1 level1 lfo2" class=MsoListParagraph><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>Your application (</FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">c:\test\myMessageReceiver.exe</SPAN><FONT size=3 face=Calibri>), when launched, must issue RECEIVEs and consume messages from your user queue (</FONT><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">my_user_queue</SPAN><FONT size=3 face=Calibri>) before it exits for service broker to post more event notifications when either your user queue is not completely drained at the time your application finishes or there are new messages coming in later after your application quits. For more details about how broker activations work, check out </FONT><A href="https://msdn.microsoft.com/en-us/library/ms171601.aspx" mce_href="https://msdn.microsoft.com/en-us/library/ms171601.aspx"><FONT size=3 face=Calibri>Understanding When Activation Occurs</FONT></A><FONT size=3 face=Calibri> of SQL Server Books Online.</FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3 face=Calibri>If you have done all the above necessities, now try to start your external activator service, and send a few messages to your user queue, you should probably be able to see the messages are read and processed. But if not<SPAN style="COLOR: black">, in</SPAN> our next EA blog article, and we'll show<SPAN style="COLOR: #1f497d"> </SPAN>how<SPAN style="COLOR: #1f497d"> </SPAN>you can trouble-shoot external activator to find <SPAN style="COLOR: black">out what have gone</SPAN> wrong. Stay tuned! :)</FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>]]></content:encoded>
    </item>
    <item>
      <title>Service Broker Wait Types</title>
      <link>https://review.docs.microsoft.com/archive/blogs/sql_service_broker/service-broker-wait-types</link>
      <pubDate>Mon, 01 Dec 2008 15:08:00 GMT</pubDate>
      <dc:creator><![CDATA[priyankporwal]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sql_service_broker/2008/12/01/service-broker-wait-types/</guid>
      <description><![CDATA[SQL server engine keeps track of wait operations (aka wait types) performed by all its executing...]]></description>
      <content:encoded><![CDATA[<P>SQL server engine keeps track of wait operations (aka <B><I>wait types</I></B>) performed by all its executing threads, either to serialize access to protected structures or to wait for asynchronous events/notifications. <B>Sys.dm_os_wait_stats</B> DMV can be used to get the statistics for all wait types and can potentially point to performance issues and code paths with high degrees of contention.</P>
<P>Service Broker threads use 12 different wait types. The sections below describe these wait types in detail and their expected values depending on usage of specific Service Broker features.</P>
<P><I>[Note: Let&nbsp; <B>avg_wait_time_ms = wait_time_ms/waiting_tasks_count</B> for each wait type from the DMV]<B></B></I></P>
<P><B>1.&nbsp;&nbsp;&nbsp; </B><B>BROKER_CONNECTION_RECEIVE_TASK</B></P>
<P>Each Service Broker (and Database Mirroring) connection endpoint has a list of buffers posted to receive data from the network. There are two threads working on this list, one that posts buffers for receive and one that processes them after receiving the data. </P>
<P mce_keep="true">This wait type is charged whenever these threads attempt to access this list to add or remove buffers.</P>
<P mce_keep="true">Waiting_tasks_count and wait_time_ms for this wait type should both be proportional to the amount of network data received by all Service Broker (and Database Mirroring) connection endpoints and avg_wait_time_ms should be a really small value. </P>
<P mce_keep="true"><B>2.&nbsp;&nbsp;&nbsp; </B><B>BROKER_ENDPOINT_STATE_MUTEX</B></P>
<P>This wait type is charged each time there is some state change for a Service Broker (or Database Mirroring) connection endpoint during the connection establishment (i.e. handshake) phase - e.g. initialization before connect or after accept, login negotiation (authentication, encryption), validation, error, arbitration and error. This wait type is also charged per connection endpoint every time sys.dm_broker_connections (or sys.dm_db_mirroring_connections) DMV is queried to serialize access to each connections handshake state.</P>
<P mce_keep="true">Avg_wait_time_ms for this wait type should be very small and the wait_time_ms and waiting_tasks_count should both be proportional to the number of times Service Broker (or Database Mirroring) establishes connection with some other SQL server instance and the number of times sys.dm_broker_connections (or sys.dm_db_mirroring_connections) DMV is queried.</P>
<P mce_keep="true">Rapidly increasing values of wait_time_ms and waiting_tasks_count for this DMV could indicate very frequent connection establishment (and teardown). Since service broker transport tears down connections after ~90 seconds of inactivity, these values can increase if applications use service broker once every ~90 seconds.</P>
<P mce_keep="true"><B>3.&nbsp;&nbsp;&nbsp; </B><B>BROKER_EVENTHANDLER</B></P>
<P mce_keep="true">Each SQL server instance has a primary event handler thread for processing Service Broker startup/shutdown and timer events. This thread never goes away and is always either waiting for such events or processing them.</P>
<P mce_keep="true">This wait type is charged each time Service Broker's primary event handler waits for instance startup/shutdown or any dialog timer events (dialog timeouts) and mirrored routes timeouts.</P>
<P mce_keep="true">Wait_time_ms for this wait type should approximately be equal to the interval since instance startup. Waiting_tasks_count merely indicates the number of times the primary event handler had to wait due to absence of any events. </P>
<P mce_keep="true">Neither of these two fields in the DMV indicates any performance issue in the engine. If Service Broker is not being used at all (either directly or through DBMail, Event Notification), then max_wait_time_ms and wait_time_ms would approximately be the same and waiting_tasks_count would be really small value.</P>
<P><B>4.&nbsp;&nbsp;&nbsp; </B><B>BROKER_INIT</B></P>
<P mce_keep="true">This wait type is charged each time Service Broker fails to initialize internal broker managers for any database. Service Broker waits for about 1 second before re-attempting to initialize broker for same database. These events should be rare.</P>
<P mce_keep="true">Waiting_tasks_count for this wait type is the number of times Service Broker failed to initialize broker on any database. Wait_time_ms will be proportional to waiting_tasks_count with avg_wait_time_ms being close to 1 second.&nbsp; </P>
<P mce_keep="true">High or increasing values of waiting_tasks_count for this wait type indicate some problem in the SQL instance.</P>
<P><B>5.&nbsp;&nbsp;&nbsp; </B><B>BROKER_MASTERSTART</B></P>
<P mce_keep="true">This wait type is charged only during instance startup, when Service Broker is waiting for master database to startup. </P>
<P mce_keep="true">Waiting_tasks_count should be just 1 and wait_time_ms should be really small for this wait type.</P>
<P><B>6.&nbsp;&nbsp;&nbsp; </B><B>BROKER_RECEIVE_WAITFOR</B></P>
<P mce_keep="true">This wait type is charged once per WAITFOR RECEIVE SQL statement, where the statement execution waits for messages to arrive in the user queue.</P>
<P mce_keep="true">Waiting_tasks_count must be same as the number of times such statements have been executed and wait_time_ms should be the total time their execution had to wait before messages arrived or WAITFOR timeout for each.</P>
<P mce_keep="true">If avg_wait_time_ms is much higher than expected, errorlog and profiler events should be checked on both initiator and target server instances for potential problems.</P>
<P><B>7.&nbsp;&nbsp;&nbsp; </B><B>BROKER_REGISTERALLENDPOINTS</B></P>
<P mce_keep="true">This wait type is charged only during instance startup, when Service Broker is waiting for all endpoint types to be registered, so that it can start Broker and/or Database Mirroring endpoints.</P>
<P mce_keep="true">Waiting_tasks_count should be just 1 and wait_time_ms should be really small for this wait type.</P>
<P><B>8.&nbsp;&nbsp;&nbsp; </B><B>BROKER_SERVICE</B></P>
<P mce_keep="true">This wait type is charged when next hop destination list associated with a target service/broker instance pair gets updated or re-prioritized due to addition or removal of a dialog to the target service/broker instance pair. Service Broker sends messages to these next hop destinations in the order of their priority and hence it needs to serialize access to destination-list and their effective priority changes.</P>
<P mce_keep="true">Waiting_tasks_count and wait_time_ms for this wait type merely indicate the number of times Service Broker had to serialize access to these internal structures with avg_wait_time_ms being really small.</P>
<P><B>9.&nbsp;&nbsp;&nbsp; </B><B>BROKER_SHUTDOWN</B></P>
<P mce_keep="true">This wait type is charged only during instance shutdown, when Service Broker waits a few seconds for its primary event handler and all connection endpoints to shutdown.</P>
<P mce_keep="true">Waiting_tasks_count and wait_time_ms for this wait type should be both 0 unless instance shutdown has already started. </P>
<P mce_keep="true"><B>10. </B><B>BROKER_TASK_STOP</B></P>
<P mce_keep="true">Service Broker has several task handlers to execute broker internal tasks related to transmission of messages, asynchronous network operations and processing of received messages.</P>
<P mce_keep="true">This wait type is charged only when one of these task handlers is stopping due to absence of broker internal tasks. The task handler waits for maximum 10 seconds before getting destroyed in case it needs to be restarted to execute some task.</P>
<P mce_keep="true">Waiting_tasks_count and wait_time_ms should both be small values for heavy Service Broker usage scenarios. In addition, every 5 seconds, Service Broker schedules an internal cleanup task that does not do much work when broker is not being used. But, it causes one of the task handlers to wake-up, restart, execute the task and then start waiting again. As a result, even though Service Broker is not used at all, waiting_tasks_count and wait_time_ms for this wait type keep increasing, proportional to the interval since instance startup with avg_wait_time_ms being close to 5 seconds.</P>
<P><B>11. </B><B>BROKER_TO_FLUSH</B></P>
<P mce_keep="true">For performance reasons Service Broker maintains all dialog state (TO - transmission object) in memory as well as in temporary tables on disk. Every time a TO is updated, it is scheduled to be flushed lazily to the temporary table on disk. Service Broker employs an always alive lazy flusher task to do this job. </P>
<P mce_keep="true">This wait type is charged when the TO lazy flusher task is waiting for some TOs to be saved to the temporary tables. The lazy flusher sleeps for 1 second before waiting again for ~1 second for TOs to be saved.</P>
<P>If Service Broker is not used at all, wait_time_ms and waiting_tasks_count for this wait type should be proportional to the duration since instance startup, with avg_wait_time_ms being close to ~1 second. When Service Broker is used heavily these columns should have lowe values since the lazy flusher will be busy as well.</P>
<P><B>12. </B><B>BROKER_TRANSMITTER</B></P>
<P mce_keep="true">Service Broker has a component known as the Transmitter which schedules messages from multiple dialogs to be sent across the wire over one or more connection endpoints. The transmitter has 2 dedicated threads for this purpose. </P>
<P mce_keep="true">This wait type is charged when these transmitter threads are waiting for dialog messages to be sent using the transport connections. </P>
<P mce_keep="true">High values of waiting_tasks_count for this wait type point to intermittent work for these transmitter threads and are not indications of any performance problem. If service broker is not used at all, waiting_tasks_count should be 2 (for the 2 transmitter threads) and wait_time_ms should be twice the duration since instance startup.</P>
<P mce_keep="true"><STRONG>Example: Broker wait types statistics after 1 hour (3,600,000 ms) of idle system</STRONG>&nbsp;&nbsp;&nbsp; </P>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 9pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P mce_keep="true">
<TABLE style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; MARGIN: auto auto auto 0.85pt; BORDER-COLLAPSE: collapse; BORDER-TOP: medium none; BORDER-RIGHT: medium none; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.75pt 0in 5.75pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" class=MsoTableGrid border=1 cellSpacing=0 cellPadding=0 class="MsoTableGrid">
<TBODY>
<TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 175.55pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" vAlign=top width=234>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">Service Broker Wait Type<o:p></o:p></SPAN></B></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 76.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1" vAlign=top width=102>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">waiting_tasks_count<o:p></o:p></SPAN></B></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 58.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1" vAlign=top width=78>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">wait_time_ms<o:p></o:p></SPAN></B></P></TD></TR>
<TR style="mso-yfti-irow: 1">
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 175.55pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=234>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">BROKER_CONNECTION_RECEIVE_TASK<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 76.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=102>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">0<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 58.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=78>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">0<o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 2">
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 175.55pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=234>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">BROKER_ENDPOINT_STATE_MUTEX<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 76.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=102>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">0<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 58.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=78>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">0<o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 3">
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 175.55pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=234>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">BROKER_EVENTHANDLER<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 76.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=102>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">3<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 58.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=78>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">81<B style="mso-bidi-font-weight: normal">*</B><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 4">
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 175.55pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=234>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">BROKER_INIT<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 76.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=102>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">0<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 58.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=78>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">0<o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 5">
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 175.55pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=234>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">BROKER_MASTERSTART<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 76.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=102>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">0<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 58.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=78>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">0<o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 6">
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 175.55pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=234>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">BROKER_RECEIVE_WAITFOR<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 76.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=102>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">0<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 58.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=78>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">0<o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 7">
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 175.55pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=234>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">BROKER_REGISTERALLENDPOINTS<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 76.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=102>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">0<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 58.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=78>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">0<o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 8">
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 175.55pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=234>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">BROKER_SERVICE<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 76.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=102>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">0<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 58.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=78>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">0<o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 9">
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 175.55pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=234>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">BROKER_SHUTDOWN<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 76.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=102>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">0<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 58.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=78>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">0<o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 10">
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 175.55pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=234>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">BROKER_TASK_STOP<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 76.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=102>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">724<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 58.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=78>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">3634180<o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 11">
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 175.55pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=234>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">BROKER_TO_FLUSH<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 76.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=102>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">1762<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 58.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=78>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">1804005<o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 12; mso-yfti-lastrow: yes">
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 175.55pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1" vAlign=top width=234>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">BROKER_TRANSMITTER<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 76.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=102>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">2<o:p></o:p></SPAN></P></TD>
<TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.75pt; WIDTH: 58.5pt; PADDING-RIGHT: 5.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt; mso-border-themecolor: text1; mso-border-left-alt: solid black .5pt; mso-border-left-themecolor: text1; mso-border-top-alt: solid black .5pt; mso-border-top-themecolor: text1; mso-border-bottom-themecolor: text1; mso-border-right-themecolor: text1" vAlign=top width=78>
<P style="TEXT-ALIGN: justify; LINE-HEIGHT: normal; MARGIN: 0in 0.85pt 0pt 0in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 6pt">0<B style="mso-bidi-font-weight: normal">*</B><o:p></o:p></SPAN></P></TD></TR></TBODY></TABLE></P>
<P mce_keep="true"><STRONG>* </STRONG>Service Broker's primary event handler and the transmitter threads are still waiting for some dialog activity to wake them up. Since wait_time_ms gets updated only after the wait is over, we see 0/low values for these wait types.</P>]]></content:encoded>
    </item>
    <item>
      <title>Announcing Service Broker External Activator</title>
      <link>https://review.docs.microsoft.com/archive/blogs/sql_service_broker/announcing-service-broker-external-activator</link>
      <pubDate>Fri, 21 Nov 2008 13:07:00 GMT</pubDate>
      <dc:creator><![CDATA[junan_msft]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sql_service_broker/2008/11/21/announcing-service-broker-external-activator/</guid>
      <description><![CDATA[The Microsoft SQL Server Service Broker External Activator (EA) is distributed in the Microsoft SQL...]]></description>
      <content:encoded><![CDATA[<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><FONT face=Calibri size=3>The Microsoft SQL Server Service Broker External Activator (EA) is distributed in the Microsoft SQL Server 2008 Feature Pack. It is an extension of the internal activation feature and lets you move the logic for receiving and processing service broker messages from the database engine service to an application executable that runs outside the database engine service. This can provide a higher level of scale-out performance by moving processing loads from the database server to another computer. The activation application process can also run under a different windows account from the database engine process. This gives administrators additional control over the resources that the activation application can access. Installation packages for x86, x64, and ia64 architectures can be downloaded from </FONT><A href="https://www.microsoft.com/downloads/details.aspx?FamilyId=228DE03F-3B5A-428A-923F-58A033D316E1&amp;displaylang=en"><FONT face=Calibri size=3>here</FONT></A><FONT face=Calibri size=3>. </FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt; LINE-HEIGHT: normal"><FONT face=Calibri size=3>Specifically, here are a list of benefits a user can get from using EA:</FONT></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-list: l0 level1 lfo1"><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Access non-database resources such as files, network connections in their message processing applications</FONT></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-list: l0 level1 lfo1"><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Offload computation-intensive work out of SQL box and deploy it to a different machine</FONT></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-list: l0 level1 lfo1"><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Leverage legacy code libraries that are not accessible within T-SQL stored procedures</FONT></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-list: l0 level1 lfo1"><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Message processing solution that adapts and scales well by specifying the MIN and MAX number of instances of application processes to run</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt; LINE-HEIGHT: normal"><FONT face=Calibri size=3>After installed, EA runs as a NT service. It watches the user configured <I>notification queue </I>for QUEUE_ACTIVATION events. As soon as a notification message is seen, it responds by launching an <I>activation application</I> specified in the configuration file to process messages received in the notification-related <I>user queue</I>. The notification queue, the user queue and the event notification associating them must be predefined before EA can run. A configuration file will tell EA which notification queue to watch on and what application to launch when a QUEUE_ACTIVATION event is received. In addition, a user can configure EA in a way that EA can launch enough number of application instances to consume messages from the user queue in a timely manner without a wasteful use of system resources.&nbsp;&nbsp; </FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt; LINE-HEIGHT: normal"><FONT face=Calibri size=3>In v1 release, EA only supports:</FONT></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-list: l1 level1 lfo2"><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Listening on a single notification service for queue activation events </FONT></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-list: l1 level1 lfo2"><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>Only integrated security is allowed in notification database connection string. SQL login and password are not supported just yet.</FONT></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-list: l1 level1 lfo2"><SPAN style="FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore"><FONT size=3>·</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT face=Calibri size=3>All user applications are launched under the same user credential as what EA is running under</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt; LINE-HEIGHT: normal"><FONT face=Calibri size=3>Please check out more details on how to setup and start using EA by reading the installed user doc <B>bin\&lt;culture_code&gt;\SSBEA.doc</B> in your install folder&nbsp; (for example, the English culture code is EN).</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt; LINE-HEIGHT: normal"><FONT face=Calibri size=3>We'll blog more about EA on topics such as configuration and deployment, tracing and trouble-shooting, some corner cases in our next several posts. Stay tuned! :-)</FONT></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p><FONT face=Calibri size=3>&nbsp;</FONT></o:p></P>]]></content:encoded>
    </item>
    <item>
      <title>Securing a dialog with certificates</title>
      <link>https://review.docs.microsoft.com/archive/blogs/sql_service_broker/securing-a-dialog-with-certificates</link>
      <pubDate>Tue, 26 Aug 2008 15:37:00 GMT</pubDate>
      <dc:creator><![CDATA[portegys]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sql_service_broker/2008/08/26/securing-a-dialog-with-certificates/</guid>
      <description><![CDATA[This sample shows how to set up a secure dialog using certificates. Service broker will always have...]]></description>
      <content:encoded><![CDATA[<P xmlns="">This sample shows how to set up a secure dialog using certificates. Service broker will always have a level of security at the transport level, which may include encryption, but this is at a server level of granularity. It does not secure conversations on a database-to-database basis. If this is required, then dialog security can be used. Dialog security is also end-to-end as opposed to the point-to-point connection-based security provided by transport security. Since conversations may entail multiple hops through the use of forwarding, dialog security can provide authentication and one-time encryption at the terminating services. Certificate-based authentication also allows users to specify a window of time in which authentication will be honored.</P>
<P xmlns="">The initiator and target certificates must be exchanged in order for them to authenticate each other. This "out of band" exchange should be done with a high level of trust, since a certificate bearer will be able to begin dialogs and send messages to service broker services in the authenticating server.</P>
<P xmlns=""><STRONG>Running the sample</STRONG></P>
<DIV class=section id=sectionSection1><CONTENT xmlns="https://ddue.schemas.microsoft.com/authoring/2003/5">
<DIV class=section xmlns="">
<OL>
<LI>
<P xmlns="">This sample requires two server instances on different machines to avoid a port collision. It is essential that the servers are configured to enable communication protocols. In this example, we will be using TCP, so use the SQL Server Configuration Manager to make sure TCP is enabled on both servers. To keep things simple, Windows authentication is used for transport security. The transport security sample shows how to use certificates for this if needed.</P>
<LI>
<P xmlns="">Run the scripts, in order:</P></LI>
<DL xmlns="">
<DT>Initiator endpoint setup.<BR><BR>Target endpoint setup.<BR><BR>Initiator service setup.<BR><BR>Target service setup.<BR><BR>Initiator certification of target.<BR><BR>Target certification of initiator.<BR><BR>Initiator message send.<BR><BR>Target message receive.<BR><BR>Initiator cleanup.<BR><BR>Target cleanup.</DT></DL></OL></DIV></DIV>
<P><STRONG>Scripts</STRONG></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Script for dialog security sample.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This file is part of the Microsoft SQL Server Code Samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Copyright (C) Microsoft Corporation. All Rights reserved.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This source code is intended only as a supplement to Microsoft<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Development Tools and/or on-line documentation. See these other<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- materials for detailed information regarding Microsoft code samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- PARTICULAR PURPOSE.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Set up an initiator service broker endpoint for dialog<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- certificate-based security.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Modify domain_name and target_host in script to suit configuration.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">master</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create the broker endpoint using Windows authentication.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">endpoints</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'service_broker_endpoint'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">ENDPOINT</SPAN> service_broker_endpoint<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">ENDPOINT</SPAN> service_broker_endpoint<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">STATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: blue">STARTED<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">AS</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">TCP </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">LISTENER_PORT</SPAN> <SPAN style="COLOR: gray">=</SPAN> 4022<SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">FOR</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">SERVICE_BROKER </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">AUTHENTICATION</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: blue">Windows</SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create a login for the target machine (target_host) in the shared domain<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- (domain_name). This assumes the availability of Kerberos authentication.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Note: the '$' is significant.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">LOGIN</SPAN> [domain_name\target_host$] <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: blue">Windows</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Grant the target connection access to the endpoint.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GRANT</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> CONNECT <SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">ENDPOINT</SPAN><SPAN style="COLOR: gray">::</SPAN>service_broker_endpoint <SPAN style="COLOR: blue">TO</SPAN> [domain_name\target_host$]<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P><o:p><FONT face=Calibri><FONT size=3>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Script for dialog security sample.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This file is part of the Microsoft SQL Server Code Samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Copyright (C) Microsoft Corporation. All Rights reserved.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This source code is intended only as a supplement to Microsoft<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Development Tools and/or on-line documentation. See these other<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- materials for detailed information regarding Microsoft code samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- PARTICULAR PURPOSE.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Set up a target service broker endpoint for dialog<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- certificate-based security.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Modify domain_name and initiator_host in script to suit configuration.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">master</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create the broker endpoint using Windows authentication.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">endpoints</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'service_broker_endpoint'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">ENDPOINT</SPAN> service_broker_endpoint<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Use Windows for authentication.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">ENDPOINT</SPAN> service_broker_endpoint<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">STATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: blue">STARTED<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">AS</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">TCP </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">LISTENER_PORT</SPAN> <SPAN style="COLOR: gray">=</SPAN> 4022<SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">FOR</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">SERVICE_BROKER </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">AUTHENTICATION</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: blue">Windows</SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create a login for the initiator machine (initiator_host) in the shared domain<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- (domain_name). This assumes the availability of Kerberos authentication.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Note: the '$' is significant.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">LOGIN</SPAN> [domain_name\initiator_host$] <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: blue">Windows</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Grant the initiator connection access to the endpoint.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GRANT</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> CONNECT <SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">ENDPOINT</SPAN><SPAN style="COLOR: gray">::</SPAN>service_broker_endpoint <SPAN style="COLOR: blue">TO</SPAN> [domain_name\initiator_host$]<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></FONT></FONT></o:p></P><o:p><FONT face=Calibri><FONT size=3>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Script for dialog security sample.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This file is part of the Microsoft SQL Server Code Samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Copyright (C) Microsoft Corporation. All Rights reserved.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This source code is intended only as a supplement to Microsoft<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Development Tools and/or on-line documentation. See these other<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- materials for detailed information regarding Microsoft code samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- PARTICULAR PURPOSE.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- The initiator creates a database, queue, service, target route,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- and certificate for the dialog to the target service.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Modify target_host and location of stored certificate in script<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- to suit configuration.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">master</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create initiator database.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">databases</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'initiator_database'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">DATABASE</SPAN> initiator_database<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">DATABASE</SPAN> initiator_database<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> initiator_database<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create a message queue.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">QUEUE</SPAN> initiator_queue<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create a service with a default contract.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">SERVICE</SPAN> initiator_service <SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">QUEUE</SPAN> initiator_queue<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN>[DEFAULT]<SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create a route to the target service.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">ROUTE</SPAN> target_route<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'target_service'</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://target_host:4022'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create a user who is authorized for the initiator service.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">sysusers</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'initiator_user'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">CREATE</SPAN> <SPAN style="COLOR: fuchsia">USER</SPAN> initiator_user WITHOUT <SPAN style="COLOR: blue">LOGIN</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ALTER</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">AUTHORIZATION</SPAN> <SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">SERVICE</SPAN><SPAN style="COLOR: gray">::</SPAN>initiator_service <SPAN style="COLOR: blue">TO</SPAN> initiator_user<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- A master key is required to use certificates. <o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">BEGIN</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">symmetric_keys</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'##MS_DatabaseMasterKey##'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">CREATE</SPAN> <SPAN style="COLOR: blue">MASTER</SPAN> <SPAN style="COLOR: blue">KEY</SPAN> <SPAN style="COLOR: blue">ENCRYPTION</SPAN> <SPAN style="COLOR: blue">BY</SPAN> <SPAN style="COLOR: blue">PASSWORD</SPAN><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: red">'Password#123'<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">COMMIT</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create a certificate and associate it with the user.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">certificates</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'initiator_dialog_cert'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">CERTIFICATE</SPAN> initiator_dialog_cert<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">CERTIFICATE</SPAN> initiator_dialog_cert<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">AUTHORIZATION</SPAN> initiator_user<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SUBJECT</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'Dialog certificate for initiator'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Backup to a file to allow the certificate to be given to the target.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">BACKUP</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">CERTIFICATE</SPAN> initiator_dialog_cert<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">TO</SPAN> <SPAN style="COLOR: blue">FILE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'c:\initiator_dialog.cert'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Script for dialog security sample.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This file is part of the Microsoft SQL Server Code Samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Copyright (C) Microsoft Corporation. All Rights reserved.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This source code is intended only as a supplement to Microsoft<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Development Tools and/or on-line documentation. See these other<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- materials for detailed information regarding Microsoft code samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- PARTICULAR PURPOSE.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- The target creates a database, queue, service, initiator route,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- and certificate for the dialog to the initiator service.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Modify initiator_host and location of stored certificate in script<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- to suit configuration.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">master</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create target database.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">databases</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'target_database'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">DATABASE</SPAN> target_database<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">DATABASE</SPAN> target_database<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> target_database<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create a message queue.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">QUEUE</SPAN> target_queue<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create a service with a default contract.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">SERVICE</SPAN> target_service <SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">QUEUE</SPAN> target_queue<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN>[DEFAULT]<SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create a route to the initiator service.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">ROUTE</SPAN> initiator_route<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'initiator_service'</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://initiator_host:4022'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create a user who is authorized for the target service.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">sysusers</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'target_user'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">CREATE</SPAN> <SPAN style="COLOR: fuchsia">USER</SPAN> target_user WITHOUT <SPAN style="COLOR: blue">LOGIN</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ALTER</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">AUTHORIZATION</SPAN> <SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">SERVICE</SPAN><SPAN style="COLOR: gray">::</SPAN>target_service <SPAN style="COLOR: blue">TO</SPAN> target_user<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- A master key is required to use certificates.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">BEGIN</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">symmetric_keys</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'##MS_DatabaseMasterKey##'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">CREATE</SPAN> <SPAN style="COLOR: blue">MASTER</SPAN> <SPAN style="COLOR: blue">KEY</SPAN> <SPAN style="COLOR: blue">ENCRYPTION</SPAN> <SPAN style="COLOR: blue">BY</SPAN> <SPAN style="COLOR: blue">PASSWORD</SPAN><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: red">'Password#123'<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">COMMIT</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create a certificate and associate it with the user.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">certificates</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'target_dialog_cert'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">CERTIFICATE</SPAN> target_dialog_cert<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">CERTIFICATE</SPAN> target_dialog_cert<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">AUTHORIZATION</SPAN> target_user<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SUBJECT</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'Dialog certificate for target'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Backup to a file to allow the certificate to be given to the initiator.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">BACKUP</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">CERTIFICATE</SPAN> target_dialog_cert<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">TO</SPAN> <SPAN style="COLOR: blue">FILE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'c:\target_dialog.cert'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">----------EXCHANGE CERTIFICATES BEFORE PROCEEDING---------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- The initiator and target certificates must be exchanged in order for them to<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- authenticate each other. In a production system, this "out of band" exchange<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- should be done with a high level of trust, since a certificate bearer will be <o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- able to begin dialogs and send messages to the secured service.However, assuming<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- the sample is being used on a development system, the exchange may be simple<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- remote copies.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt" mce_keep="true">&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Script for dialog security sample.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This file is part of the Microsoft SQL Server Code Samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Copyright (C) Microsoft Corporation. All Rights reserved.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This source code is intended only as a supplement to Microsoft<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Development Tools and/or on-line documentation. See these other<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- materials for detailed information regarding Microsoft code samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- PARTICULAR PURPOSE.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- The initiator creates a target user certified by the target certificate,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- binds it to the target service, and grants it send access to the initiator<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- service.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Modify location of stored certificate in script to suit configuration.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> initiator_database<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create a user for the target.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">sysusers</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'target_user'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">CREATE</SPAN> <SPAN style="COLOR: fuchsia">USER</SPAN> target_user WITHOUT <SPAN style="COLOR: blue">LOGIN</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">certificates</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'target_dialog_cert'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">CERTIFICATE</SPAN> target_dialog_cert<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Associate the target user with the target certificate.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">CERTIFICATE</SPAN> target_dialog_cert<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">AUTHORIZATION</SPAN> target_user<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: blue">FILE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'c:\target_dialog.cert'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Bind the target service to the target user.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">remote_service_bindings</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'remote_target_service_binding'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">REMOTE</SPAN> <SPAN style="COLOR: blue">SERVICE</SPAN> BINDING remote_target_service_binding<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">REMOTE</SPAN> <SPAN style="COLOR: blue">SERVICE</SPAN> BINDING remote_target_service_binding<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">TO</SPAN> <SPAN style="COLOR: blue">SERVICE</SPAN> <SPAN style="COLOR: red">'target_service'<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: fuchsia">USER</SPAN> <SPAN style="COLOR: gray">=</SPAN> target_user<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Allow the target to send to the initiator service.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GRANT</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">SEND</SPAN> <SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">SERVICE</SPAN><SPAN style="COLOR: gray">::</SPAN>initiator_service <SPAN style="COLOR: blue">TO</SPAN> target_user<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Script for dialog security sample.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This file is part of the Microsoft SQL Server Code Samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Copyright (C) Microsoft Corporation. All Rights reserved.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This source code is intended only as a supplement to Microsoft<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Development Tools and/or on-line documentation. See these other<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- materials for detailed information regarding Microsoft code samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- PARTICULAR PURPOSE.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- The target creates an initiator user certified by the initiator certificate,<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- binds it to the initiator service, and grants it send access to the target<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- service.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Modify location of stored certificate in script to suit configuration.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> target_database<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create a user for the initiator.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">sysusers</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'initiator_user'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">CREATE</SPAN> <SPAN style="COLOR: fuchsia">USER</SPAN> initiator_user WITHOUT <SPAN style="COLOR: blue">LOGIN</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Associate the initiator user with the initiator certificate.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">certificates</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'initiator_dialog_cert'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">CERTIFICATE</SPAN> initiator_dialog_cert<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">CERTIFICATE</SPAN> initiator_dialog_cert<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">AUTHORIZATION</SPAN> initiator_user<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: blue">FILE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'c:\initiator_dialog.cert'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Bind the initiator service to the initiator user.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">remote_service_bindings</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'remote_initiator_service_binding'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">REMOTE</SPAN> <SPAN style="COLOR: blue">SERVICE</SPAN> BINDING remote_initiator_service_binding<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">REMOTE</SPAN> <SPAN style="COLOR: blue">SERVICE</SPAN> BINDING remote_initiator_service_binding<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">TO</SPAN> <SPAN style="COLOR: blue">SERVICE</SPAN> <SPAN style="COLOR: red">'initiator_service'<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: fuchsia">USER</SPAN> <SPAN style="COLOR: gray">=</SPAN> initiator_user<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Allow the initiator to send to the target service.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GRANT</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">SEND</SPAN> <SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">SERVICE</SPAN><SPAN style="COLOR: gray">::</SPAN>target_service <SPAN style="COLOR: blue">TO</SPAN> initiator_user<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Script for dialog security sample.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This file is part of the Microsoft SQL Server Code Samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Copyright (C) Microsoft Corporation. All Rights reserved.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This source code is intended only as a supplement to Microsoft<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Development Tools and/or on-line documentation. See these other<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- materials for detailed information regarding Microsoft code samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- PARTICULAR PURPOSE.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- The initiator creates a dialog and sends a message to the target service.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> initiator_database<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create a message.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">DECLARE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> @message <SPAN style="COLOR: blue">varchar</SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: fuchsia">max</SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">SELECT</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> @message <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'Hello from initiator'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Create an encrypted dialog to the target service.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">DECLARE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> @handle <SPAN style="COLOR: blue">uniqueidentifier</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">BEGIN</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> DIALOG <SPAN style="COLOR: blue">CONVERSATION</SPAN> @handle<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: blue">SERVICE</SPAN> initiator_service<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">TO</SPAN> <SPAN style="COLOR: blue">SERVICE</SPAN> <SPAN style="COLOR: red">'target_service'<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">ENCRYPTION</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: blue">ON</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Send the message.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">SEND</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">CONVERSATION</SPAN> @handle<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN>@message<SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">PRINT</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: red">'Message sent to target_service on conversation:'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">PRINT</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> @handle<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Script for dialog security sample.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This file is part of the Microsoft SQL Server Code Samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Copyright (C) Microsoft Corporation. All Rights reserved.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This source code is intended only as a supplement to Microsoft<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Development Tools and/or on-line documentation. See these other<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- materials for detailed information regarding Microsoft code samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- PARTICULAR PURPOSE.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- The target waits for and receives a message from the initiator.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> target_database<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">DECLARE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> @message_body <SPAN style="COLOR: blue">varchar</SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: fuchsia">max</SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Wait for the message.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">WAITFOR</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">(<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">RECEIVE</SPAN> <SPAN style="COLOR: blue">TOP</SPAN><SPAN style="COLOR: gray">(</SPAN>1<SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@message_body<SPAN style="COLOR: gray">=</SPAN>message_body<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">FROM</SPAN> target_queue<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">);<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">PRINT</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: red">'Target received message: '</SPAN> <SPAN style="COLOR: gray">+</SPAN> @message_body<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" mce_keep="true">&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Script for dialog security sample.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This file is part of the Microsoft SQL Server Code Samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Copyright (C) Microsoft Corporation. All Rights reserved.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This source code is intended only as a supplement to Microsoft<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Development Tools and/or on-line documentation. See these other<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- materials for detailed information regarding Microsoft code samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- PARTICULAR PURPOSE.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Clean up the initiator.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Modify domain_name and target_host in script to suit configuration.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>-- The recommended method is for the initiator to inform the target<BR>-- with an "end of stream" message which causes the target to end the<BR>-- conversation.</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">master</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">databases</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'initiator_database'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">DATABASE</SPAN> initiator_database<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">endpoints</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'service_broker_endpoint'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">ENDPOINT</SPAN> service_broker_endpoint<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">syslogins</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'domain_name\target_host$'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">LOGIN</SPAN> [domain_name\target_host$]<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO</SPAN><o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt" mce_keep="true">&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Script for dialog security sample.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This file is part of the Microsoft SQL Server Code Samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Copyright (C) Microsoft Corporation. All Rights reserved.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- This source code is intended only as a supplement to Microsoft<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Development Tools and/or on-line documentation. See these other<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- materials for detailed information regarding Microsoft code samples.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- PARTICULAR PURPOSE.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Clean up the target.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">-- Modify domain_name and initiator_host in script to suit configuration.</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>-- For simplicity, the dialog is terminated by dropping the database.<BR>-- The recommended method is for the initiator to inform the target<BR>-- with an "end of stream" message which causes the target to end the<BR>-- conversation.</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">master</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">databases</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'target_database'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">DATABASE</SPAN> target_database<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">endpoints</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'service_broker_endpoint'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">ENDPOINT</SPAN> service_broker_endpoint<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">syslogins</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'domain_name\initiator_host$'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">LOGIN</SPAN> [domain_name\initiator_host$]<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">GO</SPAN><o:p></o:p></P></FONT></FONT></o:p>]]></content:encoded>
    </item>
    <item>
      <title>Fast data push tuning</title>
      <link>https://review.docs.microsoft.com/archive/blogs/sql_service_broker/fast-data-push-tuning</link>
      <pubDate>Tue, 12 Aug 2008 15:30:00 GMT</pubDate>
      <dc:creator><![CDATA[portegys]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sql_service_broker/2008/08/12/fast-data-push-tuning/</guid>
      <description><![CDATA[A common use of service broker is the "data push" scenario in which messages are asynchronously...]]></description>
      <content:encoded><![CDATA[<SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 13.5pt">
<P><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 10pt">A common use of service broker is the "data push" scenario in which messages are asynchronously sent to a destination such as a data warehouse for storage and processing with minimal impact on the source application. Two frequent concerns are whether service broker can handle a proposed work load, and how to "tune" a broker application so that it can achieve the required performance. Since various applications impose different constraints and are hosted within differing computing and networking configurations, there is no "one size fits all" answer.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 10pt">
<P xmlns="">This sample offers a means of estimating the performance of a broker application and tuning it to suit a given load and configuration. The user does this by setting several application parameters, such as message volume, message size, and processing time, as well as several internal parameters, such as number of initiator transactions, number of dialogs, etc. On the initiator, the output is the time to send the specified number of messages and the time for the messages to be transmitted to the target. On the target, the output is the time to receive and process the messages, which allows the user to obtain an estimate of whether the initiator is overrunning the target, something to avoid for a sustained high volume message load.</P>
<P xmlns="">The sample also implements a number of recommended practices for using service broker, and can serve as an example of how to build the service broker part of a data push application. Of particular significance, it is recommended that batch messaging be done where possible. On the initiator side, this refers to sending messages on a set of "reusable" dialogs to avoid the overhead of creating a dialog per message. The dialog pool sample shows how to do this. On the target, batching refers to receiving a set of messages at a time, which can significantly improve performance.</P>
<P xmlns="">As an illustration of the effect of reusing dialogs,&nbsp;data pushes of 10000&nbsp;messages were&nbsp;performed from an initiator instance to a target. Each message&nbsp;was 1000 bytes. Two extreme cases were evaluated and compared. In the first case,&nbsp;a dialog was created for each message. In the second, all messages were sent under the same dialog.&nbsp;Performance was measured in terms of&nbsp;the time for the application to&nbsp;send all messages, the time for the messages to be transmitted to the target, and the time for the target to process the messages. The&nbsp;results show that the single dialog case is approximately&nbsp;ten times faster for all of these&nbsp;metrics.</P>
<P xmlns="">As mentioned for the above, these are "end of the continuum" cases. There are some trade-off considerations&nbsp;for using more or&nbsp;fewer dialogs.&nbsp;More dialogs can&nbsp;ease errror handling in the case of a dialog failure, for example, since fewer messages need recovery action. "Recycling" dialogs by periodically replacing dialogs in a shared pool is another way of minimizing the impact of dialog failures. This sample and the dialog pool sample show how recycling may be implemented. One of the major reasons to use more dialogs, however, it to achieve concurrent processing on the target. This is due to the fact that&nbsp;a dialog is associated with a conversation group lock&nbsp;which allows only a single&nbsp;receiving&nbsp;procedure on the target. Thus if all messages are in&nbsp;the same dialog,&nbsp;it will&nbsp;serialize message reception&nbsp;on the target.&nbsp;As an illustration of how more dialogs allow more target concurrency, again using the 10000 message data push, a processing time of 10ms per message is also imposed on the target. Using ten dialogs instead of one&nbsp;results&nbsp;in halving the total processing time on the target, with no&nbsp;significant impact on the sending times.</P>
<P xmlns="">The previous illustrations underscore the&nbsp;purpose of this sample: to allow a user to&nbsp;tune an application to&nbsp;achieve performance goals given a particular system and networking configuration.&nbsp;</P>
<P xmlns=""><STRONG>Parameters&nbsp;</STRONG></P>
<P xmlns="">----------------------------------------------------<BR>-- The data push parameters.<BR>--<BR>-- Application parameters:<BR>-- message_quantity: number of messages sent.<BR>-- message_size: size of message in bytes.<BR>-- message_processing_time: time for target to process a message.<BR>--&nbsp;&nbsp;&nbsp; Format: 'hh:mm:ss:xxx'&nbsp; hh=hours, mm=minutes, ss=seconds, xxx=milliseconds<BR>--<BR>-- Internal parameters:<BR>-- number_initiator_transactions: number of initiator transactions used.<BR>--&nbsp;&nbsp;&nbsp; Notes: 1. Fewer is more efficient since each transaction entails an overhead.<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2. Messages are actually sent when transaction commits, so sending a large<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; number of messages in a transaction can result in increased latency.<BR>-- initiator_transaction_delay: delay time between initiator transactions.<BR>--&nbsp;&nbsp;&nbsp; Format: 'hh:mm:ss:xxx'&nbsp; hh=hours, mm=minutes, ss=seconds, xxx=milliseconds<BR>--&nbsp;&nbsp;&nbsp; Notes: 1. A transaction can be thought of as a burst of message_quantity / <BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; number_initiator_transactions messages. This delay specifies a time<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to wait before the next transaction is run.<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2. This parameter can be used to simulate message traffic distributed<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; over time.<BR>-- number_dialogs: number of dialogs used to send messages.<BR>--&nbsp;&nbsp;&nbsp; Notes: 1. Message ordering only guaranteed with a dialog.<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2. Multiple dialogs allows concurrent processing on target.<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3. Dialog creation is expensive; dialog reuse is employed here.<BR>-- dialog_recycle_max_messages: maximum number messages sent on a dialog before<BR>--&nbsp;&nbsp;&nbsp; recycling the dialog. Recycling is defined as ending the old dialog and<BR>--&nbsp;&nbsp;&nbsp; beginning a new one. A value of -1 indicates no recycling.<BR>--&nbsp;&nbsp;&nbsp; Notes: 1. Larger is more efficient since is minimizes the overhead of<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; creating dialogs.<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2. Larger can complicate dialog error processing.<BR>-- number_target_procedures: number of activated target procedures to receive messages.<BR>--&nbsp;&nbsp;&nbsp; Notes: 1. A target proc locks all messages in a dialog when it receives first message<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for a dialog, blocking other procs from processing these messages.<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2. Thus more dialogs yields increased concurrent processing. However, unless<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dialog recycling is used, this should be set to number_dialogs, which<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; can utilize a target proc for each dialog.<BR>-- max_messages_per_receive: maximum number of messages per target receive call.<BR>--&nbsp;&nbsp;&nbsp; Notes: 1. Larger is more efficient, but can complicate transaction error processing.<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2. The maximum value can be set to message_quantity / number_dialogs.<BR>--<BR>-- Example:<BR>--<BR>-- I want to send 100000 messages in sets of 10000 with a delay of 10 seconds between<BR>-- each set. This calls for 10 transactions. Each message is 100 bytes and the target<BR>-- message processing time is 10 ms. The messages are independent of each other, so use<BR>-- 5 dialogs and target procedures to get some concurrent processing on the target. Allow<BR>-- each target proc to receive 2000 messages at a time. Do not recycle dialogs.<BR>--<BR>-- INSERT INTO data_push_parameters<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VALUES<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 100000,<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10000,<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '00:00:00:010',<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10,<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '00:00:10:000',<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5,<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -1,<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5,<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2000<BR>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<BR>--<BR>--&nbsp;</P>
<P class=heading><STRONG>Running the Sample</STRONG></P>
<DIV id=sectionSection1 class=section></ xmlns="https://ddue.schemas.microsoft.com/authoring/2003/5" ddue.schemas.microsoft.com authoring 2003 5:CONTENT>
<DIV class=section xmlns="">
<OL>
<LI>
<P xmlns="">This sample is normally run between two server instances on different machines using Windows transport security. However, it can easily be configured to perform a "loop around" data push in the same database by skipping the indicated sections of the initiator and target setup scripts. For the two server case, it is essential that the servers are configured to enable communication protocols. In this example, we will be using TCP, so use the SQL Server Configuration Manager to make sure TCP is enabled on both servers.</P>
<LI>
<P xmlns="">Edit the Common setup script and set the desired parameters. Make sure the edits are performed identically on both servers.</P>
<LI>
<P xmlns="">Run the scripts, in order:</P></LI>
<DL xmlns="">
<DT>Common setup (both servers).<BR><BR>Initiator setup.<BR><BR>Target setup.<BR><BR>Initiator send. The message sending start and end times are printed.<BR><BR>Target monitor. The message processing time is printed.<BR><BR>Cleanup. (both servers).</DT></DL></OL></DIV></DIV>
<P><STRONG>Scripts</STRONG><BR></P></SPAN></SPAN></SPAN>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p></o:p></SPAN></P><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN> 
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Script for fast data push sample.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This file is part of the Microsoft SQL Server Code Samples.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Copyright (C) Microsoft Corporation. All Rights reserved.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This source code is intended only as a supplement to Microsoft<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Development Tools and/or on-line documentation. See these other<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- materials for detailed information regarding Microsoft code samples.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- PARTICULAR PURPOSE.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">----------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Common setup for fast data push.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Before running, replace the configuration-dependent <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- domain_name and partner_host names.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">----------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">master</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">---------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Create the broker endpoint using Windows authentication.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- On a secure network, encryption may be disabled to improve speed:<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- (AUTHENTICATION = Windows, ENCRYPTION = DISABLED)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This step can be skipped if services are in the same database instance.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">---------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">*</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">endpoints</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'service_broker_endpoint'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DROP</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ENDPOINT</SPAN><FONT color=#000000> service_broker_endpoint</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ENDPOINT</SPAN><FONT color=#000000> service_broker_endpoint<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">STATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">STARTED<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">AS</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TCP </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">LISTENER_PORT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 4022</FONT><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">FOR</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SERVICE_BROKER </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">AUTHENTICATION</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">Windows</SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- A procedure to create a Windows login and grant it endpoint connection permission.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> tempdb</FONT><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">procedures</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: gray">LIKE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'#usp_windows_login_for_broker_endpoint%'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DROP</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">PROCEDURE</SPAN><FONT color=#000000> #usp_windows_login_for_broker_endpoint</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">PROCEDURE</SPAN><FONT color=#000000> #usp_windows_login_for_broker_endpoint</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@domain_name </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>100</FONT><SPAN style="COLOR: gray">),<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@login_name </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>50</FONT><SPAN style="COLOR: gray">),<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@endpoint_name </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>50</FONT><SPAN style="COLOR: gray">))<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">AS<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">BEGIN<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">NOCOUNT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ON</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @query </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>1000</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Create the login.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @query </FONT><SPAN style="COLOR: gray">=<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: red">'IF EXISTS (SELECT * FROM sys.syslogins WHERE name = '''</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> @domain_name </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'\'</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> @login_name </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">''')<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>DROP LOGIN ['</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> @domain_name </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'\'</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> @login_name </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">']'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">EXEC </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@query</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @query </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'CREATE LOGIN ['</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> @domain_name </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'\'</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> @login_name </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'] FROM Windows'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">EXEC </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@query</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Grant the login connection access to the endpoint.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @query </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'GRANT CONNECT ON ENDPOINT::'</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> @endpoint_name </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">' TO ['</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> @domain_name </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'\'</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> @login_name </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">']'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">EXEC </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@query</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">END</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Create a login for the partner machine (partner_host) in the<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- shared domain (domain_name) and grant it endpoint connection permission.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This assumes the availability of Kerberos authentication.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Note: the '$' is significant.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">EXEC</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> #usp_windows_login_for_broker_endpoint</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">'domain_name'</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'partner_host$'</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'service_broker_endpoint'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">---------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Create the data push database.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">---------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">*</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">databases</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'data_push_database'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DROP</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">DATABASE</SPAN><FONT color=#000000> data_push_database</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">DATABASE</SPAN><FONT color=#000000> data_push_database</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> data_push_database</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Create messages and contract.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">MESSAGE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TYPE</SPAN><FONT color=#000000> data_push_message VALIDATION </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">NONE</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">MESSAGE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TYPE</SPAN><FONT color=#000000> end_of_stream</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CONTRACT</SPAN><FONT color=#000000> data_push_contract<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>data_push_message SENT </FONT><SPAN style="COLOR: blue">BY</SPAN><FONT color=#000000> INITIATOR</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>end_of_stream SENT </FONT><SPAN style="COLOR: blue">BY</SPAN><FONT color=#000000> INITIATOR<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">----------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- The data push parameters.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Application parameters:<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- message_quantity: number of messages sent.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- message_size: size of message in bytes.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- message_processing_time: time for target to process a message.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>Format: 'hh:mm:ss:xxx'<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>hh=hours, mm=minutes, ss=seconds, xxx=milliseconds<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Internal parameters:<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- number_initiator_transactions: number of initiator transactions used.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>Notes: 1. Fewer is more efficient since each transaction entails an overhead.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>2. Messages are actually sent when transaction commits, so sending a large<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>number of messages in a transaction can result in increased latency.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- initiator_transaction_delay: delay time between initiator transactions.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>Format: 'hh:mm:ss:xxx'<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>hh=hours, mm=minutes, ss=seconds, xxx=milliseconds<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>Notes: 1. A transaction can be thought of as a burst of message_quantity / <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>number_initiator_transactions messages. This delay specifies a time<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>to wait before the next transaction is run.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>2. This parameter can be used to simulate message traffic distributed<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>over time.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- number_dialogs: number of dialogs used to send messages.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>Notes: 1. Message ordering only guaranteed with a dialog.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>2. Multiple dialogs allows concurrent processing on target.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>3. Dialog creation is expensive; dialog reuse is employed here.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- dialog_recycle_max_messages: maximum number messages sent on a dialog before<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>recycling the dialog. Recycling is defined as ending the old dialog and<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>beginning a new one. A value of -1 indicates no recycling.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>Notes: 1. Larger is more efficient since is minimizes the overhead of<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>creating dialogs.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>2. Larger can complicate dialog error processing.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- number_target_procedures: number of activated target procedures to receive messages.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>Notes: 1. A target proc locks all messages in a dialog when it receives first message<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>for a dialog, blocking other procs from processing these messages.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>2. Thus more dialogs yields increased concurrent processing. However, unless<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>dialog recycling is used, this should be set to number_dialogs, which<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>can utilize a target proc for each dialog.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- max_messages_per_receive: maximum number of messages per target receive call.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>Notes: 1. Larger is more efficient, but can complicate transaction error processing.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>2. The maximum value can be set to message_quantity / number_dialogs.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- General note: for simplicity, @message_quantity should be evenly divisible<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- by @number_initiator_transactions x @number_dialogs, since this allows a<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- constant number of messages to be sent per dialog per transaction. "Remainder"<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- messages will not be sent to the target.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Example:<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- I want to send 100000 messages in sets of 10000 with a delay of 10 seconds between<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- each set. This calls for 10 transactions. Each message is 100 bytes and the target<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- message processing time is 10 ms. The messages are independent of each other, so use<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- 5 dialogs and target procedures to get some concurrent processing on the target. Allow<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- each target proc to receive 2000 messages at a time. Do not recycle dialogs.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- INSERT INTO data_push_parameters<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>VALUES<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>100000,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>10000,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>'00:00:00:010',<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>10,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>'00:00:10:000',<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;</SPAN>5,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>-1,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>5,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>2000<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TABLE</SPAN><FONT color=#000000> data_push_parameters</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>message_quantity </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NOT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>message_size </FONT><SPAN style="COLOR: blue">INT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NOT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>message_processing_time </FONT><SPAN style="COLOR: blue">CHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>12</FONT><SPAN style="COLOR: gray">)</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NOT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>number_initiator_transactions </FONT><SPAN style="COLOR: blue">INT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NOT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>initiator_transaction_delay </FONT><SPAN style="COLOR: blue">CHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>12</FONT><SPAN style="COLOR: gray">)</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NOT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>number_dialogs </FONT><SPAN style="COLOR: blue">INT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NOT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>dialog_recycle_max_messages </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NOT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>number_target_procedures </FONT><SPAN style="COLOR: blue">INT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NOT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>max_messages_per_receive </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NOT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Insert parameter values.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">TRUNCATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TABLE</SPAN><FONT color=#000000> data_push_parameters</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">INSERT</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> data_push_parameters<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>message_quantity</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>message_size</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>message_processing_time</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>number_initiator_transactions</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>initiator_transaction_delay</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>number_dialogs</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>dialog_recycle_max_messages</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>number_target_procedures</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>max_messages_per_receive<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">VALUES<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>10000</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>1000</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: red">'00:00:00:000'</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>1</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: red">'00:00:00:000'</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>1</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: gray">-</SPAN><FONT color=#000000>1</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>1</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>1000<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Check parameters.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">DECLARE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @message_quantity </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">DECLARE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @number_initiator_transactions </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">DECLARE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @number_dialogs </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">DECLARE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @i </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">DECLARE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @string </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>50</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SET</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @message_quantity </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> message_quantity </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> data_push_parameters</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SET</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @number_initiator_transactions </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> number_initiator_transactions </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> data_push_parameters</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SET</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @number_dialogs </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> number_dialogs </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> data_push_parameters</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SET</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @i </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @message_quantity </FONT><SPAN style="COLOR: gray">/</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@number_dialogs </FONT><SPAN style="COLOR: gray">*</SPAN><FONT color=#000000> @number_initiator_transactions</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SET</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @i </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @i </FONT><SPAN style="COLOR: gray">*</SPAN><FONT color=#000000> @number_dialogs </FONT><SPAN style="COLOR: gray">*</SPAN><FONT color=#000000> @number_initiator_transactions</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @message_quantity </FONT><SPAN style="COLOR: gray">&gt;</SPAN><FONT color=#000000> @i<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">BEGIN<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @i </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @message_quantity </FONT><SPAN style="COLOR: gray">-</SPAN><FONT color=#000000> @i</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @string </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">CAST</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000> @i </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>50</FONT><SPAN style="COLOR: gray">)));<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">PRINT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'Warning: @message_quantity is not evenly divisible by @number_dialogs * @number_initiator_transactions'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">PRINT</SPAN><FONT color=#000000> @string </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">' messages will not be sent to the target'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">END</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT color=#000000 size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Script for fast data push sample.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This file is part of the Microsoft SQL Server Code Samples.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Copyright (C) Microsoft Corporation. All Rights reserved.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This source code is intended only as a supplement to Microsoft<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Development Tools and/or on-line documentation. See these other<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- materials for detailed information regarding Microsoft code samples.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- PARTICULAR PURPOSE.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">----------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Initiator setup for fast data push.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Before running, customize the configuration-dependent<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- routing to the target service.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">----------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> data_push_database</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- The data push procedure: send messages to target.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">PROCEDURE</SPAN><FONT color=#000000> usp_data_push<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">AS<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">BEGIN<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">NOCOUNT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ON</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Get initiator parameters.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @message_quantity </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @message_size </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @number_initiator_transactions </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @initiator_transaction_delay </FONT><SPAN style="COLOR: blue">CHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>12</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @number_dialogs </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @dialog_recycle_max_messages </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @message_quantity </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> message_quantity </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> data_push_parameters</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @message_size </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> message_size </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> data_push_parameters</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @number_initiator_transactions </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> number_initiator_transactions </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> data_push_parameters</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @initiator_transaction_delay </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> initiator_transaction_delay </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> data_push_parameters</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @number_dialogs </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> number_dialogs </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> data_push_parameters</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @dialog_recycle_max_messages </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> dialog_recycle_max_messages </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> data_push_parameters</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Create a message payload of the requested size.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @payload </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: fuchsia">MAX</SPAN><SPAN style="COLOR: gray">);</SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="COLOR: gray"><o:p>&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @char </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: fuchsia">MAX</SPAN><SPAN style="COLOR: gray">);</SPAN></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="COLOR: gray"><o:p><SPAN style="COLOR: gray">&nbsp;&nbsp;&nbsp; <FONT color=#0000ff>SET</FONT><FONT size=2> <FONT color=#000000>@char </FONT></FONT><FONT color=#808080 size=2><FONT color=#808080 size=2>=</FONT></FONT><FONT size=2> </FONT><FONT color=#ff0000 size=2><FONT color=#ff0000 size=2>'0'</FONT></FONT><FONT color=#808080 size=2><FONT color=#808080 size=2>;</FONT></FONT></SPAN></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> @payload </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">REPLICATE</SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: red"><FONT color=#000000>@char</FONT></SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @message_size</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes"><FONT color=#808080 size=2><FONT color=#808080 size=2>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal></FONT></FONT>&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Loop controls.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @messages_per_transaction </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @messages_per_dialog_transaction </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @transaction_counter </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @message_counter </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Compute messages to send per dialog per transaction:<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- @message_quantity / (@number_initiator_transactions x @number_dialogs)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Note that integer arithmetic may result in "remainder" messages that will not<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- be sent.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @messages_per_transaction </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @message_quantity </FONT><SPAN style="COLOR: gray">/</SPAN><FONT color=#000000> @number_initiator_transactions</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @messages_per_dialog_transaction </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @messages_per_transaction </FONT><SPAN style="COLOR: gray">/</SPAN><FONT color=#000000> @number_dialogs</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Error variables.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_number </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_message </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>4000</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Show start time.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">GETDATE</SPAN><SPAN style="COLOR: gray">()</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'Start sending'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Create a table containing requested number of dialogs.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @dialogs </FONT><SPAN style="COLOR: blue">TABLE </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>idx </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> handle </FONT><SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> recycle_counter </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @idx </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @handle </FONT><SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @recycle_counter </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @idx </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WHILE</SPAN><FONT color=#000000> @idx </FONT><SPAN style="COLOR: gray">&lt;</SPAN><FONT color=#000000> @number_dialogs<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> DIALOG </FONT><SPAN style="COLOR: blue">CONVERSATION</SPAN><FONT color=#000000> @handle<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SERVICE</SPAN><FONT color=#000000> initiator_service<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">TO</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SERVICE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'target_service'<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ON</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CONTRACT</SPAN><FONT color=#000000> data_push_contract<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WITH</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ENCRYPTION</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">OFF</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">INSERT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> @dialogs</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>idx</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> handle</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> recycle_counter</FONT><SPAN style="COLOR: gray">)</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">VALUES </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@idx</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @handle</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @idx </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @idx </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Loop through transactions.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @transaction_counter </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WHILE</SPAN><FONT color=#000000> @transaction_counter </FONT><SPAN style="COLOR: gray">&lt;</SPAN><FONT color=#000000> @number_initiator_transactions<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Loop through dialogs.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @idx </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WHILE</SPAN><FONT color=#000000> @idx </FONT><SPAN style="COLOR: gray">&lt;</SPAN><FONT color=#000000> @number_dialogs<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Send a batch of messages for dialog.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @handle </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> handle </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> @dialogs </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> idx </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @idx</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @recycle_counter </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> recycle_counter </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> @dialogs </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> idx </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @idx</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @message_counter </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WHILE</SPAN><FONT color=#000000> @message_counter </FONT><SPAN style="COLOR: gray">&lt;</SPAN><FONT color=#000000> @messages_per_dialog_transaction<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Time to recycle dialog?<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> @dialog_recycle_max_messages </FONT><SPAN style="COLOR: gray">&lt;&gt;</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">-</SPAN><FONT color=#000000>1 </FONT><SPAN style="COLOR: gray">AND</SPAN><FONT color=#000000> <o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@recycle_counter </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @dialog_recycle_max_messages<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Inform target to end dialog.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SEND</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ON</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CONVERSATION</SPAN><FONT color=#000000> @handle </FONT><SPAN style="COLOR: blue">MESSAGE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TYPE</SPAN><FONT color=#000000> end_of_stream</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Replace the current dialog.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> DIALOG </FONT><SPAN style="COLOR: blue">CONVERSATION</SPAN><FONT color=#000000> @handle<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SERVICE</SPAN><FONT color=#000000> initiator_service<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">TO</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SERVICE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'target_service'<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ON</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CONTRACT</SPAN><FONT color=#000000> data_push_contract<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WITH</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ENCRYPTION</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">OFF</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">UPDATE</SPAN><FONT color=#000000> @dialogs </FONT><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> handle </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @handle </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> idx </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @idx</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @recycle_counter </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Send a message.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRY<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;</SPAN></FONT><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SEND</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ON</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CONVERSATION</SPAN><FONT color=#000000> @handle </FONT><SPAN style="COLOR: blue">MESSAGE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TYPE</SPAN><FONT color=#000000> data_push_message</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@payload</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> @dialog_recycle_max_messages </FONT><SPAN style="COLOR: gray">&lt;&gt;</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">-</SPAN><FONT color=#000000>1<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @recycle_counter </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @recycle_counter </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @message_counter </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @message_counter </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRY<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CATCH<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_number </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_NUMBER</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_message </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_MESSAGE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Dialog is faulty?<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @dialog_error </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @dialog_error </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;</SPAN></FONT><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @dialog_state </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>2</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @dialog_state </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">state</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">conversation_endpoints<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">conversation_handle</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @handle</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">@@ROWCOUNT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 1<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Good dialog is starting or conversing.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> @dialog_state </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'SO'</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">OR</SPAN><FONT color=#000000> @dialog_state </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'CO'<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @dialog_error </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> @dialog_error </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 1<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Record the error.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">INSERT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> initiator_processing_errors </FONT><SPAN style="COLOR: blue">VALUES</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@handle</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_number</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_message</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Replace dialog and continue sending.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> DIALOG </FONT><SPAN style="COLOR: blue">CONVERSATION</SPAN><FONT color=#000000> @handle<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SERVICE</SPAN><FONT color=#000000> initiator_service<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">TO</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SERVICE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'target_service'<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ON</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CONTRACT</SPAN><FONT color=#000000> data_push_contract<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WITH</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ENCRYPTION</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">OFF</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">UPDATE</SPAN><FONT color=#000000> @dialogs </FONT><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> handle </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @handle </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> idx </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @idx</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @recycle_counter </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ELSE<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></FONT><SPAN style="COLOR: green">-- Record the error and return error.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">INSERT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> initiator_processing_errors </FONT><SPAN style="COLOR: blue">VALUES</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@handle</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_number</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_message</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">RETURN</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CATCH<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">UPDATE</SPAN><FONT color=#000000> @dialogs </FONT><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> recycle_counter </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @recycle_counter </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> idx </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @idx</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @idx </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @idx </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">COMMIT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @transaction_counter </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @transaction_counter </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Wait for next transaction.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> @transaction_counter </FONT><SPAN style="COLOR: gray">&lt;</SPAN><FONT color=#000000> @number_initiator_transactions<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WAITFOR</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">DELAY</SPAN><FONT color=#000000> @initiator_transaction_delay</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Gracefully end dialogs by informing target.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @idx </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WHILE</SPAN><FONT color=#000000> @idx </FONT><SPAN style="COLOR: gray">&lt;</SPAN><FONT color=#000000> @number_dialogs<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @handle </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> handle </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> @dialogs </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> idx </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @idx</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SEND</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ON</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CONVERSATION</SPAN><FONT color=#000000> @handle </FONT><SPAN style="COLOR: blue">MESSAGE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TYPE</SPAN><FONT color=#000000> end_of_stream</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @idx </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @idx </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">COMMIT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Show end time.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">GETDATE</SPAN><SPAN style="COLOR: gray">()</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'End sending'</SPAN><SPAN style="COLOR: gray">;</SPAN><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p><FONT color=#000000>&nbsp;</FONT></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">RETURN</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">END</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Resends all pending messages in sys.transmission_queue<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- belonging to an old colversation on a new conversation.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">PROCEDURE</SPAN><FONT color=#000000> usp_resend_pending</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@old_handle </FONT><SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">AS<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">BEGIN</SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">NOCOUNT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ON</SPAN><SPAN style="COLOR: gray">;</SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="COLOR: gray"><o:p></o:p></SPAN><o:p></o:p></SPAN>&nbsp;</P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @message_type_name </FONT><SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @message_body </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: fuchsia">MAX</SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Get a new dialog.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @handle </FONT><SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> DIALOG </FONT><SPAN style="COLOR: blue">CONVERSATION</SPAN><FONT color=#000000> @handle<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SERVICE</SPAN><FONT color=#000000> initiator_service<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">TO</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SERVICE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'target_service'<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ON</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CONTRACT</SPAN><FONT color=#000000> data_push_contract<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WITH</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ENCRYPTION</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">OFF</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Declare a cursor to iterate over all the pending messages.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- It is important to keep the message order and to keep the original message type.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> cursor_pending </FONT><SPAN style="COLOR: blue">CURSOR</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">LOCAL</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FORWARD_ONLY</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">READ_ONLY<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">FOR</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> message_type_name</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> message_body<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">transmission_queue<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">conversation_handle</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @old_handle<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ORDER</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">BY</SPAN><FONT color=#000000> message_sequence_number</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">OPEN</SPAN><FONT color=#000000> cursorPending</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">FETCH</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">NEXT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> cursor_pending </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> @message_type_name</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @message_body</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WHILE </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: fuchsia">@@FETCH_STATUS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Resend the message on the new conversation<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SEND</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ON</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CONVERSATION</SPAN><FONT color=#000000> @handle </FONT><SPAN style="COLOR: blue">MESSAGE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TYPE</SPAN><FONT color=#000000> @message_type_name</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@message_body</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">FETCH</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">NEXT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> cursor_pending </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> @message_type_name</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @message_body</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">CLOSE</SPAN><FONT color=#000000> cursor_pending</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DEALLOCATE</SPAN><FONT color=#000000> cursor_pending</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Signal end of stream to target.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SEND</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ON</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CONVERSATION</SPAN><FONT color=#000000> @handle </FONT><SPAN style="COLOR: blue">MESSAGE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TYPE</SPAN><FONT color=#000000> end_of_stream</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">END</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Activated store proc for the initiator to receive messages.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Dialogs are gracefully ended by the target after receiving<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- an end_of_stream message from the initiator; the end dialog<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- message is then processed here. This method is recommended<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- to avoid "fire and forget" message loss. One message per<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- invocation is OK here for expected low-volume load.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">PROCEDURE</SPAN><FONT color=#000000> initiator_queue_activated_procedure<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">AS<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">BEGIN</SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">NOCOUNT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ON</SPAN><SPAN style="COLOR: gray">;</SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="COLOR: gray"></SPAN><o:p></o:p></SPAN>&nbsp;</P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @conversation_handle </FONT><SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@message_type_name </FONT><SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@message_body </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: fuchsia">MAX</SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Error variables.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_number </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_message </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>4000</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_severity </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_state </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_procedure </FONT><SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_line </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRY<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Wait 5 seconds for a message.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WAITFOR </SPAN><SPAN style="COLOR: gray">(<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">RECEIVE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TOP</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>1</FONT><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@conversation_handle </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">conversation_handle</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@message_type_name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> message_type_name</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@message_body </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> message_body<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> initiator_queue</FONT><SPAN style="COLOR: gray">),</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TIMEOUT</SPAN><FONT color=#000000> 5000</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">@@ROWCOUNT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 1<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> @message_type_name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'https://schemas.microsoft.com/SQL/ServiceBroker/EndDialog'<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Target is ending dialog normally.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CONVERSATION</SPAN><FONT color=#000000> @conversation_handle</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ELSE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> @message_type_name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'https://schemas.microsoft.com/SQL/ServiceBroker/Error'<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Record the error.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WITH</SPAN><FONT color=#000000> XMLNAMESPACES</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: red">'https://schemas.microsoft.com/SQL/ServiceBroker/Error'</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> ssb</FONT><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SELECT<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_number </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">CAST</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@message_body </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">XML</SPAN><SPAN style="COLOR: gray">).</SPAN><FONT color=#000000>value</FONT><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: red">'(//ssb:Error/ssb:Code)[1]'</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'INT'</SPAN><SPAN style="COLOR: gray">),<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_message </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">CAST</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@message_body </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">XML</SPAN><SPAN style="COLOR: gray">).</SPAN><FONT color=#000000>value</FONT><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: red">'(//ssb:Error/ssb:Description)[1]'</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'VARCHAR(4000)'</SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">INSERT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> initiator_processing_errors </FONT><SPAN style="COLOR: blue">VALUES</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@conversation_handle</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_number</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_message</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Can messages be resent?<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@error_number </FONT><SPAN style="COLOR: gray">IN</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(-</SPAN><FONT color=#000000>8489</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">-</SPAN><FONT color=#000000>8462</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">-</SPAN><FONT color=#000000>9719</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">-</SPAN><FONT color=#000000>28052</FONT><SPAN style="COLOR: gray">))<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Resend the messages on a new dialog.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">EXEC</SPAN><FONT color=#000000> usp_resend_pending</FONT><SPAN style="COLOR: blue"> </SPAN><FONT color=#000000>@conversation_handle</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ELSE<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Save the messages in a side table to be processed later.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">INSERT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> unsent_messages<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> message_type_name</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> message_body </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">transmission_queue<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">conversation_handle</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @conversation_handle</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- End the conversation.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CONVERSATION</SPAN><FONT color=#000000> @conversation_handle</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">COMMIT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRY<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CATCH<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_number </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_NUMBER</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_message </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_MESSAGE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_severity </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_SEVERITY</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_state </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_STATE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_procedure </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_PROCEDURE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_line </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_LINE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">XACT_STATE</SPAN><SPAN style="COLOR: gray">()</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">-</SPAN><FONT color=#000000>1<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- The transaction is doomed. Only rollback possible.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Note: 5 consecutive rollbacks will disable the queue!<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ROLLBACK</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;</SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Record the error.</SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="COLOR: green"><o:p><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">INSERT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> initiator_processing_errors </FONT><SPAN style="COLOR: blue">VALUES</SPAN><SPAN style="COLOR: gray">(NULL,</SPAN><FONT color=#000000> @error_number</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_message</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_severity</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_state</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_procedure</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_line</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">COMMIT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ELSE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">XACT_STATE</SPAN><SPAN style="COLOR: gray">()</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 1<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Record error and commit transaction.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">INSERT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> initiator_processing_errors </FONT><SPAN style="COLOR: blue">VALUES</SPAN><SPAN style="COLOR: gray">(NULL,</SPAN><FONT color=#000000> @error_number</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_message</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_severity</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_state</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_procedure</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_line</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">COMMIT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CATCH<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">END</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Create the initiator queue with activated procedure.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">QUEUE</SPAN><FONT color=#000000> initiator_queue<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WITH</SPAN><FONT color=#000000> ACTIVATION</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">STATUS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ON</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>MAX_QUEUE_READERS </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>PROCEDURE_NAME </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> initiator_queue_activated_procedure</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">EXECUTE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">OWNER</SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Create initiator service.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SERVICE</SPAN><FONT color=#000000> initiator_service </FONT><SPAN style="COLOR: blue">ON</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">QUEUE</SPAN><FONT color=#000000> initiator_queue</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>data_push_contract</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Any user can send on the service.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GRANT</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SEND</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ON</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SERVICE</SPAN><SPAN style="COLOR: gray">::</SPAN><FONT color=#000000>initiator_service </FONT><SPAN style="COLOR: blue">TO</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">PUBLIC</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This table stores unsent messages.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">tables</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'unsent_messages'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DROP</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TABLE</SPAN><FONT color=#000000> unsent_messages</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TABLE</SPAN><FONT color=#000000> unsent_messages</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000> message_type_name </FONT><SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> message_body </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: fuchsia">MAX</SPAN><SPAN style="COLOR: gray">)</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Table to store processing errors.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">tables</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'initiator_processing_errors'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DROP</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TABLE</SPAN><FONT color=#000000> initiator_processing_errors</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TABLE</SPAN><FONT color=#000000> initiator_processing_errors</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>error_conversation </FONT><SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">error_number</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: fuchsia">error_message</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>4000</FONT><SPAN style="COLOR: gray">),</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">error_severity</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">error_state</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">error_procedure</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SYSNAME</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: fuchsia">error_line</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> doomed_transaction </FONT><SPAN style="COLOR: blue">TINYINT</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">---------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Routing.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Skip the following if services are in the same database instance.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">---------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Create a route to the target service.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ROUTE</SPAN><FONT color=#000000> target_route<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WITH</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SERVICE_NAME</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'target_service'</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ADDRESS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'tcp://target_host:4022'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- In msdb, create an incoming route to the initiator service.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> msdb</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ROUTE</SPAN><FONT color=#000000> initiator_route<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WITH</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SERVICE_NAME</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'initiator_service'</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ADDRESS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'local'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> data_push_database</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT color=#000000 size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT color=#000000 size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Script for fast data push sample.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This file is part of the Microsoft SQL Server Code Samples.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Copyright (C) Microsoft Corporation. All Rights reserved.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This source code is intended only as a supplement to Microsoft<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Development Tools and/or on-line documentation. See these other<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- materials for detailed information regarding Microsoft code samples.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- PARTICULAR PURPOSE.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">----------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Target setup for fast data push.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Before running, customize the configuration-dependent<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- routing to the initiator service.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">----------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Poison message processing:<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Although this should not occur here because messages are not<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- processed in any significant way, there are times that<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- an application might find itself temporarily unable to process<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- a message. The temptation is then to roll back the receive<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- transaction and try again. The danger of doing this is that <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- 5 consecutive roll backs on a queue will disable it.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- If a queue does become disabled, possibly due to a doomed<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- transaction, a BROKER_QUEUE_DISABLED event notification can<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- be used as a recovery mechanism. You can also use the TRY-CATCH<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- construct to process transaction errors as shown below.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> data_push_database</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Activated store proc for the target to receive messages.<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">PROCEDURE</SPAN><FONT color=#000000> target_queue_activated_procedure<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">AS<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">BEGIN</SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">NOCOUNT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ON</SPAN><SPAN style="COLOR: gray">;</SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="COLOR: gray"></SPAN><o:p></o:p></SPAN>&nbsp;</P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Variable table for received messages.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @receive_table </FONT><SPAN style="COLOR: blue">TABLE</SPAN><SPAN style="COLOR: gray">(<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>queuing_order </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">conversation_handle</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>message_type_name </FONT><SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>message_body </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: fuchsia">MAX</SPAN><SPAN style="COLOR: gray">));<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Cursor for received message table.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> message_cursor </FONT><SPAN style="COLOR: blue">CURSOR</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">LOCAL</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FORWARD_ONLY</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">READ_ONLY<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">FOR</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SELECT<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">conversation_handle</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>message_type_name</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>message_body<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> @receive_table </FONT><SPAN style="COLOR: blue">ORDER</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">BY</SPAN><FONT color=#000000> queuing_order</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @conversation_handle </FONT><SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@message_type_name </FONT><SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@message_body </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: fuchsia">MAX</SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Count processed messages.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @message_counter </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @message_counter </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Error variables.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_number </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_message </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>4000</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_severity </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_state </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_procedure </FONT><SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_line </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Get target parameters.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @message_processing_time </FONT><SPAN style="COLOR: blue">CHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>12</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @message_processing_time </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> message_processing_time </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> data_push_parameters</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @max_messages_per_receive </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @max_messages_per_receive </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> max_messages_per_receive </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> data_push_parameters</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Receive messages for available conversation groups.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRY<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WHILE </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>1</FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000>1</FONT><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Receive max available messages into the table.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Wait 5 seconds for messages.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WAITFOR </SPAN><SPAN style="COLOR: gray">(<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><SPAN style="COLOR: blue">RECEIVE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TOP</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@max_messages_per_receive</FONT><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;</SPAN>queuing_order</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;</SPAN></FONT><SPAN style="COLOR: blue">conversation_handle</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;</SPAN>message_type_name</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;</SPAN>message_body<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> target_queue<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> @receive_table<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: gray">),</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TIMEOUT</SPAN><FONT color=#000000> 5000</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">@@ROWCOUNT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 0<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">COMMIT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BREAK</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Process the messages.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">OPEN</SPAN><FONT color=#000000> message_cursor</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WHILE </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>1</FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000>1</FONT><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">FETCH</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">NEXT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> message_cursor<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> @conversation_handle</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>@message_type_name</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>@message_body</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: fuchsia">@@FETCH_STATUS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">!=</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">)</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">BREAK</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Process a message.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- If an exception occurs, catch and attempt to recover.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRY<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> @message_type_name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'data_push_message'<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Process the message for the specified amount of time.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WAITFOR</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">DELAY</SPAN><FONT color=#000000> @message_processing_time</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @message_counter </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @message_counter </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ELSE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> @message_type_name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'end_of_stream'<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Initiator is signaling end of message stream: end the dialog.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CONVERSATION</SPAN><FONT color=#000000> @conversation_handle</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ELSE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> @message_type_name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'https://schemas.microsoft.com/SQL/ServiceBroker/Error'<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- If the message_type_name indicates that the message is an error,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- record the error and end the conversation.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WITH</SPAN><FONT color=#000000> XMLNAMESPACES</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: red">'https://schemas.microsoft.com/SQL/ServiceBroker/Error'</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> ssb</FONT><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SELECT<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_number </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">CAST</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@message_body </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">XML</SPAN><SPAN style="COLOR: gray">).</SPAN><FONT color=#000000>value</FONT><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: red">'(//ssb:Error/ssb:Code)[1]'</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'INT'</SPAN><SPAN style="COLOR: gray">),<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_message </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">CAST</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@message_body </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">XML</SPAN><SPAN style="COLOR: gray">).</SPAN><FONT color=#000000>value</FONT><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: red">'(//ssb:Error/ssb:Description)[1]'</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'VARCHAR(4000)'</SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">INSERT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> target_processing_errors </FONT><SPAN style="COLOR: blue">VALUES</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@conversation_handle</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_number</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_message</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></FONT><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CONVERSATION</SPAN><FONT color=#000000> @conversation_handle</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRY<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CATCH<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_number </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_NUMBER</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_message </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_MESSAGE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></FONT><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_severity </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_SEVERITY</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_state </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_STATE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_procedure </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_PROCEDURE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_line </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_LINE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">XACT_STATE</SPAN><SPAN style="COLOR: gray">()</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">-</SPAN><FONT color=#000000>1<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- The transaction is doomed. Only rollback possible.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- This could disable the queue if done 5 times consecutively!<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ROLLBACK</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Record the error.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">INSERT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> target_processing_errors </FONT><SPAN style="COLOR: blue">VALUES</SPAN><SPAN style="COLOR: gray">(NULL,</SPAN><FONT color=#000000> @error_number</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_message</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_severity</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_state</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_procedure</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_line</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">COMMIT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- For this level of error, it is best to exit the proc<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- and give the queue monitor control.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Breaking to the outer catch will accomplish this.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">RAISERROR </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: red">'Message processing error'</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> 16</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ELSE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">XACT_STATE</SPAN><SPAN style="COLOR: gray">()</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 1<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Record error and continue processing messages.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Failing message could also be put aside for later processing here.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Otherwise it will be discarded.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">INSERT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> target_processing_errors </FONT><SPAN style="COLOR: blue">VALUES</SPAN><SPAN style="COLOR: gray">(NULL,</SPAN><FONT color=#000000> @error_number</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_message</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_severity</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_state</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_procedure</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_line</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CATCH<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">CLOSE</SPAN><FONT color=#000000> message_cursor</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DELETE</SPAN><FONT color=#000000> @receive_table</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">COMMIT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRY<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CATCH<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Process the error and exit the proc to give the queue monitor control<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_number </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_NUMBER</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_message </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_MESSAGE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_severity </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_SEVERITY</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_state </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_STATE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_procedure </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_PROCEDURE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_line </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_LINE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">XACT_STATE</SPAN><SPAN style="COLOR: gray">()</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">-</SPAN><FONT color=#000000>1<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- The transaction is doomed. Only rollback possible.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- This could disable the queue if done 5 times consecutively!<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ROLLBACK</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Record the error.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">INSERT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> target_processing_errors </FONT><SPAN style="COLOR: blue">VALUES</SPAN><SPAN style="COLOR: gray">(NULL,</SPAN><FONT color=#000000> @error_number</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_message</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_severity</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_state</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_procedure</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_line</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">COMMIT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ELSE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">XACT_STATE</SPAN><SPAN style="COLOR: gray">()</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 1<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Record error and commit transaction.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Here you could also save anything else you want before exiting.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">INSERT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> target_processing_errors </FONT><SPAN style="COLOR: blue">VALUES</SPAN><SPAN style="COLOR: gray">(NULL,</SPAN><FONT color=#000000> @error_number</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_message</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_severity</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_state</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_procedure</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_line</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">COMMIT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CATCH<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Increment processed message counter.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @counter </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @counter </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TOP</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>1</FONT><SPAN style="COLOR: gray">)</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">counter</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> target_message_counter</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @counter </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @counter </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> @message_counter</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">UPDATE</SPAN><FONT color=#000000> target_message_counter </FONT><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">counter</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @counter</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">COMMIT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">END</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO</SPAN></o:p></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Get number of activated target procedures parameter.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">DECLARE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @number_target_procedures </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SET</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @number_target_procedures </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> number_target_procedures </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> data_push_parameters</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Create the target queue with specified number of activated procedures.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">DECLARE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @query </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>500</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">DECLARE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @string </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>50</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SET</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @string </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">CAST</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000> @number_target_procedures </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>50</FONT><SPAN style="COLOR: gray">)));<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SET</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @query </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'CREATE QUEUE target_queue<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>WITH ACTIVATION (<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>STATUS = ON,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>MAX_QUEUE_READERS = '</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> @string </FONT><SPAN style="COLOR: gray">+</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">',<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>PROCEDURE_NAME = target_queue_activated_procedure,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>EXECUTE AS OWNER)'</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">EXEC </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">(</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000>@query</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Create target service.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SERVICE</SPAN><FONT color=#000000> target_service </FONT><SPAN style="COLOR: blue">ON</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">QUEUE</SPAN><FONT color=#000000> target_queue</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>data_push_contract</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Any user can send on the service.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GRANT</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SEND</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ON</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SERVICE</SPAN><SPAN style="COLOR: gray">::</SPAN><FONT color=#000000>target_service </FONT><SPAN style="COLOR: blue">TO</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">PUBLIC</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Table to count processed messages.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">tables</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'target_message_counter'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DROP</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TABLE</SPAN><FONT color=#000000> message_counter</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TABLE</SPAN><FONT color=#000000> target_message_counter</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">counter</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NOT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">INSERT</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> target_message_counter </FONT><SPAN style="COLOR: blue">VALUES </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>0</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Table to store processing errors.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">tables</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'target_processing_errors'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DROP</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TABLE</SPAN><FONT color=#000000> target_processing_errors</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TABLE</SPAN><FONT color=#000000> target_processing_errors</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>error_conversation </FONT><SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">error_number</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: fuchsia">error_message</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>4000</FONT><SPAN style="COLOR: gray">),</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">error_severity</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">error_state</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">error_procedure</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SYSNAME</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: fuchsia">error_line</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> doomed_transaction </FONT><SPAN style="COLOR: blue">TINYINT</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">---------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Get size of a message queue.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Method used is faster than SQL count operator.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">---------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">PROCEDURE</SPAN><FONT color=#000000> usp_get_queue_size</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000> @queue_name </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>50</FONT><SPAN style="COLOR: gray">)</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">AS<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">BEGIN<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> p</FONT><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: blue">rows<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">objects</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> o<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: gray">JOIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">partitions</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> p </FONT><SPAN style="COLOR: blue">ON</SPAN><FONT color=#000000> p</FONT><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: fuchsia">object_id</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> o</FONT><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: fuchsia">object_id<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: gray">JOIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">objects</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> q </FONT><SPAN style="COLOR: blue">ON</SPAN><FONT color=#000000> o</FONT><SPAN style="COLOR: gray">.</SPAN><FONT color=#000000>parent_object_id </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> q</FONT><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: fuchsia">object_id<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> q</FONT><SPAN style="COLOR: gray">.</SPAN><FONT color=#000000>name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> @queue_name<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: gray">AND</SPAN><FONT color=#000000> p</FONT><SPAN style="COLOR: gray">.</SPAN><FONT color=#000000>index_id </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">END</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">---------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Routing.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Skip the following if services are in the same database instance.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">---------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Create a route to the initiator service.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ROUTE</SPAN><FONT color=#000000> initiator_route<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WITH</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SERVICE_NAME</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'initiator_service'</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ADDRESS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'tcp://initiator_host:4022'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- In msdb, create an incoming route to the target service.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> msdb</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ROUTE</SPAN><FONT color=#000000> target_route<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WITH</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SERVICE_NAME</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'target_service'</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ADDRESS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'local'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> data_push_database</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT color=#000000 size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT color=#000000 size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Script for fast data push sample.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This file is part of the Microsoft SQL Server Code Samples.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Copyright (C) Microsoft Corporation. All Rights reserved.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This source code is intended only as a supplement to Microsoft<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Development Tools and/or on-line documentation. See these other<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- materials for detailed information regarding Microsoft code samples.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- PARTICULAR PURPOSE.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">---------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Initiator data push.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This script can also be run on multiple connections to achieve transactional<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- concurrency. Since each connection will send message_quantity messages<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- with number_initiator_transactions transactions and number_dialogs<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- dialogs, these parameter quantities should be divided by the number<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- of connections to get the same total quantities.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">---------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> data_push_database</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Send the messages. Output sending time.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">EXEC</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> usp_data_push</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">---------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Wait for transmission queue to be empty, signifying the<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- reception and acknowledgement of all messages by the target.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Use this efficient checking method every 5 seconds.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">---------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">DECLARE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @count </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">WHILE </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">(</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000>1</FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000>1</FONT><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">BEGIN<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @count </FONT><SPAN style="COLOR: gray">=<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;</SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">(</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SELECT</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> p</FONT><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: blue">rows<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">objects</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> o<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: gray">JOIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">partitions</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> p </FONT><SPAN style="COLOR: blue">ON</SPAN><FONT color=#000000> p</FONT><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: fuchsia">object_id</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> o</FONT><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: fuchsia">object_id<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> o</FONT><SPAN style="COLOR: gray">.</SPAN><FONT color=#000000>name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'sysxmitqueue'</SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@count </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">)</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">BREAK</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WAITFOR</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">DELAY</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'00:00:05:000'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">END</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SELECT</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">GETDATE</SPAN><SPAN style="COLOR: gray">()</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'End transmission'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- View processing errors.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SELECT</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">*</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> initiator_processing_errors</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- View unsent messages.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SELECT</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">*</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> unsent_messages</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Script for fast data push sample.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This file is part of the Microsoft SQL Server Code Samples.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Copyright (C) Microsoft Corporation. All Rights reserved.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This source code is intended only as a supplement to Microsoft<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Development Tools and/or on-line documentation. See these other<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- materials for detailed information regarding Microsoft code samples.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- PARTICULAR PURPOSE.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">----------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Monitor target.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- A count of processed messages is kept in the<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- target_message_counter table.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- The usp_get_queue_size procedure can also be used to<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- monitor the size of the target queue.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">----------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> data_push_database</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Wait for message_quantity messages to be processed.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">DECLARE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @message_quantity </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SET</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @message_quantity </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> message_quantity </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> data_push_parameters</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">DECLARE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> @count </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">WHILE </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">(</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000>1</FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000>1</FONT><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">BEGIN<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @count </FONT><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TOP</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>1</FONT><SPAN style="COLOR: gray">)</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">counter</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> target_message_counter</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@count </FONT><SPAN style="COLOR: gray">&gt;=</SPAN><FONT color=#000000> @message_quantity</FONT><SPAN style="COLOR: gray">)</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">BREAK</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WAITFOR</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">DELAY</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'00:00:05:000'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">END</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SELECT</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">GETDATE</SPAN><SPAN style="COLOR: gray">()</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'Messages processed'</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- View message processing errors.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SELECT</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">*</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> target_processing_errors</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Clear processed message counter for next run.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">UPDATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> target_message_counter </FONT><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">counter</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT color=#000000 size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT color=#000000 size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Script for data push sample.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This file is part of the Microsoft SQL Server Code Samples.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Copyright (C) Microsoft Corporation. All Rights reserved.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This source code is intended only as a supplement to Microsoft<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Development Tools and/or on-line documentation. See these other<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- materials for detailed information regarding Microsoft code samples.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- PARTICULAR PURPOSE.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">----------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Cleanup for fast data push.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Before running, replace the configuration-dependent <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- domain_name and partner_host names.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">----------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">master</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">*</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">databases</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'data_push_database'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DROP</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">DATABASE</SPAN><FONT color=#000000> data_push_database</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> msdb</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">*</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">routes</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'initiator_route'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DROP</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ROUTE</SPAN><FONT color=#000000> initiator_route</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">*</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">routes</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'target_route'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DROP</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ROUTE</SPAN><FONT color=#000000> target_route</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">master</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">*</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">endpoints</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'service_broker_endpoint'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DROP</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">ENDPOINT</SPAN><FONT color=#000000> service_broker_endpoint</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">*</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">syslogins</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'domain_name\partner_host$'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DROP</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">LOGIN</SPAN><FONT color=#000000> [domain_name\partner_host$]</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT color=#000000 size=3 face=Calibri>&nbsp;</FONT></o:p></P></SPAN></ ddue.schemas.microsoft.com authoring 2003 5:CONTENT>]]></content:encoded>
    </item>
    <item>
      <title>Reusing dialogs with a dialog pool</title>
      <link>https://review.docs.microsoft.com/archive/blogs/sql_service_broker/reusing-dialogs-with-a-dialog-pool</link>
      <pubDate>Thu, 24 Jul 2008 19:55:00 GMT</pubDate>
      <dc:creator><![CDATA[portegys]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sql_service_broker/2008/07/24/reusing-dialogs-with-a-dialog-pool/</guid>
      <description><![CDATA[As noted in various Service Broker sources, it is often advantageous to&nbsp;minimize the overhead...]]></description>
      <content:encoded><![CDATA[<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000>As noted in various Service Broker sources, it is often advantageous to&nbsp;minimize the overhead of creating dialogs to send messages on. This blog shows how to create a shared pool of dialogs to be able to reuse dialogs instead of creating new ones. The dialog pool is a variation of Remus Rusanu's reusing and recycling conversations as shown in his <A title=rusanu.com/blog href="https://rusanu.com/blog/" mce_href="https://rusanu.com/blog/">blog</A>. One of the main differences is that the dialog pool is keyed only on services and contract, not SPID. This allows the same SPID to obtain multiple dialogs from the pool should the need arise. As importantly, different SPIDs can reuse the same dialog sequentially instead of creating two of them. Measurements show equivalent performance using the dialog pool compared to the SPID-based reuse scheme.</FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000></FONT></SPAN>&nbsp;</P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000>The following code shows how to get, free and delete dialogs from a dialog pool table. Initially empty,&nbsp;a new dialog is created in the pool&nbsp;when&nbsp;a request for an existing free dialog cannot be met. Thus the pool will grow during bursts of high demand.</FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000></FONT></SPAN>&nbsp;</P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000>The dialog pool entries also contain creation time and send count fields&nbsp;that ease the auditing and "recycling" of dialogs in the pool based on application requirements. Recycling consists of gracefully ending an existing dialog between services and beginning a new one. If done prudently, this technique can ease the handling of dialog errors by limiting the number of messages affected. For example, the application may choose to contrain a dialog to a certain number of messages before it is recycled. This might also be done according to the age of a dialog. See the end of the usp_send procedure for an example of recycling.</FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000></FONT></SPAN>&nbsp;</P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000>An example application that exercises the dialog pool is also included.</FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000></FONT></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"></SPAN>&nbsp;</P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------------<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Dialog Pool Sample.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This sample shows how to create and use a shared pool of reuseable dialogs.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- The purpose of reusing dialogs is to reduce the overhead of creating them.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- The sample also shows how dialogs in the pool can be "recycled" by deleting<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- dialogs based on application criteria, such as number of messages sent.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This sample is largely based on Remus Rusanu's tutorials on reusing and<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- recycling conversations (rusanu.com/blog).<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Contents: dialog pool and application using the pool.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">----------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">USE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">master<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>GO</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Create demo database section<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> name <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">databases</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'SsbDemoDb'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">DATABASE</SPAN> [SsbDemoDb];<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">DATABASE</SPAN> [SsbDemoDb]<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>GO</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#0000ff>USE</FONT>&nbsp;[SsbDemoDb];<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO</SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Create master key<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">EXISTS(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> name <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">symmetric_keys</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'##MS_DatabaseMasterKey##'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">CREATE</SPAN> <SPAN style="COLOR: blue">MASTER</SPAN> <SPAN style="COLOR: blue">KEY</SPAN> <SPAN style="COLOR: blue">ENCRYPTION</SPAN> <SPAN style="COLOR: blue">BY</SPAN> <SPAN style="COLOR: blue">PASSWORD</SPAN><SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: red">'Password#123'<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>GO</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Dialog pool section<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- The dialog pool table.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Obtain a conversation handle using from service, to service, and contract.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Also indicates age and usage of dialog for auditing purposes.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> name <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">tables</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DialogPool'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">TABLE</SPAN> [DialogPool]<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">TABLE</SPAN> [DialogPool]<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>FromService <SPAN style="COLOR: blue">SYSNAME</SPAN> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>ToService <SPAN style="COLOR: blue">SYSNAME</SPAN> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>OnContract <SPAN style="COLOR: blue">SYSNAME</SPAN> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Handle <SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>OwnerSPID <SPAN style="COLOR: blue">INT</SPAN> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>CreationTime <SPAN style="COLOR: blue">DATETIME</SPAN> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>SendCount <SPAN style="COLOR: blue">BIGINT</SPAN> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">UNIQUE </SPAN><SPAN style="COLOR: gray">(</SPAN>Handle<SPAN style="COLOR: gray">));<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Get dialog procedure. <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Reuse a free dialog in the pool or create a new one in case<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- no free dialogs exist.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Input is from service, to service, and contract.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Output is dialog handle and count of message previously sent on dialog.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> name <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">procedures</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'usp_get_dialog'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">PROC</SPAN> usp_get_dialog<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">PROCEDURE</SPAN> [usp_get_dialog]<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@fromService <SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@toService <SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@onContract <SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@dialogHandle <SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN> <SPAN style="COLOR: blue">OUTPUT</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@sendCount <SPAN style="COLOR: blue">BIGINT</SPAN> <SPAN style="COLOR: blue">OUTPUT</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">AS<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">BEGIN<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SET</SPAN> <SPAN style="COLOR: blue">NOCOUNT</SPAN> <SPAN style="COLOR: blue">ON</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DECLARE</SPAN> @dialog <SPAN style="COLOR: blue">TABLE<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>FromService <SPAN style="COLOR: blue">SYSNAME</SPAN> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>ToService <SPAN style="COLOR: blue">SYSNAME</SPAN> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>OnContract <SPAN style="COLOR: blue">SYSNAME</SPAN> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Handle <SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>OwnerSPID <SPAN style="COLOR: blue">INT</SPAN> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>CreationTime <SPAN style="COLOR: blue">DATETIME</SPAN> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>SendCount <SPAN style="COLOR: blue">BIGINT</SPAN> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">NULL<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- Try to claim an unused dialog in [DialogPool]<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- READPAST option avoids blocking on locked dialogs.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN</SPAN> <SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DELETE</SPAN> @dialog<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">UPDATE</SPAN> <SPAN style="COLOR: blue">TOP</SPAN><SPAN style="COLOR: gray">(</SPAN>1<SPAN style="COLOR: gray">)</SPAN> [DialogPool] <SPAN style="COLOR: blue">WITH</SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">READPAST</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SET</SPAN> OwnerSPID <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: fuchsia">@@SPID<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">OUTPUT</SPAN> INSERTED<SPAN style="COLOR: gray">.*</SPAN> <SPAN style="COLOR: blue">INTO</SPAN> @dialog<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">WHERE</SPAN> FromService <SPAN style="COLOR: gray">=</SPAN> @fromService<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: gray">AND</SPAN> ToService <SPAN style="COLOR: gray">=</SPAN> @toService<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: gray">AND</SPAN> OnContract <SPAN style="COLOR: gray">=</SPAN> @OnContract<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: gray">AND</SPAN> OwnerSPID <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: gray">-</SPAN>1<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">IF</SPAN> <SPAN style="COLOR: fuchsia">@@ROWCOUNT</SPAN> <SPAN style="COLOR: gray">&gt;</SPAN> 0<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SET</SPAN> @dialogHandle <SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> Handle <SPAN style="COLOR: blue">FROM</SPAN> @dialog<SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SET</SPAN> @sendCount <SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> SendCount <SPAN style="COLOR: blue">FROM</SPAN> @dialog<SPAN style="COLOR: gray">);</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">ELSE<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- No free dialogs: need to create a new one<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN</SPAN> DIALOG <SPAN style="COLOR: blue">CONVERSATION</SPAN> @dialogHandle<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: blue">SERVICE</SPAN> @fromService<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">TO</SPAN> <SPAN style="COLOR: blue">SERVICE</SPAN> @toService<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">CONTRACT</SPAN> @onContract<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">ENCRYPTION</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: blue">OFF</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">INSERT</SPAN> <SPAN style="COLOR: blue">INTO</SPAN> [DialogPool]<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">(</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">FromService<SPAN style="COLOR: gray">,</SPAN> ToService<SPAN style="COLOR: gray">,</SPAN> OnContract<SPAN style="COLOR: gray">,</SPAN> Handle<SPAN style="COLOR: gray">,</SPAN> OwnerSPID<SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>CreationTime<SPAN style="COLOR: gray">,</SPAN> SendCount<SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">VALUES<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">(</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">@fromService<SPAN style="COLOR: gray">,</SPAN> @toService<SPAN style="COLOR: gray">,</SPAN> @onContract<SPAN style="COLOR: gray">,</SPAN> @dialogHandle<SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: fuchsia">@@SPID</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: fuchsia">GETDATE</SPAN><SPAN style="COLOR: gray">(),</SPAN> 0<SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SET</SPAN> @sendCount <SPAN style="COLOR: gray">=</SPAN> 0<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">COMMIT<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">END</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Free dialog procedure.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Return the dialog to the pool.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Inputs are dialog handle and updated send count.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> name <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">procedures</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'usp_free_dialog'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">PROC</SPAN> usp_free_dialog<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">PROCEDURE</SPAN> [usp_free_dialog]<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@dialogHandle <SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@sendCount <SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">AS<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">BEGIN<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SET</SPAN> <SPAN style="COLOR: blue">NOCOUNT</SPAN> <SPAN style="COLOR: blue">ON</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DECLARE</SPAN> @rowcount <SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DECLARE</SPAN> @string <SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN>50<SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN</SPAN> <SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- Release dialog by setting OwnerSPID to -1.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">UPDATE</SPAN> [DialogPool] <SPAN style="COLOR: blue">SET</SPAN> OwnerSPID <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: gray">-</SPAN>1<SPAN style="COLOR: gray">,</SPAN> SendCount <SPAN style="COLOR: gray">=</SPAN> @sendCount <SPAN style="COLOR: blue">WHERE</SPAN> Handle <SPAN style="COLOR: gray">=</SPAN> @dialogHandle<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SELECT</SPAN> @rowcount <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: fuchsia">@@ROWCOUNT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">IF</SPAN> @rowcount <SPAN style="COLOR: gray">=</SPAN> 0<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SET</SPAN> @string <SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: fuchsia">CAST</SPAN><SPAN style="COLOR: gray">(</SPAN> @dialogHandle <SPAN style="COLOR: blue">AS</SPAN> <SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN>50<SPAN style="COLOR: gray">)));<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">RAISERROR</SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: red">'usp_free_dialog: dialog %s not found in dialog pool'</SPAN><SPAN style="COLOR: gray">,</SPAN> 16<SPAN style="COLOR: gray">,</SPAN> 1<SPAN style="COLOR: gray">,</SPAN> @string<SPAN style="COLOR: gray">)</SPAN> <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: fuchsia">LOG</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">ELSE</SPAN> <SPAN style="COLOR: blue">IF</SPAN> @rowcount <SPAN style="COLOR: gray">&gt;</SPAN> 1<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SET</SPAN> @string <SPAN style="COLOR: gray">=</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> <SPAN style="COLOR: fuchsia">CAST</SPAN><SPAN style="COLOR: gray">(</SPAN> @dialogHandle <SPAN style="COLOR: blue">AS</SPAN> <SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN>50<SPAN style="COLOR: gray">)));<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">RAISERROR</SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: red">'usp_free_dialog: duplicate dialog %s found in dialog pool'</SPAN><SPAN style="COLOR: gray">,</SPAN> 16<SPAN style="COLOR: gray">,</SPAN> 1<SPAN style="COLOR: gray">,</SPAN> @string<SPAN style="COLOR: gray">)</SPAN> <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: fuchsia">LOG</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">COMMIT<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">END</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Delete dialog procedure.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Delete the dialog from the pool. This does not end the dialog.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Input is dialog handle.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> name <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">procedures</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'usp_delete_dialog'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">PROC</SPAN> usp_delete_dialog<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">PROCEDURE</SPAN> [usp_delete_dialog]<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@dialogHandle <SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">AS<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">BEGIN<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SET</SPAN> <SPAN style="COLOR: blue">NOCOUNT</SPAN> <SPAN style="COLOR: blue">ON</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN</SPAN> <SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DELETE</SPAN> [DialogPool] <SPAN style="COLOR: blue">WHERE</SPAN> Handle <SPAN style="COLOR: gray">=</SPAN> @dialogHandle<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">COMMIT<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">END</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Application setup section.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Send messages from initiator to target.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Initiator uses dialogs from the dialog pool.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Initiator also retires dialogs based on application criteria,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- which results in recycling dialogs in the pool.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- This table stores the messages on the target side<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> name <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">tables</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'MsgTable'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">TABLE</SPAN> MsgTable<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">TABLE</SPAN> MsgTable<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN> message_type <SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">,</SPAN> message_body <SPAN style="COLOR: blue">NVARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN>4000<SPAN style="COLOR: gray">))<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Activated store proc for the initiator to receive messages.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">PROCEDURE</SPAN> initiator_queue_activated_procedure<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">AS<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">BEGIN<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DECLARE</SPAN> @handle <SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DECLARE</SPAN> @message_type <SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN</SPAN> <SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">WAITFOR </SPAN><SPAN style="COLOR: gray">(<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">RECEIVE</SPAN> <SPAN style="COLOR: blue">TOP</SPAN><SPAN style="COLOR: gray">(</SPAN>1<SPAN style="COLOR: gray">)</SPAN> @handle <SPAN style="COLOR: gray">=</SPAN> [conversation_handle]<SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@message_type <SPAN style="COLOR: gray">=</SPAN> [message_type_name]<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">FROM</SPAN> [SsbInitiatorQueue]<SPAN style="COLOR: gray">),</SPAN> <SPAN style="COLOR: blue">TIMEOUT</SPAN> 5000<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">IF</SPAN> <SPAN style="COLOR: fuchsia">@@ROWCOUNT</SPAN> <SPAN style="COLOR: gray">=</SPAN> 1<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- Expect target response to EndOfStream message.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">IF</SPAN> @message_type <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'https://schemas.microsoft.com/SQL/ServiceBroker/EndDialog'<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">END</SPAN> <SPAN style="COLOR: blue">CONVERSATION</SPAN> @handle<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">COMMIT<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">END</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Activated store proc for the target to receive messages.<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">PROCEDURE</SPAN><FONT color=#000000> target_queue_activated_procedure<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">AS<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">BEGIN<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Variable table for received messages.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @receive_table </FONT><SPAN style="COLOR: blue">TABLE</SPAN><SPAN style="COLOR: gray">(<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>queuing_order </FONT><SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">conversation_handle</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>message_type_name </FONT><SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>message_body </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: fuchsia">MAX</SPAN><SPAN style="COLOR: gray">));<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Cursor for received message table.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> message_cursor </FONT><SPAN style="COLOR: blue">CURSOR</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">LOCAL</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FORWARD_ONLY</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">READ_ONLY<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">FOR</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SELECT<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">conversation_handle</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>message_type_name</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>message_body<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> @receive_table </FONT><SPAN style="COLOR: blue">ORDER</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">BY</SPAN><FONT color=#000000> queuing_order</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @conversation_handle </FONT><SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @message_type </FONT><SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @message_body </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>4000</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Error variables.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_number </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_message </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>4000</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_severity </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_state </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_procedure </FONT><SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_line </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DECLARE</SPAN><FONT color=#000000> @error_dialog </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>50</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRY<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WHILE </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>1 </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Receive all available messages into the table.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Wait 5 seconds for messages.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WAITFOR </SPAN><SPAN style="COLOR: gray">(<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><SPAN style="COLOR: blue">RECEIVE<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;</SPAN>[queuing_order]</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;</SPAN>[conversation_handle]</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;</SPAN>[message_type_name]</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;</SPAN></FONT><SPAN style="COLOR: fuchsia">CAST</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>[message_body] </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>4000</FONT><SPAN style="COLOR: gray">))<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> [SsbTargetQueue]<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> @receive_table<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: gray">),</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TIMEOUT</SPAN><FONT color=#000000> 5000</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">@@ROWCOUNT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 0<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">COMMIT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BREAK</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ELSE<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">OPEN</SPAN><FONT color=#000000> message_cursor</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">WHILE </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>1</FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000>1</FONT><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">FETCH</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">NEXT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> message_cursor<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> @conversation_handle</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>@message_type</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>@message_body</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: fuchsia">@@FETCH_STATUS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">!=</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">)</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">BREAK</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></FONT><SPAN style="COLOR: green">-- Process a message.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- If an exception occurs, catch and attempt to recover.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRY<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> @message_type </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'SsbMsgType'<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- process the msg. Here we will just insert it into a table<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">INSERT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> MsgTable </FONT><SPAN style="COLOR: blue">values</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@message_type</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @message_body</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ELSE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> @message_type </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'EndOfStream'<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- initiator is signaling end of message stream: end the dialog<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CONVERSATION</SPAN><FONT color=#000000> @conversation_handle</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ELSE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> @message_type </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'https://schemas.microsoft.com/SQL/ServiceBroker/Error'<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- If the message_type indicates that the message is an error,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- raise the error and end the conversation.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></FONT><SPAN style="COLOR: blue">WITH</SPAN><FONT color=#000000> XMLNAMESPACES</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: red">'https://schemas.microsoft.com/SQL/ServiceBroker/Error'</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> ssb</FONT><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SELECT<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_number </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">CAST</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@message_body </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">XML</SPAN><SPAN style="COLOR: gray">).</SPAN><FONT color=#000000>value</FONT><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: red">'(//ssb:Error/ssb:Code)[1]'</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'INT'</SPAN><SPAN style="COLOR: gray">),<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>@error_message </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">CAST</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@message_body </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">XML</SPAN><SPAN style="COLOR: gray">).</SPAN><FONT color=#000000>value</FONT><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: red">'(//ssb:Error/ssb:Description)[1]'</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'VARCHAR(4000)'</SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_dialog </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">CAST</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>@conversation_handle </FONT><SPAN style="COLOR: blue">AS</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>50</FONT><SPAN style="COLOR: gray">));<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">RAISERROR</SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: red">'Error in dialog %s: %s (%i)'</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> 16</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_dialog</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_message</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_number</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></FONT><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CONVERSATION</SPAN><FONT color=#000000> @conversation_handle</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRY<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CATCH<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_number </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_NUMBER</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_message </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_MESSAGE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_severity </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_SEVERITY</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_state </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_STATE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_procedure </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_PROCEDURE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_line </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_LINE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">XACT_STATE</SPAN><SPAN style="COLOR: gray">()</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">-</SPAN><FONT color=#000000>1<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- The transaction is doomed. Only rollback possible.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- This could disable the queue if done 5 times consecutively!<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ROLLBACK</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Record the error.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">INSERT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> target_processing_errors </FONT><SPAN style="COLOR: blue">VALUES</SPAN><SPAN style="COLOR: gray">(NULL,</SPAN><FONT color=#000000> @error_number</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_message</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_severity</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_state</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_procedure</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_line</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">COMMIT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></FONT><SPAN style="COLOR: green">-- For this level of error, it is best to exit the proc<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- and give the queue monitor control.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Breaking to the outer catch will accomplish this.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">RAISERROR </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: red">'Message processing error'</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> 16</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ELSE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">XACT_STATE</SPAN><SPAN style="COLOR: gray">()</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 1<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Record error and continue processing messages.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Failing message could also be put aside for later processing here.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Otherwise it will be discarded.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">INSERT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> target_processing_errors </FONT><SPAN style="COLOR: blue">VALUES</SPAN><SPAN style="COLOR: gray">(NULL,</SPAN><FONT color=#000000> @error_number</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_message</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN>@error_severity</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_state</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_procedure</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_line</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CATCH<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">CLOSE</SPAN><FONT color=#000000> message_cursor</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DELETE</SPAN><FONT color=#000000> @receive_table</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">COMMIT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRY<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CATCH<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Process the error and exit the proc to give the queue monitor control<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_number </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_NUMBER</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_message </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_MESSAGE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_severity </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_SEVERITY</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_state </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_STATE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_procedure </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_PROCEDURE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">SET</SPAN><FONT color=#000000> @error_line </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">ERROR_LINE</SPAN><SPAN style="COLOR: gray">();<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">XACT_STATE</SPAN><SPAN style="COLOR: gray">()</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">-</SPAN><FONT color=#000000>1<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- The transaction is doomed. Only rollback possible.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- This could disable the queue if done 5 times consecutively!<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ROLLBACK</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp; </SPAN><o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Record the error.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">INSERT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> target_processing_errors </FONT><SPAN style="COLOR: blue">VALUES</SPAN><SPAN style="COLOR: gray">(NULL,</SPAN><FONT color=#000000> @error_number</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_message</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_severity</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_state</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_procedure</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_line</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> 1</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">COMMIT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">ELSE</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">IF</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">XACT_STATE</SPAN><SPAN style="COLOR: gray">()</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> 1<o:p></o:p></FONT></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Record error and commit transaction.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: green">-- Here you could also save anything else you want before exiting.<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">INSERT</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INTO</SPAN><FONT color=#000000> target_processing_errors </FONT><SPAN style="COLOR: blue">VALUES</SPAN><SPAN style="COLOR: gray">(NULL,</SPAN><FONT color=#000000> @error_number</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_message</FONT><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@error_severity</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_state</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_procedure</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> @error_line</FONT><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> 0</FONT><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">COMMIT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">END</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">CATCH<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">END</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Table to store processing errors.<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: blue">FROM</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">tables</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">WHERE</SPAN><FONT color=#000000> name </FONT><SPAN style="COLOR: gray">=</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: red">'target_processing_errors'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">DROP</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TABLE</SPAN><FONT color=#000000> target_processing_errors</FONT><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><FONT color=#000000> </FONT><SPAN style="COLOR: blue">TABLE</SPAN><FONT color=#000000> target_processing_errors</FONT><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>error_conversation </FONT><SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">error_number</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: fuchsia">error_message</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">VARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><FONT color=#000000>4000</FONT><SPAN style="COLOR: gray">),</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">error_severity</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">error_state</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: fuchsia">error_procedure</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">SYSNAME</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: gray">NULL,<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: fuchsia">error_line</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">,</SPAN><FONT color=#000000> doomed_transaction </FONT><SPAN style="COLOR: blue">TINYINT</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P></o:p></SPAN>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Create Initiator and Target side SSB entities<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">MESSAGE</SPAN> <SPAN style="COLOR: blue">TYPE</SPAN> SsbMsgType VALIDATION <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: blue">WELL_FORMED_XML</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">MESSAGE</SPAN> <SPAN style="COLOR: blue">TYPE</SPAN> EndOfStream<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">CONTRACT</SPAN> SsbContract <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>SsbMsgType SENT <SPAN style="COLOR: blue">BY</SPAN> INITIATOR<SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>EndOfStream SENT <SPAN style="COLOR: blue">BY</SPAN> INITIATOR<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">QUEUE</SPAN> SsbInitiatorQueue<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">WITH</SPAN> ACTIVATION<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">STATUS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: blue">ON</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>MAX_QUEUE_READERS <SPAN style="COLOR: gray">=</SPAN> 1<SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>PROCEDURE_NAME <SPAN style="COLOR: gray">=</SPAN> [initiator_queue_activated_procedure]<SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">EXECUTE</SPAN> <SPAN style="COLOR: blue">AS</SPAN> <SPAN style="COLOR: blue">OWNER</SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">QUEUE</SPAN> SsbTargetQueue<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">WITH</SPAN> ACTIVATION<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">STATUS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: blue">ON</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>MAX_QUEUE_READERS <SPAN style="COLOR: gray">=</SPAN> 1<SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>PROCEDURE_NAME <SPAN style="COLOR: gray">=</SPAN> [target_queue_activated_procedure]<SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">EXECUTE</SPAN> <SPAN style="COLOR: blue">AS</SPAN> <SPAN style="COLOR: blue">OWNER</SPAN><SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">SERVICE</SPAN> SsbInitiatorService <SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">QUEUE</SPAN> SsbInitiatorQueue<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">SERVICE</SPAN> SsbTargetService <SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">QUEUE</SPAN> SsbTargetQueue<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN>SsbContract<SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- SEND procedure. Uses a dialog from the dialog pool.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">--<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">IF</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: gray">EXISTS</SPAN><SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: blue">SELECT</SPAN> name <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">procedures</SPAN> <SPAN style="COLOR: blue">WHERE</SPAN> name <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'usp_send'</SPAN><SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DROP</SPAN> <SPAN style="COLOR: blue">PROC</SPAN> usp_send<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">PROCEDURE</SPAN> [usp_send]<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@fromService <SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@toService <SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@onContract <SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@messageType <SPAN style="COLOR: blue">SYSNAME</SPAN><SPAN style="COLOR: gray">,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>@messageBody <SPAN style="COLOR: blue">NVARCHAR</SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: fuchsia">MAX</SPAN><SPAN style="COLOR: gray">))<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">AS<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">BEGIN<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SET</SPAN> <SPAN style="COLOR: blue">NOCOUNT</SPAN> <SPAN style="COLOR: blue">ON</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DECLARE</SPAN> @dialogHandle <SPAN style="COLOR: blue">UNIQUEIDENTIFIER</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DECLARE</SPAN> @sendCount <SPAN style="COLOR: blue">BIGINT</SPAN><SPAN style="COLOR: gray">;</SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DECLARE</SPAN> @counter <SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">DECLARE</SPAN> @error <SPAN style="COLOR: blue">INT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SELECT</SPAN> @counter <SPAN style="COLOR: gray">=</SPAN> 1<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN</SPAN> <SPAN style="COLOR: blue">TRANSACTION</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- Will need a loop to retry in case the dialog is<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- in a state that does not allow transmission<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">--<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">WHILE </SPAN><SPAN style="COLOR: gray">(</SPAN>1<SPAN style="COLOR: gray">=</SPAN>1<SPAN style="COLOR: gray">)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- Claim a dialog from the dialog pool.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- A new one will be created if none are available.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">--<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">EXEC</SPAN> usp_get_dialog<SPAN style="COLOR: blue"> </SPAN>@fromService<SPAN style="COLOR: gray">,</SPAN> @toService<SPAN style="COLOR: gray">,</SPAN> @onContract<SPAN style="COLOR: gray">,</SPAN> @dialogHandle <SPAN style="COLOR: blue">OUTPUT</SPAN><SPAN style="COLOR: gray">,</SPAN> @sendCount <SPAN style="COLOR: blue">OUTPUT</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- Attempt to SEND on the dialog<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">--<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">IF </SPAN><SPAN style="COLOR: gray">(</SPAN>@messageBody <SPAN style="COLOR: gray">IS</SPAN> <SPAN style="COLOR: gray">NOT</SPAN> <SPAN style="COLOR: gray">NULL)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- If the @messageBody is not null it must be sent explicitly<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SEND</SPAN> <SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">CONVERSATION</SPAN> @dialogHandle <SPAN style="COLOR: blue">MESSAGE</SPAN> <SPAN style="COLOR: blue">TYPE</SPAN> @messageType<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: gray">(</SPAN>@messageBody<SPAN style="COLOR: gray">);<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">ELSE<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- Messages with no body must *not* specify the body,<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- cannot send a NULL value argument<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SEND</SPAN> <SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">CONVERSATION</SPAN> @dialogHandle <SPAN style="COLOR: blue">MESSAGE</SPAN> <SPAN style="COLOR: blue">TYPE</SPAN> @messageType<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SELECT</SPAN> @error <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: fuchsia">@@ERROR</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">IF</SPAN> @error <SPAN style="COLOR: gray">=</SPAN> 0<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- Successful send, increment count and exit the loop<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">--<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SET</SPAN> @sendCount <SPAN style="COLOR: gray">=</SPAN> @sendCount <SPAN style="COLOR: gray">+</SPAN> 1<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BREAK</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SELECT</SPAN> @counter <SPAN style="COLOR: gray">=</SPAN> @counter<SPAN style="COLOR: gray">+</SPAN>1<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">IF</SPAN> @counter <SPAN style="COLOR: gray">&gt;</SPAN> 10<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- We failed 10 times in a<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>row, something must be broken<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">--<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">RAISERROR</SPAN><SPAN style="COLOR: gray">(</SPAN><SPAN style="COLOR: red">'Failed to SEND on a conversation for more than 10 times. Error %i.'</SPAN><SPAN style="COLOR: gray">,</SPAN> 16<SPAN style="COLOR: gray">,</SPAN> 1<SPAN style="COLOR: gray">,</SPAN> @error<SPAN style="COLOR: gray">)</SPAN> <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: fuchsia">LOG</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BREAK</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- Delete the associated dialog from the table and try again<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">--<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">EXEC</SPAN> usp_delete_dialog<SPAN style="COLOR: blue"> </SPAN>@dialogHandle<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SELECT</SPAN> @dialogHandle <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: gray">NULL;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- "Criterion" for dialog pool removal is send count &gt; 1000.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- Modify to suit application.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- When deleting also inform the target to end the dialog.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">IF</SPAN> @sendCount <SPAN style="COLOR: gray">&gt;</SPAN> 1000<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">EXEC</SPAN> usp_delete_dialog<SPAN style="COLOR: blue"> </SPAN>@dialogHandle <SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">SEND</SPAN> <SPAN style="COLOR: blue">ON</SPAN> <SPAN style="COLOR: blue">CONVERSATION</SPAN> @dialogHandle <SPAN style="COLOR: blue">MESSAGE</SPAN> <SPAN style="COLOR: blue">TYPE</SPAN> [EndOfStream]<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">ELSE<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">BEGIN<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">-- Free the dialog.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">EXEC</SPAN> usp_free_dialog<SPAN style="COLOR: blue"> </SPAN>@dialogHandle<SPAN style="COLOR: gray">,</SPAN> @sendCount<SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">END<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">COMMIT<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">END</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes">;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">------------------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Run application section<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">------------------------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Send some messages<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">exec</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> usp_send<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">N'SsbInitiatorService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'SsbTargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'SsbContract'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'SsbMsgType'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'&lt;xml&gt;This is a well formed XML Message1.&lt;/xml&gt;'<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">exec</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> usp_send<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">N'SsbInitiatorService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'SsbTargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'SsbContract'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'SsbMsgType'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'&lt;xml&gt;This is a well formed XML Message2.&lt;/xml&gt;'<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">exec</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> usp_send<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">N'SsbInitiatorService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'SsbTargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'SsbContract'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'SsbMsgType'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'&lt;xml&gt;This is a well formed XML Message3.&lt;/xml&gt;'<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">exec</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> usp_send<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">N'SsbInitiatorService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'SsbTargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'SsbContract'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'SsbMsgType'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'&lt;xml&gt;This is a well formed XML Message4.&lt;/xml&gt;'<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">exec</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> usp_send<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">N'SsbInitiatorService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'SsbTargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'SsbContract'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'SsbMsgType'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: red">N'&lt;xml&gt;This is a well formed XML Message5.&lt;/xml&gt;'<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Show the dialog pool<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SELECT</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> [DialogPool]<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Show the dialogs used.<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SELECT</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> <SPAN style="COLOR: green">sys</SPAN><SPAN style="COLOR: gray">.</SPAN><SPAN style="COLOR: green">conversation_endpoints</SPAN><SPAN style="COLOR: gray">;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes">-- Check whether the TARGET side has processed the messages<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">SELECT</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: gray">*</SPAN> <SPAN style="COLOR: blue">FROM</SPAN> MsgTable<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">TRUNCATE</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> <SPAN style="COLOR: blue">TABLE</SPAN> MsgTable<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">GO<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>]]></content:encoded>
    </item>
    <item>
      <title>Using multiple routes in Service Broker</title>
      <link>https://review.docs.microsoft.com/archive/blogs/sql_service_broker/using-multiple-routes-in-service-broker</link>
      <pubDate>Mon, 14 Jul 2008 16:31:00 GMT</pubDate>
      <dc:creator><![CDATA[pmarciniak]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sql_service_broker/2008/07/14/using-multiple-routes-in-service-broker/</guid>
      <description><![CDATA[One of main Service Broker components is routing. Whenever you want your messages to leave the...]]></description>
      <content:encoded><![CDATA[<P mce_keep="true">One of main Service Broker components is routing. Whenever you want your messages to leave the database they originate in, you need to provide routes. Setting up routes may become complicated, so if you're making your first steps in Service Broker area, I suggest staying within single database. Once you have an idea of how Service Broker conversations work, it's time to move one of the communicating services to a different database, or even different server. For that you'll need routes. For a syntax of route creation, see T-SQL reference at <A href="https://msdn.microsoft.com/en-us/library/ms186742.aspx" mce_href="https://msdn.microsoft.com/en-us/library/ms186742.aspx">https://msdn.microsoft.com/en-us/library/ms186742.aspx</A>. A route is basically a matching between logical conversation endpoint and an address of the machine that hosts the service. The logical endpoint may be specified in two ways:</P>
<UL>
<LI>By giving just the service name</LI>
<LI>By giving the service name and additionally a broker instance identifier, which ties the route to a specific instance of the service (broker instance ID is just a database identifier in broker terms, so in other words it specifies a database the service is deployed in).</LI></UL>
<P>When such mappings (in the form of routes) are defined, each time a message needs to be sent to the specified service (and optionally in the specified database), it will use the address provided. </P>
<P>In this post I would like to cover somewhat more advanced topic of using multiple routes for the same service name. There are two main reasons you would like to do so, namely:</P>
<UL>
<LI>Load balancing</LI>
<LI>High availability</LI></UL>
<P>I'll go over these two scenarios, describing what happens in each case and providing examples.</P>
<P>To understand the rest of this post, you need to be aware that a service of given name may exist in multiple databases. A pair <EM>&lt;service name; broker instance ID&gt;</EM> is required to uniquely identify service deployment in a database with this broker instance ID (broker instance ID is simply a guid; I'll just call it "broker ID" from now on). You can specify which instance of target service you want to talk to by providing target broker ID in the BEGIN DIALOG statement. But you may specify just the target service name and in such case the broker ID remains "open", i.e. messages are sent to whichever instance (with whatever broker ID) of the target service is known. Once an acknowledgement comes back from the target service, the target broker ID it carries is set in <EM>sys.conversation_endpoints</EM> table and all further messages sent from initiator are directed specifically to that broker ID. If a broker receives a message carrying broker ID other than its own, it simply drops it, concluding that it was probably meant for other instance of a service of the same name.</P>
<H3>Load balancing</H3>
<P>If no broker ID is specified in the BEGIN DIALOG statement and all matching routes specify broker ID, Service Broker will pick one of the available broker IDs from the routing table and direct messages to the chosen broker ID. To avoid distributing messages from a single dialog among different service instances, load balancing doesn't simply pick a route randomly every time it is needed. It employs a mechanism called deterministic routing: each time a message needs to be sent on a dialog started without specifying broker ID and all your routes to the target service are load-balancing routes (i.e. they contain broker IDs), Service Broker performs a hash of dialog ID and, based on that hash, picks one from the set of possible broker IDs. Dialog ID is a parameter that is available from the moment of dialog creation and stays the same during the whole lifetime of a dialog, so as long as the routing table doesn't change while conversations are active, every message of a given dialog will be sent to the same target service instance, because the same broker ID will be always picked up based on the dialog ID hash. Note that all this refers only to messages that are being sent before the first ack comes back from the target. When it does, the target's broker ID is locked at the initiator side and load balancing mechanism is no longer used in the sending process.</P>
<H3>Load balancing example</H3>
<P>It's now time for an example. Let's assume that we start our dialogs from <EM>InitiatorService</EM> on a machine named <EM>ServerA</EM>. The service is deployed in <EM>DatabaseA</EM>. For the sake of simplicity, let broker IDs in the example be equal to database names (in reality they would be GUIDs that have nothing to do with database names). The target of our dialogs is <EM>TargetService</EM>, which is deployed in two databases: <EM>DatabaseB</EM> located on <EM>ServerB</EM>, and <EM>DatabaseC</EM> located on <EM>ServerC</EM>.</P>
<P>For the load balancing mechanism to start working, you need to set up the following routes:</P>
<UL>
<LI><EM>DatabaseA</EM> on <EM>ServerA</EM>:<BR><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> <SPAN style="COLOR: blue">ROUTE</SPAN> [LoadBalancingRoute1] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'TargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseB'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://ServerB:4022'</SPAN><SPAN style="COLOR: gray">;<BR></SPAN><SPAN style="COLOR: blue">CREATE</SPAN> <SPAN style="COLOR: blue">ROUTE</SPAN> [LoadBalancingRoute2] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'TargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseC'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://ServerC:4022'</SPAN><SPAN style="COLOR: gray">;</SPAN></SPAN></LI>
<LI><EM>DatabaseB</EM> on <EM>ServerB</EM>:<BR><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> <SPAN style="COLOR: blue">ROUTE</SPAN> [ReturnRoute] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'InitiatorService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseA'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://ServerA:4022'</SPAN><SPAN style="COLOR: gray">;</SPAN></SPAN></LI>
<LI><EM>DatabaseC</EM> on <EM>ServerC</EM>:<BR><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> <SPAN style="COLOR: blue">ROUTE</SPAN> [ReturnRoute] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'InitiatorService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseA'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://ServerA:4022'</SPAN><SPAN style="COLOR: gray">;</SPAN></SPAN></LI></UL>
<P>Unless you have dropped the default ‘AutoCreatedLocal' routes in msdb's of all servers, this will suffice. If you followed the recommended practices and dropped the default routes, you'll need the following routes as well to close the routing loop:</P>
<UL>
<LI><EM>msdb</EM> of <EM>ServerA</EM>: <BR><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> <SPAN style="COLOR: blue">ROUTE</SPAN> [LocalRoute] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'InitiatorService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseA'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'LOCAL'</SPAN><SPAN style="COLOR: gray">;</SPAN></SPAN></LI>
<LI><EM>msdb</EM> of both&nbsp;<EM>ServerB</EM> and <EM>ServerC</EM>: <BR><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> <SPAN style="COLOR: blue">ROUTE</SPAN> [LocalRoute] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'TargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseB'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'LOCAL'</SPAN><SPAN style="COLOR: gray">;</SPAN></SPAN></LI></UL>
<P>The BROKER_INSTANCE parts of <EM>LoadBalancing1</EM> and <EM>LoadBalancing2</EM> routes are REQUIRED. Without them the load balancing mechanism won't work (I'll explain later what happens in such case). Note that I specified broker ID for return routes as well, even though there is only one instance of <EM>InitiatorService</EM>. It may seem redundant, but <STRONG>it is always a good thing to specify broker ID in a route if it is known at the time of route creation</STRONG>. This may save you from headaches in the future, when something changes in the way services are deployed.</P>
<P>Now, having these routes in place, each time you start a dialog in <EM>DatabaseA</EM>, one instance of the target service will be chosen randomly with even distribution among the provided <EM>TargetService</EM> instances and the dialog will be bound to that instance (to be specific, it's not the choice being made that is random - the randomness comes from random values of dialog IDs).</P>
<P>You've got your load balancing, but there are two gotchas you need to remember:</P>
<UL>
<LI>Of course you need to start your dialogs without specifying broker ID of the target service in the BEGIN DIALOG statement. If you do specify it, you're preventing the load balancing mechanism from doing its work of choosing the instance for you.</LI>
<LI>You cannot have any routes in <EM>DatabaseA</EM> that point to the target service and do not specify broker ID. Such routes have higher priority for dialogs started without specifying broker ID, so your load balancing routes won't be considered at all. For more information on route matching priority, take a look at <A href="https://msdn.microsoft.com/en-us/library/ms166052.aspx" mce_href="https://msdn.microsoft.com/en-us/library/ms166052.aspx">https://msdn.microsoft.com/en-us/library/ms166052.aspx</A>.</LI></UL>
<H3>Unfair load balancing</H3>
<P>Deterministic routing, explained before, is a reason why it is impossible to provide "uneven" load balancing, based on machines' processing power. One might think that if <EM>ServerC</EM> is two times more powerful than <EM>ServerB</EM>, it would be a nice idea to create routes as follows, doubling the chances of the fast machine for being picked up, and effectively making 2/3 of the traffic hit the more powerful server:</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 10pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">ROUTE</SPAN> [LoadBalancingRoute1] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'TargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseB'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://ServerB:4022'</SPAN><SPAN style="COLOR: gray">;<BR></SPAN><SPAN style="COLOR: blue">CREATE</SPAN> <SPAN style="COLOR: blue">ROUTE</SPAN> [LoadBalancingRoute2] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'TargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseC'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://ServerC:4022'</SPAN><SPAN style="COLOR: gray">;<BR></SPAN><SPAN style="COLOR: blue">CREATE</SPAN> <SPAN style="COLOR: blue">ROUTE</SPAN> [LoadBalancingRoute3] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'TargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseC'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://ServerC:4022'</SPAN><SPAN style="COLOR: gray">;</SPAN></SPAN></P>
<P>Unfortunately, this won't work, as deterministic routing uses dialog ID hash to choose <B>particular broker ID and not particular route</B>, so the number of routes with the same broker ID doesn't change the probability of that ID being picked up.</P>
<H3>High availability</H3>
<P>As explained above, providing multiple routes for the same service instance doesn't influence the load balancing behavior in any way. But it is still an important scenario. Why would anyone want to create multiple routes to the same service instance? The answer is availability.</P>
<P>Imagine that you only have single instance of the target service (in <EM>DatabaseB</EM> on <EM>ServerB</EM>), but the traffic between <EM>ServerA</EM> and <EM>ServerB</EM> needs to go through one of two available forwarders (e.g. network boundary nodes). You don't care which forwarder your traffic goes through, but in the event one of them goes down, you would like the traffic to start flowing through the other one. Here's how Service Broker helps you achieving this functionality. When multiple routes match the target of a dialog, (and it is not a load balancing scenario described above), broker doesn't arbitrarily choose to use one of the routes. Instead it passes all matching routes to the underlying transport layer, which tries to deliver the message utilizing all&nbsp;the routing information it got. This may&nbsp;just mean sending the message on all the routes simultaneously, but&nbsp;may also be based on previous attempts to connect to given target, connection latency&nbsp;etc. You shouldn't assume anything regarding this behavior. It is unspecified and may change without any notice in the documentation. Treat it as a black box that knows what it is doing.</P>
<P>Wait a minute! So shouldn't all "matching routes" be passed to the transport also in load balancing scenario described before? Actually, that's something else. The catch is that load balancing chooses the target broker ID for a dialog first, so only the route with the chosen broker ID is considered a "matching route". If there are two or more routes with the chosen broker ID, they will indeed be all passed to the transport, even in a load balancing scenario.</P>
<H3>High availability example</H3>
<P>Let's go through an example of how to set up a high availability scenario. As mentioned before, now there is only one instance of <EM>TargetService</EM>, deployed in <EM>DatabaseB</EM> on <EM>ServerB</EM>. Let the two mentioned forwarder nodes be named <EM>GatewayA</EM> and <EM>GatewayB</EM>. <EM>ServerA</EM> and <EM>ServerB</EM> cannot directly communicate with each other (e.g. due to cross-domain trust relationship issues). The routes that need to be in place are as follows:</P>
<UL>
<LI><EM>DatabaseA</EM> on <EM>ServerA</EM>:<BR><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> <SPAN style="COLOR: blue">ROUTE</SPAN> [HighAvailabilityRoute1] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'TargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseB'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://GatewayA:4022'</SPAN><SPAN style="COLOR: gray">;<BR></SPAN><SPAN style="COLOR: blue">CREATE</SPAN> <SPAN style="COLOR: blue">ROUTE</SPAN> [HighAvailabilityRoute2] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'TargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseB'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://GatewayB:4022'</SPAN><SPAN style="COLOR: gray">;</SPAN></SPAN></LI>
<LI><EM>DatabaseB</EM> of <EM>ServerB</EM>:<BR><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> <SPAN style="COLOR: blue">ROUTE</SPAN> [ReturnRoute1] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'InitiatorService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseA'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://GatewayA:4022'</SPAN><SPAN style="COLOR: gray">;<BR></SPAN><SPAN style="COLOR: blue">CREATE</SPAN> <SPAN style="COLOR: blue">ROUTE</SPAN> [ReturnRoute2] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'InitiatorService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseA'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://GatewayB:4022'</SPAN><SPAN style="COLOR: gray">;</SPAN></SPAN></LI>
<LI><EM>msdb</EM> of both <EM>GatewayA</EM> and <EM>GatewayB</EM>:<BR><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> <SPAN style="COLOR: blue">ROUTE</SPAN> [ForwardingRoute] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'TargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseB'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://ServerB:4022'</SPAN><SPAN style="COLOR: gray">;<BR></SPAN><SPAN style="COLOR: blue">CREATE</SPAN> <SPAN style="COLOR: blue">ROUTE</SPAN> [ForwardingReturnRoute] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'InitiatorService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseA'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://ServerA:4022'</SPAN><SPAN style="COLOR: gray">;</SPAN></SPAN></LI></UL>
<P>If your gateway nodes serve as forwarders for multiple services, you may opt for defining more generic TRANSPORT routes on them and naming your services accordingly, so that you don't have to worry about providing connectivity for each specific service pair, thus decreasing the administrative burden. </P>
<P>For the example to work, you will also need the following msdb routes (that you may have already):</P>
<UL>
<LI><EM>msdb</EM> of <EM>ServerA</EM>:<BR><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> <SPAN style="COLOR: blue">ROUTE</SPAN> [LocalRoute] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'InitiatorService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseA'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'LOCAL'</SPAN><SPAN style="COLOR: gray">;</SPAN></SPAN></LI>
<LI><EM>msdb</EM> of <EM>ServerB</EM>:<BR><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-no-proof: yes; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"> <SPAN style="COLOR: blue">ROUTE</SPAN> [LocalRoute] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'TargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseB'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'LOCAL'</SPAN><SPAN style="COLOR: gray">;</SPAN></SPAN></LI></UL>
<P>If, for some reason, you don't know target broker ID at the time of setting the routes at <EM>ServerA</EM>, it's OK, you may omit the BROKER_INSTANCE = ‘DatabaseB' part and both routes will still be passed to the transport. However, when creating multiple routes for the same service without specifying broker IDs in them, <B>it is very important to make sure they all point to the same instance of the service</B>, merely providing alternative ways of reaching it. Using multiple routes to different service instances without specifying broker ID for each of them may easily lead to problems such as multiple target endpoint creation (described in details below), so you should never do it. I really can't think of a scenario where it would be desired.</P>
<H3>Multiple target endpoint creation</H3>
<P>Let's see how such multiple target endpoint situation could happen. Imagine that in the initiator database you have routes to two different instances of <EM>TargetService</EM> (on <EM>ServerB</EM> and <EM>ServerC</EM>), but you don't specify broker ID for them, just the service name and address.</P>
<OL>
<LI>Once you begin your dialog and send the first message, both these routes are passed to the transport layer and let's say it sends the message on both of them.</LI>
<LI>The message hits <EM>ServerB</EM> first and a dialog endpoint is created there (an entry in <EM>DatabaseB.sys.conversation_endpoints</EM> shows up).</LI>
<LI>After some time, the broker in <EM>DatabaseB</EM> sends an acknowledgement back. The acknowledgement contains the broker ID of the database hosting <EM>TargetService</EM> on <EM>ServerB</EM> (i.e. <EM>DatabaseB</EM>).</LI>
<LI>After a little while (connection to&nbsp;<EM>ServerC</EM> might have taken longer to be established) the message transmitted in&nbsp;step 1 hits <EM>ServerC</EM> and a dialog endpoint is created there as well. <EM>ServerB</EM> and <EM>ServerC</EM> don't know anything about each other.</LI>
<LI><EM>ServerC</EM> sends an acknowledgement cointaining its own broker ID.</LI></OL>
<P>If the business logic that processes first message of a dialog triggers some external action that should be carried out only once for each dialog, you've already run into problems, because it has been executed twice. But let's see what may happen next.</P>
<OL>
<LI>The ack from <EM>ServerB</EM> arrives at <EM>ServerA</EM> and locks the target&nbsp;broker ID for the conversation to <EM>DatabaseB</EM>.</LI>
<LI>The ack from <EM>ServerC</EM> arrives as well, but its broker ID doesn't match the one already fixed for the dialog, so an error is sent back to <EM>ServerC</EM>.</LI>
<LI>Now, <EM>InitiatorService</EM> tries to send second message on the dialog, again both routes are passed to the transport layer, but the transport layer might keep choosing the one to <EM>ServerC</EM> (perhaps it thinks that <EM>ServerB</EM> is inaccessible or slow). The message now carries the broker ID of <EM>DatabaseB </EM>(since the first ack locked it) so <EM>ServerC</EM> keeps dropping it and the broker conversation cannot continue.</LI></OL>
<P>Well, the transport logic will probably try <EM>ServerB</EM> eventually, but anyway that's certainly not a behavior one's looking for. Note that we didn't provide any matching in the routes between target server addresses and broker IDs, so there is no way for Service Broker to act smart in this case.</P>
<P>So how come this problem doesn't occur in a load balancing scenario? Because of how deterministic routing works. As long as the routing table doesn't change while conversations are active, each message of a given dialog will be sent to the same <EM>TargetService</EM> instance, so the risk of creating multiple target endpoints is avoided. What if you cannot avoid changing routes when new conversations are being started and you really care not to fall into the multiple target endpoints scenario? Well, you'll have to implement some kind of a three-way handshake and defer executing any business logic at the target side until you get second message from the initiator, because receiving it means that it's your broker ID that has been saved in initiator's <EM>sys.conversation_endpoints</EM> table.</P>
<P>As you can see, it's always a good idea to provide broker IDs in created routes. The only exception is a situation when the initiator server doesn't know about target server location, number of instances and broker IDs of the target service. In such case there is usually a dedicated node in the topology that takes care of routing, load balancing etc. It is justified to have a route without broker ID in the initiating database, which would delegate all the messages to the intermediate node for processing. Setting the broker ID by the initiator might for example prevent that node from doing load balancing on its own or choosing an appropriate target service instance based on some business logic.</P>
<H3>Putting it all together</H3>
<P>Finally, let me just quickly mention that it is also possible to combine the two multiple route features: load balancing and high availability. Hopefully that's obvious at this point, but let me just provide a short example of how the routes in the initiator database would need to be created. In this example we'll have two <EM>TargetService</EM> instances, just as in the load balancing example, but access to each one will be available via two dedicated forwarders: <EM>GatewayA</EM>, <EM>GatewayB</EM> for accessing <EM>ServerB</EM>, and <EM>GatewayC</EM>, <EM>GatewayD</EM> for accessing <EM>ServerC</EM>. The routes in <EM>DatabaseA</EM> will have to be created as follows:</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 10pt"><SPAN style="FONT-SIZE: 10pt; COLOR: blue; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CREATE</SPAN><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> <SPAN style="COLOR: blue">ROUTE</SPAN> [LoadBal1Fwd1] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'TargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseB'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://GatewayA:4022'</SPAN><SPAN style="COLOR: gray">;<BR></SPAN><SPAN style="COLOR: blue">CREATE</SPAN> <SPAN style="COLOR: blue">ROUTE</SPAN> [LoadBal1Fwd2] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'TargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseB'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://GatewayB:4022'</SPAN><SPAN style="COLOR: gray">;<BR></SPAN><SPAN style="COLOR: blue">CREATE</SPAN> <SPAN style="COLOR: blue">ROUTE</SPAN> [LoadBal2Fwd1] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'TargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseC'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://GatewayC:4022'</SPAN><SPAN style="COLOR: gray">;<BR></SPAN><SPAN style="COLOR: blue">CREATE</SPAN> <SPAN style="COLOR: blue">ROUTE</SPAN> [LoadBal2Fwd2] <SPAN style="COLOR: blue">WITH</SPAN> <SPAN style="COLOR: blue">SERVICE_NAME</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'TargetService'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">BROKER_INSTANCE</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'DatabaseC'</SPAN><SPAN style="COLOR: gray">,</SPAN> <SPAN style="COLOR: blue">ADDRESS</SPAN> <SPAN style="COLOR: gray">=</SPAN> <SPAN style="COLOR: red">'tcp://GatewayD:4022'</SPAN><SPAN style="COLOR: gray">;</SPAN></SPAN></P>
<P>Now, when we begin a dialog and send a message to <EM>TargetService</EM>, one of the two instances of the service will be chosen in the load balancing process, based on dialog ID hash, as described before. But since two routes match the chosen broker ID, they will both be passed to the transport layer and it will do its heuristic to determine which forwarder to use for sending the message. The multiple target endpoint creation problem doesn't exist in this case. Dialog ID is established between initiator and target and not changed by any forwarding machine, so whichever gateway a message will flow through, it will carry the same dialog ID. Therefore even if the same message is sent to the target server from both gateways, it will be able to recognize that it is the same dialog and receive the message that arrives first, treating the other one as a duplicate, thus dropping it.</P>]]></content:encoded>
    </item>
    <item>
      <title>Real Time Data Integration with Service Broker and Other SQL Techniques</title>
      <link>https://review.docs.microsoft.com/archive/blogs/sql_service_broker/real-time-data-integration-with-service-broker-and-other-sql-techniques</link>
      <pubDate>Wed, 09 Jul 2008 15:40:00 GMT</pubDate>
      <dc:creator><![CDATA[Jang]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sql_service_broker/2008/07/09/real-time-data-integration-with-service-broker-and-other-sql-techniques/</guid>
      <description><![CDATA[This article discusses how to use various SQL technologies to accomplish real time data integration...]]></description>
      <content:encoded><![CDATA[<P><FONT size=3>This article discusses how to use various SQL technologies to accomplish real time data integration between SQL Server instances. It provides a set of sample code to help users with their development. The document focuses on the usage of each technology which is incorporated into the data integration service. Please refer to provided links for detail information about the technologies. <B></P>
<P>Real time data integration definition</P></B>
<P>Real time data integration supports event-driven data movement and transformation between SQL Server instances which host databases with different schemas. The data integration should be transparent to source systems without significantly impacting the systems when events are captured and delivered</FONT><FONT face="Times New Roman" size=3>.</FONT><FONT size=3> The technique also supports an intermediate format which allows decoupling of schemas between source and destination systems. It allows either system to change schemas without breaking the application in the other system. The data integration provides fast and efficient data delivery to a destination in an event-driven model, without polling the source system for new data.</FONT><FONT face=Arial size=2></P></FONT><B><FONT size=3>
<P>Sales data integration</P></B>
<P>The real time data integration demo shows the sales data integration between the databases, AdventureWorks (AW) and AdventureWorksDW (AWDW). The data integration service catches the sales data change on AW, and transforms the data in the schema supported in AW onto a general XML format. The service sends the data in XML onto AWDW, and transforms it to correspond to the AWDW schema. </P>
<P>The demo uses the sample databases on SQL Server. Please refer to the link for the detail information about the databases [<A class="" href="https://msdn.microsoft.com/en-us/library/ms124659.aspx" mce_href="https://msdn.microsoft.com/en-us/library/ms124659.aspx">https://msdn.microsoft.com/en-us/library/ms124659.aspx</A>]. Users can download and install the databases for SQL Server 2008 from the following link [<A class="" href="https://technet.microsoft.com/en-us/library/ms124501(SQL.100).aspx" mce_href="https://technet.microsoft.com/en-us/library/ms124501(SQL.100).aspx">https://technet.microsoft.com/en-us/library/ms124501(SQL.100).aspx</A>]. </P><B>
<P>Techniques</P>
<P></B></FONT><FONT size=3><FONT face="Times New Roman">Change tracking </FONT></P>
<P>Change tracking provides a mechanism to query for changes to data and to access information related to the changes. This solution provides answer to the following questions. What rows have changed for a user table? What are the latest data in the rows? Change Tracking requires small amount of storage for each changed row, while it only works for getting the latest data. Please refer to the following link for detail information about Change Tracking [<A class="" href="https://msdn.microsoft.com/en-us/library/bb933874(SQL.100).aspx" mce_href="https://msdn.microsoft.com/en-us/library/bb933874(SQL.100).aspx">https://msdn.microsoft.com/en-us/library/bb933874(SQL.100).aspx</A>]</FONT><FONT face="Times New Roman" size=3>.</FONT><FONT size=3> If an application requires information about all the changes and the intermediate values of the changed data then it should use Change Data Capture (CDC). Please refer to the following document for the comparison of two techniques [<A class="" href="https://msdn.microsoft.com/en-us/library/cc280519(SQL.100).aspx" mce_href="https://msdn.microsoft.com/en-us/library/cc280519(SQL.100).aspx">https://msdn.microsoft.com/en-us/library/cc280519(SQL.100).aspx</A>]</FONT><FONT face="Times New Roman" size=3>.</FONT><FONT size=3> We plan to write another document which shows how to use CDC as a change tracking option. The following code block shows how to enable Change Tracking on the database and table levels.</P></FONT><FONT face="Times New Roman" size=3></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>ALTER</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>DATABASE</FONT><FONT face="Courier New" size=2> AdventureWorks</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>SET</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>CHANGE_TRACKING</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>ON</P>
<P></FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#0000ff size=2>CHANGE_RETENTION</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> 2 </FONT><FONT face="Courier New" color=#0000ff size=2>DAYS</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>AUTO_CLEANUP</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>ON</FONT><FONT face="Courier New" color=#808080 size=2>)</P></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>ALTER</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>TABLE</FONT><FONT face="Courier New" size=2> [AdventureWorks]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[Sales]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[SalesOrderHeader]</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>ENABLE</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>CHANGE_TRACKING</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>WITH </FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#0000ff size=2>TRACK_COLUMNS_UPDATED</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>ON</FONT><FONT face="Courier New" color=#808080 size=2>)</P></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>ALTER</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>TABLE</FONT><FONT face="Courier New" size=2> [AdventureWorks]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[Sales]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[SalesOrderDetail]</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>ENABLE</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>CHANGE_TRACKING</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>WITH </FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#0000ff size=2>TRACK_COLUMNS_UPDATED</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>ON</FONT><FONT face="Courier New" color=#808080 size=2>)</P></FONT>
<P mce_keep="true"><FONT size=3><FONT face="Times New Roman">Changed data in XML</FONT></FONT></P>
<P mce_keep="true"><FONT size=3>After setting change tracking on a database and tables the change tables are populated with the data change information when data is inserted, deleted or updated on the tables. The data integration service uses the following code block to fetch the change information and create an XML file with the data change. Using CHANGETABLE function it creates change tracking information for the tables, ‘SalesOrderHeader’ and ‘SalesOrderDetail’. The code generates an XML document containing the information using the FOR XML mode. In the XML file the root, top-level element is named with ‘Sales’, and each sales order header corresponds to an element named with ‘SalesOrderHeader’</FONT><FONT face="Times New Roman" size=3>.</FONT><FONT size=3> A ‘SalesOrderHeader’ element contains one or more ‘SalesOrderDetail’ elements which describe the data change information on the table, ‘SalesOrderDetail’</FONT><FONT face="Times New Roman" size=3>.</FONT><FONT size=3> INNER JOIN clauses make sure that all the change data information is retrieved from the tables.</P></FONT><FONT face="Times New Roman" size=3></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>SET</FONT><FONT face="Courier New" size=2> @changeReportXML </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" color=#0000ff size=2> </P></FONT><FONT face="Courier New" color=#808080 size=2>
<P>(</P></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>SELECT</FONT><FONT face="Courier New" size=2> SYS_CHANGE_OPERATION</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2> c_soh</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>SalesOrderID</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2> </P></FONT><FONT face="Courier New" color=#0000ff size=2>
<P></FONT><FONT face="Courier New" color=#808080 size=2>(</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>SELECT</FONT><FONT face="Courier New" size=2> SYS_CHANGE_OPERATION</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2> c_sod</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>SalesOrderID</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2> </P>
<DIR>
<DIR>
<P>c_sod</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>SalesOrderDetailID </P></DIR></DIR>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>FROM</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#ff00ff size=2>CHANGETABLE</FONT><FONT face="Courier New" color=#0000ff size=2> </P>
<DIR></FONT><FONT face="Courier New" color=#808080 size=2>
<P>(</P>
<DIR></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>CHANGES</FONT><FONT face="Courier New" size=2> [AdventureWorks]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[Sales]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[SalesOrderDetail]</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2> </P>
<DIR>
<DIR>
<DIR>
<DIR>
<P>@last_sync_version</P></DIR></DIR></DIR></DIR></DIR></FONT><FONT face="Courier New" color=#808080 size=2>
<P>)</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>AS</FONT><FONT face="Courier New" size=2> c_sod</P></DIR>
<P></FONT><FONT face="Courier New" color=#808080 size=2>INNER</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#808080 size=2>JOIN</FONT><FONT face="Courier New" size=2> [AdventureWorks]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[Sales]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[SalesOrderDetail] sod </P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>ON</FONT><FONT face="Courier New" size=2> sod</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>SalesOrderDetailID </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> c_sod</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>SalesOrderDetailID </P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>WHERE</FONT><FONT face="Courier New" size=2> c_soh</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>SalesOrderID </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> c_sod</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>SalesOrderID</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>FOR</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>XML</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>PATH </FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#ff0000 size=2>'SalesOrderDetail'</FONT><FONT face="Courier New" color=#808080 size=2>),</FONT><FONT face="Courier New" size=2> </P>
<DIR>
<DIR></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>type</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>ELEMENTS</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>XSINIL</FONT><FONT face="Courier New" size=2> </P></DIR></DIR>
<P></FONT><FONT face="Courier New" color=#808080 size=2>)</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>FROM</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#ff00ff size=2>CHANGETABLE</FONT><FONT face="Courier New" color=#0000ff size=2> </FONT><FONT face="Courier New" color=#808080 size=2>(</P>
<DIR></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>CHANGES</FONT><FONT face="Courier New" size=2> [AdventureWorks]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[Sales]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[SalesOrderHeader]</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2> </P>
<DIR>
<DIR>
<DIR>
<P>@last_sync_version</P></DIR></DIR></DIR></DIR></FONT><FONT face="Courier New" color=#808080 size=2>
<P>)</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>AS</FONT><FONT face="Courier New" size=2> c_soh</P>
<P></FONT><FONT face="Courier New" color=#808080 size=2>INNER</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#808080 size=2>JOIN</FONT><FONT face="Courier New" size=2> [AdventureWorks]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[Sales]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[SalesOrderHeader] soh </P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>ON</FONT><FONT face="Courier New" size=2> soh</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>SalesOrderID </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> c_soh</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>SalesOrderID</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>WHERE</FONT><FONT face="Courier New" size=2> @salesOrderID </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> c_soh</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>SalesOrderID</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>FOR</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>XML</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>PATH </FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#ff0000 size=2>'SalesOrderHeader'</FONT><FONT face="Courier New" color=#808080 size=2>),</FONT><FONT face="Courier New" size=2> </P>
<DIR></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>root</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#ff0000 size=2>'Sales'</FONT><FONT face="Courier New" color=#808080 size=2>),</FONT><FONT face="Courier New" color=#0000ff size=2>ELEMENTS</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>XSINIL</P></DIR></FONT><FONT face="Courier New" color=#808080 size=2>
<P>);</P></FONT>
<P mce_keep="true"><FONT size=3><FONT face="Times New Roman">Change notification</FONT></P>
<P>SQL Server provides several mechanisms for notifying data change to an application. For example, Trigger [<A class="" href="https://msdn.microsoft.com/en-us/library/ms189599.aspx" mce_href="https://msdn.microsoft.com/en-us/library/ms189599.aspx">https://msdn.microsoft.com/en-us/library/ms189599.aspx</A>] and Query Notification (QN) [</FONT><A class="" href="https://msdn.microsoft.com/en-us/library/ms130764.aspx" mce_href="https://msdn.microsoft.com/en-us/library/ms130764.aspx"><FONT color=#0000ff size=3>https://</FONT><FONT color=#0000ff size=3>msdn.microsoft.com/en-us/library/ms130764.aspx</FONT></A><FONT size=3>]. Trigger provides a simple way for the notification, while only supporting synchronous mechanism. QN supports asynchronous notification and rich filtering semantics. However QN cannot be configured in TSQL within SQL Server. In the Real Time Data integration demo we use a technique integrating Service Broker and Trigger. It provides a simple way to support event notification implementing asynchronous semantic in TSQL within SQL Server. The following code block shows the event notification on the demo.</P></FONT><FONT face="Times New Roman" size=3></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>CREATE</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>TABLE</FONT><FONT face="Courier New" size=2> ConversationHandle</FONT><FONT face="Courier New" color=#0000ff size=2> </P></FONT><FONT face="Courier New" color=#808080 size=2>
<P>(</FONT><FONT face="Courier New" size=2>conversationHandle </FONT><FONT face="Courier New" color=#0000ff size=2>uniqueidentifier</FONT><FONT face="Courier New" color=#808080 size=2>);</P></FONT><FONT face="Courier New" color=#008000 size=2>
<P>--Create a dialog to send all the transactions on</P></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>BEGIN</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>TRANSACTION</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DECLARE</FONT><FONT face="Courier New" size=2> @conversationHandle </FONT><FONT face="Courier New" color=#0000ff size=2>uniqueidentifier</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#008000 size=2>--Create a new conversation on the table</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>BEGIN</FONT><FONT face="Courier New" size=2> DIALOG @conversationHandle</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>FROM</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>SERVICE</FONT><FONT face="Courier New" size=2> AsynchTriggerInitiatorService</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>TO</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>SERVICE</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#ff0000 size=2>N'AsynchTriggerTargetService'</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>ON</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>CONTRACT</FONT><FONT face="Courier New" size=2> [AsynchTriggerContract]</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>WITH</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>ENCRYPTION</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>OFF</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>INSERT</FONT><FONT face="Courier New" size=2> ConversationHandle</FONT><FONT face="Courier New" color=#0000ff size=2> </FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" size=2>conversationHandle</FONT><FONT face="Courier New" color=#808080 size=2>)</FONT><FONT face="Courier New" size=2> </P>
<DIR>
<DIR></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>VALUES </FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" size=2>@conversationHandle</FONT><FONT face="Courier New" color=#808080 size=2>)</P></DIR></DIR></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>COMMIT</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" color=#008000 size=2>
<P>-- TRIGGER for initiating the change tracking demo</P></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>CREATE</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>TRIGGER</FONT><FONT face="Courier New" size=2> ChangeTrackingTrigger </P></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>ON</FONT><FONT face="Courier New" size=2> [AdventureWorks]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[Sales]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[SalesOrderHeader]</P></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>AFTER</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>INSERT</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>DELETE</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>UPDATE</FONT><FONT face="Courier New" size=2> </P></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>AS</P>
<P>BEGIN</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>TRANSACTION</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DECLARE</FONT><FONT face="Courier New" size=2> @conversationHandle </FONT><FONT face="Courier New" color=#0000ff size=2>uniqueidentifier</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>SELECT</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>TOP </FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" size=2>1</FONT><FONT face="Courier New" color=#808080 size=2>)</FONT><FONT face="Courier New" size=2> @conversationHandle </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> conversationHandle </P></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>FROM</FONT><FONT face="Courier New" size=2> ConversationHandle</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>SEND</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>ON</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>CONVERSATION</FONT><FONT face="Courier New" size=2> @conversationHandle </P>
<DIR>
<DIR></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>MESSAGE</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>TYPE</FONT><FONT face="Courier New" size=2> [AsynchTriggerMessageType]</P></DIR></DIR></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>COMMIT</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT>
<P mce_keep="true"><FONT size=3><FONT face="Times New Roman">Reliable data movement</FONT></P>
<P>Service Broker provides asynchronous and reliable data movement. It supports TSQL programming model built on SQL Server database engine. Please refer to the following link for the detail information about Service Broker [<A class="" href="https://technet.microsoft.com/en-us/sqlserver/bb671396.aspx" mce_href="https://technet.microsoft.com/en-us/sqlserver/bb671396.aspx">https://technet.microsoft.com/en-us/sqlserver/bb671396.aspx</A>]. </P>
<P>The data integration service uses multiple conversations for message delivery to increase throughput. Using multiple dialogs brings the data parallelism on the receiving side. Multiple threads can receive and process the messages in the dialogs independently. However, initiating the conversations brings load to a system. Therefore right amounts of conversations should be chosen smartly. In the real time data integration demo we choose four conversations for processing the messages with high throughput. </FONT><FONT face=Arial size=2></FONT><FONT size=3>In the real time data integration service we initiate four dialogs, and store them onto a table. The demo uses the dialogs for sending messages about changed data information. Please refer to the following code block for the dialog creation.&nbsp; The following code blocks present the procedure for sending an XML message using Service Broker</FONT><FONT face="Times New Roman" size=3>.</FONT><FONT size=3> The procedure uses the four conversations evenly distributed messages based on the sales order ID ( </FONT><FONT face="Courier New" color=#0000ff size=2>SET</FONT><FONT face="Courier New" size=2> @dialogHandleID </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> @salesOrderID </FONT><FONT face="Courier New" color=#808080 size=2>%</FONT><FONT face="Courier New" size=2> 4</FONT><FONT size=3>) . Because messages for the same sales order ID are delivered in a single conversation it is guaranteed that the messages are delivered exactly once in order manner.</P></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>CREATE</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>PROCEDURE</FONT><FONT face="Courier New" size=2> SendChanges</P></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>AS</P>
<P>BEGIN</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DECLARE</FONT><FONT face="Courier New" size=2> @last_sync_version </FONT><FONT face="Courier New" color=#0000ff size=2>bigint</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DECLARE</FONT><FONT face="Courier New" size=2> @salesOrderID </FONT><FONT face="Courier New" color=#0000ff size=2>bigint</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DECLARE</FONT><FONT face="Courier New" size=2> @dialogHandleID </FONT><FONT face="Courier New" color=#0000ff size=2>INT</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DECLARE</FONT><FONT face="Courier New" size=2> @dialogHandle </FONT><FONT face="Courier New" color=#0000ff size=2>uniqueidentifier</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DECLARE</FONT><FONT face="Courier New" size=2> @changeReportXML </FONT><FONT face="Courier New" color=#0000ff size=2>XML</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DECLARE</FONT><FONT face="Courier New" size=2> @next_baseline </FONT><FONT face="Courier New" color=#0000ff size=2>bigint</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DECLARE</FONT><FONT face="Courier New" size=2> @TotalDialogs </FONT><FONT face="Courier New" color=#0000ff size=2>INT</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DECLARE</FONT><FONT face="Courier New" size=2> @logMsg </FONT><FONT face="Courier New" color=#0000ff size=2>VARCHAR</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#ff00ff size=2>MAX</FONT><FONT face="Courier New" color=#808080 size=2>);</P></FONT><FONT face="Courier New" color=#0000ff size=2></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>BEGIN</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>TRANSACTION</FONT><FONT face="Courier New" color=#808080 size=2>; </P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>SELECT</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>TOP </FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" size=2>1</FONT><FONT face="Courier New" color=#808080 size=2>)</FONT><FONT face="Courier New" size=2> @last_sync_version </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> lastVersion </FONT></P>
<P><FONT face="Courier New" color=#0000ff size=2>FROM</FONT><FONT face="Courier New" size=2> LastVersion</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>SET</FONT><FONT face="Courier New" size=2> @TotalDialogs </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> 4</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#008000 size=2>--Create a cursor on the change table for [SalesOrderHeader]</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DECLARE</FONT><FONT face="Courier New" size=2> cursorChangeOrderHeader</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>CURSOR</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>FORWARD_only</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>READ_ONLY</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>FOR</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>SELECT</FONT><FONT face="Courier New" size=2> SalesOrderID </FONT><FONT face="Courier New" color=#0000ff size=2>FROM</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#ff00ff size=2>CHANGETABLE</FONT><FONT face="Courier New" color=#0000ff size=2> </FONT><FONT face="Courier New" color=#808080 size=2>(</FONT></P>
<P><FONT face="Courier New" color=#0000ff size=2>CHANGES</FONT><FONT face="Courier New" size=2> [SalesOrderHeader]</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2> @last_sync_version</FONT><FONT face="Courier New" color=#808080 size=2>)</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>AS</FONT><FONT face="Courier New" size=2> Cursor_CH</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>ORDER</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>BY</FONT><FONT face="Courier New" size=2> SYS_CHANGE_VERSION</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#008000 size=2>--Open the cursor on the change table for [SalesOrderHeader]</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#008000 size=2>--Loop for each changed sales order id</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>OPEN</FONT><FONT face="Courier New" size=2> cursorChangeOrderHeader</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>WHILE</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" size=2>1</FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2>1</FONT><FONT face="Courier New" color=#808080 size=2>)</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>BEGIN</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>FETCH</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>NEXT</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>FROM</FONT><FONT face="Courier New" size=2> cursorChangeOrderHeader </FONT><FONT face="Courier New" color=#0000ff size=2>INTO</FONT><FONT face="Courier New" size=2> @salesOrderID</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#008000 size=2>--If there is no more changed sales order then exit</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>IF </FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#ff00ff size=2>@@FETCH_STATUS</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#808080 size=2>!=</FONT><FONT face="Courier New" size=2> 0</FONT><FONT face="Courier New" color=#808080 size=2>) </FONT><FONT face="Courier New" color=#0000ff size=2>BREAK;</FONT><FONT face="Courier New" size=2></P>
<P>--&lt;<B>Fetching changed data and creating XML file.&gt;</B></P>
<P><B>--&lt;Please refer to the code block on section 2.a.1.&gt;</P></B></FONT><FONT face="Courier New" color=#808080 size=2></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#008000 size=2>--Find the conversation handle for the sales order </FONT></P>
<P><FONT face="Courier New" color=#008000 size=2>--from the dialog handle table</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>SET</FONT><FONT face="Courier New" size=2> @dialogHandleID </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> @salesOrderID </FONT><FONT face="Courier New" color=#808080 size=2>%</FONT><FONT face="Courier New" size=2> @TotalDialogs</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>SELECT</FONT><FONT face="Courier New" size=2> @dialogHandle </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> dialogHandle </P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>FROM</FONT><FONT face="Courier New" size=2> DialogHandles </P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>WHERE</FONT><FONT face="Courier New" size=2> ID </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> @dialogHandleID</FONT><FONT face="Courier New" color=#808080 size=2>;</FONT><FONT face="Courier New" size=2> </P>
<P mce_keep="true"></FONT><FONT face="Courier New" color=#008000 size=2>--Capture last version info</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>SELECT</FONT><FONT face="Courier New" size=2> @next_baseline </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> SYS_CHANGE_VERSION </FONT></P>
<P><FONT face="Courier New" color=#0000ff size=2>FROM </FONT><FONT face="Courier New" color=#ff00ff size=2>CHANGETABLE</FONT><FONT face="Courier New" color=#0000ff size=2> </FONT><FONT face="Courier New" color=#808080 size=2>(</FONT></P>
<P><FONT face="Courier New" color=#0000ff size=2>CHANGES</FONT><FONT face="Courier New" size=2>[AdventureWorks]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[Sales]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[SalesOrderHeader]</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2> </FONT></P>
<P><FONT face="Courier New" size=2>@last_sync_version</FONT><FONT face="Courier New" color=#808080 size=2>)</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>as</FONT><FONT face="Courier New" size=2> c_soh</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>WHERE</FONT><FONT face="Courier New" size=2> @salesOrderID </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> SalesOrderID</FONT><FONT face="Courier New" color=#808080 size=2>;</FONT></P>
<P><FONT face="Courier New" color=#008000 size=2>--Send the message using Broker</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>SEND</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>ON</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>CONVERSATION</FONT><FONT face="Courier New" size=2> @dialogHandle </FONT></P>
<P><FONT face="Courier New" color=#0000ff size=2>MESSAGE</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>TYPE</FONT><FONT face="Courier New" size=2> [RealTimeDImessagetype]</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" size=2>@changeReportXML</FONT><FONT face="Courier New" color=#808080 size=2>);</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>END</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>CLOSE</FONT><FONT face="Courier New" size=2> cursorChangeOrderHeader</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DEALLOCATE</FONT><FONT face="Courier New" size=2> cursorChangeOrderHeader</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>UPDATE</FONT><FONT face="Courier New" size=2> LastVersion</FONT><FONT face="Courier New" color=#0000ff size=2> SET</FONT><FONT face="Courier New" size=2> lastVersion </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> @next_baseline</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>COMMIT</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>END</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT>
<P mce_keep="true"><FONT size=3><FONT face="Times New Roman">Activation</FONT></P>
<P>Activation allows message processing logic to be launched when a message arrives on a Service Broker queue. When an internal activation is used for processing messages a stored procedure is declared on a Service Broker queue, and invoked on a background thread when a message arrives. A user can also specify an executable for processing the messages as an external activator. For example, SQL Server Integration Services (SSIS) can be used as an external activation procedure to process messages</FONT><FONT face="Times New Roman" size=3>.</FONT><FONT size=3> Please refer to the following link for the code sample and document of External Activator [<A class="" href="https://www.codeplex.com/SQLSrvSrvcBrkr/Release/ProjectReleases.aspx?ReleaseId=3853" mce_href="https://www.codeplex.com/SQLSrvSrvcBrkr/Release/ProjectReleases.aspx?ReleaseId=3853">https://www.codeplex.com/SQLSrvSrvcBrkr/Release/ProjectReleases.aspx?ReleaseId=3853</A>].</P>
<P>In the real time data integration services demo we use internal activators to process event notification messages on the initiator service as well as changed data information messages on the target service. We briefly mention how the services process the messages in the activation procedures.</P>
<UL>
<LI>Message processing in the initiator</LI></UL>
<P>The real time data integration initiator handles messages from two different services. One of the services is an asynchronous event notification service, and the other is a real time data integration target service. A single service in the initiator handles the message from the two different sources based on message types and service names. The following pseudo-code block describes the message processing logic in the initiator.</P></FONT><FONT face="Times New Roman" size=3></FONT><B><FONT size=3>
<P>WHILE</B> there is any message on ‘RealTime_DI_Initiator_queue’</P>
<P><B>RECEIVE</B> a message <B>FROM</B> the queue</P>
<P><B>IF</B> message type is ‘EndDialog’ <B>THEN</P></B></FONT><FONT size=3>
<P><B><FONT size=3><FONT face="Times New Roman">END CONVERSATION</FONT></B></FONT></P></FONT><FONT size=3>
<P><B>ELSE IF</B> message type is ‘ERROR’ <B>THEN</P></B></FONT><FONT size=3>
<P><FONT size=3><FONT face="Times New Roman"><STRONG>IF</STRONG> s<FONT size=3>ervice name is ‘RealTime_DI_Initiator_Service’ <STRONG>THEN</STRONG></P></FONT></FONT></FONT></FONT><FONT size=3><FONT face="Times New Roman"></FONT></FONT><FONT size=3>
<P></FONT><FONT size=3><FONT face="Times New Roman">Raise error;</FONT></P>
<P>Create a new dialog;</P>
<P>Resend pending messages using the dialog;</P>
<P>Replace old dialog with the new one;</P>
<P><B>END CONVERSATION</B> (old dialog); </P>
<P><B>IF</B> service name is ‘Asynchronous_Trigger_Target_Service’ <B>THEN</B></FONT><FONT size=3></P>
<P><B>Raise error;&nbsp;</B></P>
<P><B>END CONVERSATION</B>;</P>
<P><B>ELSE IF</B> message type is ‘Asynchronous triggering’ <B>THEN</P></B></FONT><FONT size=3>
<P><B><FONT size=3><FONT face="Times New Roman">RECEIVE</FONT></B></FONT></P></FONT><FONT size=3>
<P><B>WHERE</B> conversation_handle is identical with this message’s handle</P>
<P><B>EXEC</B> SendChanges <B>PROCEDURE</P></B></FONT><FONT face=Arial size=2>
<UL>
<LI></FONT><FONT size=3>Message processing in the target</FONT></LI></UL>
<P><FONT size=3>The message processing procedure in the real time data integration target receives messages from a target queue, and transforms the messages from the XML format into a supported schema. A simple and straightforward way to process messages is to receive a message from the queue and to transform it one by one until all the messages are processed on the queue. However, the mechanism may hurt the performance of the data integration target</FONT><FONT face="Times New Roman" size=3>.</FONT><FONT size=3> Instead of receiving a single message and transform it the data integration target service uses a cursor-based processing mechanism. It receives all the messages from the target queue, and stores in a temporary table. A cursor iterates the table to fetch a message and process it to covert from an XML format to a desired schema. The following code block shows the activation procedure on the target.</P></FONT><FONT face="Times New Roman" size=3></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>CREATE</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>PROCEDURE</FONT><FONT face="Courier New" size=2> ProcessMessagesDW</P></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>AS</P>
<P>BEGIN</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DECLARE</FONT><FONT face="Courier New" size=2> @handle </FONT><FONT face="Courier New" color=#0000ff size=2>uniqueidentifier</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DECLARE</FONT><FONT face="Courier New" size=2> @messageBody </FONT><FONT face="Courier New" color=#0000ff size=2>XML</FONT><FONT face="Courier New" color=#808080 size=2>;</FONT><FONT face="Courier New" size=2></P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DECLARE</FONT><FONT face="Courier New" size=2> @tableMessages </FONT><FONT face="Courier New" color=#0000ff size=2>TABLE</FONT><FONT face="Courier New" color=#808080 size=2>(</P></FONT><FONT face="Courier New" size=2>
<P>queuing_order </FONT><FONT face="Courier New" color=#0000ff size=2>BIGINT</FONT><FONT face="Courier New" color=#808080 size=2>,</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>conversation_handle</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>UNIQUEIDENTIFIER</FONT><FONT face="Courier New" color=#808080 size=2>,</P></FONT><FONT face="Courier New" size=2>
<P>message_body </FONT><FONT face="Courier New" color=#0000ff size=2>VARBINARY</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#ff00ff size=2>MAX</FONT><FONT face="Courier New" color=#808080 size=2>));</FONT><FONT face="Courier New" size=2></P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DECLARE</FONT><FONT face="Courier New" size=2> cursorMessages </FONT><FONT face="Courier New" color=#0000ff size=2>CURSOR</FONT><FONT face="Courier New" size=2> </P>
<DIR></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>FORWARD_ONLY</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>READ_ONLY</P></DIR></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>FOR</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>SELECT</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>conversation_handle</FONT><FONT face="Courier New" color=#808080 size=2>,</P></FONT><FONT face="Courier New" size=2>
<P>message_body</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>FROM</FONT><FONT face="Courier New" size=2> @tableMessages</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>ORDER</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>BY</FONT><FONT face="Courier New" size=2> queuing_order</FONT><FONT face="Courier New" color=#808080 size=2>;</FONT><FONT face="Courier New" size=2> </P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>WHILE</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" size=2>1</FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2>1</FONT><FONT face="Courier New" color=#808080 size=2>)</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>BEGIN</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>BEGIN</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>TRANSACTION</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>WAITFOR</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#0000ff size=2>RECEIVE</P></FONT><FONT face="Courier New" size=2>
<P>queuing_order</FONT><FONT face="Courier New" color=#808080 size=2>,</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>conversation_handle</FONT><FONT face="Courier New" color=#808080 size=2>,</P></FONT><FONT face="Courier New" size=2>
<P>message_body</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>FROM</FONT><FONT face="Courier New" size=2> [RealTimeDItargetqueue]</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>INTO</FONT><FONT face="Courier New" size=2> @tableMessages</FONT><FONT face="Courier New" color=#808080 size=2>),</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>TIMEOUT</FONT><FONT face="Courier New" size=2> 1000</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P mce_keep="true">&nbsp;</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>IF</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#ff00ff size=2>@@ROWCOUNT</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> 0</FONT><FONT face="Courier New" color=#808080 size=2>)</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>BEGIN</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>COMMIT</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>BREAK</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>END</FONT><FONT face="Courier New" size=2></P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>OPEN</FONT><FONT face="Courier New" size=2> cursorMessages</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>WHILE</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" size=2>1</FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2>1</FONT><FONT face="Courier New" color=#808080 size=2>)</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>BEGIN</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>FETCH</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>NEXT</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>FROM</FONT><FONT face="Courier New" size=2> cursorMessages</P>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>INTO</FONT><FONT face="Courier New" size=2> @handle</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2> @messageBody</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>IF</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#ff00ff size=2>@@FETCH_STATUS</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#808080 size=2>!=</FONT><FONT face="Courier New" size=2> 0</FONT><FONT face="Courier New" color=#808080 size=2>)</P>
<DIR>
<DIR>
<DIR></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>BREAK</FONT><FONT face="Courier New" color=#808080 size=2>;</FONT></P>
<P><FONT face="Courier New" size=2>-- &lt;Message transformation&gt;</P></DIR></DIR></DIR>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>END </FONT></P>
<P><FONT face="Courier New" color=#0000ff size=2>CLOSE</FONT><FONT face="Courier New" size=2> cursorMessages</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DELETE</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>FROM</FONT><FONT face="Courier New" size=2> @tableMessages</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>COMMIT</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>END</P></FONT><FONT face="Courier New" size=2>
<P></FONT><FONT face="Courier New" color=#0000ff size=2>DEALLOCATE</FONT><FONT face="Courier New" size=2> cursorMessages</FONT><FONT face="Courier New" color=#808080 size=2>;</P></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>END</P></FONT>
<P mce_keep="true"><FONT size=3><FONT face="Times New Roman">Data transformation</FONT></FONT></P>
<P mce_keep="true"><FONT size=3>After receiving messages the target service transforms the received messages, and populates tables with the changed data information from the messages. The received messages are in XML format. The service processes each of the messages to obtain required information from the message using TSQL language coupled with integrated XML support. The following code block shows a sample of the transformation using TSQL. On this example, the transformation is occurred only for the data insert event.</P></FONT><FONT face="Times New Roman" size=3></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>INSERT</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#0000ff size=2>INTO</FONT><FONT face="Courier New" size=2> [AdventureWorksDW]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[dbo]</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>[FactInternetSales]</P></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>SELECT</P></FONT><FONT face="Courier New" size=2>
<P>N1</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>SOH</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>value</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#ff0000 size=2>'CustomerID[1]'</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#ff0000 size=2>'int'</FONT><FONT face="Courier New" color=#808080 size=2>)</P>
<DIR></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>AS</FONT><FONT face="Courier New" size=2> [CustomerKey]</P></DIR>
<P></FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2>N2</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>SOD</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>value</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#ff0000 size=2>'SpecialOfferID[1]'</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#ff0000 size=2>'int'</FONT><FONT face="Courier New" color=#808080 size=2>)</FONT><FONT face="Courier New" size=2> </FONT></P>
<P><FONT face="Courier New" color=#0000ff size=2>AS</FONT><FONT face="Courier New" size=2> [PromotionKey]</P>
<P></FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2>N2</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>SOD</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>value</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#ff0000 size=2>'CarrierTrackingNumber[1]'</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" color=#ff0000 size=2>'NCHAR(9)'</FONT><FONT face="Courier New" color=#808080 size=2>)</FONT><FONT face="Courier New" size=2> </P>
<DIR></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>AS</FONT><FONT face="Courier New" size=2> CarrierTrackingNumber</P></DIR>
<P></FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2>N1</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>SOH</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>value</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#ff0000 size=2>'PurchaseOrderNumber[1]'</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" color=#ff0000 size=2>'NVCHAR(25)'</FONT><FONT face="Courier New" color=#808080 size=2>)</P>
<DIR></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>AS</FONT><FONT face="Courier New" size=2> [CustomerPONumber]</P></DIR></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>FROM</FONT><FONT face="Courier New" size=2> </P>
<P>@messageBody</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>nodes</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#ff0000 size=2>'/Sales/SalesOrderHeader'</FONT><FONT face="Courier New" color=#808080 size=2>)</FONT><FONT face="Courier New" size=2> N1</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" size=2>SOH</FONT><FONT face="Courier New" color=#808080 size=2>)</P>
<P>CROSS</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#808080 size=2>APPLY</FONT><FONT face="Courier New" size=2> soh</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>nodes</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#ff0000 size=2>'SalesOrderDetail'</FONT><FONT face="Courier New" color=#808080 size=2>)</FONT><FONT face="Courier New" size=2> N2</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" size=2>SOD</FONT><FONT face="Courier New" color=#808080 size=2>)</P></FONT><FONT face="Courier New" color=#0000ff size=2>
<P>WHERE</FONT><FONT face="Courier New" size=2> </P>
<P>N1</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>SOH</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>value</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#ff0000 size=2>'CustomerType[1]'</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#ff0000 size=2>'CHAR'</FONT><FONT face="Courier New" color=#808080 size=2>)</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#808080 size=2>=</FONT><FONT face="Courier New" size=2> </FONT><FONT face="Courier New" color=#ff0000 size=2>'I'</FONT><FONT face="Courier New" size=2> </P></FONT><FONT face="Courier New" color=#808080 size=2>
<P>AND</FONT><FONT face="Courier New" size=2> N2</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>SOD</FONT><FONT face="Courier New" color=#808080 size=2>.</FONT><FONT face="Courier New" size=2>value</FONT><FONT face="Courier New" color=#808080 size=2>(</FONT><FONT face="Courier New" color=#ff0000 size=2>'SYS_CHANGE_OPERATION[1]'</FONT><FONT face="Courier New" color=#808080 size=2>,</FONT><FONT face="Courier New" color=#ff0000 size=2>'CHAR'</FONT><FONT face="Courier New" color=#808080 size=2>)=</FONT><FONT face="Courier New" color=#ff0000 size=2>'I'</FONT><FONT face=Arial size=2></P></FONT><FONT face="Times New Roman" size=3></FONT><FONT size=3>
<P>SQL Server Integration Services (SSIS) also provides the data transformations. SSIS supports various forms of data transformation between heterogeneous sources. Please refer to the following link for more detail information about SSIS [<A class="" href="https://technet.microsoft.com/en-us/sqlserver/bb671392.aspx" mce_href="https://technet.microsoft.com/en-us/sqlserver/bb671392.aspx">https://technet.microsoft.com/en-us/sqlserver/bb671392.aspx</A>].</P>
<P>This document discusses about real-time data integration technologies with the coordination of a set of powerful SQL Server technologies. The service provides reliable and transparent data integration between instances. The service is composed with the following technologies.</P>
<DIR>
<DIR></FONT><FONT face=Symbol size=3>
<P></FONT><FONT size=3><FONT face="Times New Roman">Data tracking: Change tracking</FONT></P></FONT><FONT face=Symbol size=3>
<P></FONT><FONT size=3><FONT face="Times New Roman">Change notification: Triggers and Service Broker</FONT></P></FONT><FONT face=Symbol size=3>
<P></FONT><FONT size=3><FONT face="Times New Roman">Reliable data movement: Service Broker</FONT></P></FONT><FONT face=Symbol size=3>
<P></FONT><FONT size=3><FONT face="Times New Roman">Activation: Internal, Blocking with WAITFOR RECEIVE</FONT></P></FONT><FONT face=Symbol size=3>
<P></FONT><FONT size=3><FONT face="Times New Roman">Transformation: TSQL with XML support</FONT></P></DIR></DIR>
<P>The complete code list for the demo can be found on the following link [<A class="" href="https://www.codeplex.com/SQLSrvSrvcBrkr/Release/ProjectReleases.aspx?ReleaseId=15139" mce_href="https://www.codeplex.com/SQLSrvSrvcBrkr/Release/ProjectReleases.aspx?ReleaseId=15139">https://www.codeplex.com/SQLSrvSrvcBrkr/Release/ProjectReleases.aspx?ReleaseId=15139</A>].</P></FONT></SPAN></SPAN>]]></content:encoded>
    </item>
  </channel>
</rss>