<?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>Stephen Kaufman's WebLog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/skaufman/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/skaufman/feed.xml</link>
    <description>Look who&amp;#039;s BizTalk&amp;#039;in - Notes on all things integration</description>
    <lastBuildDate>Tue, 16 Apr 2019 05:48:53 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Creating Azure VM's with the REST API</title>
      <link>https://docs.microsoft.com/archive/blogs/skaufman/creating-azure-vms-with-the-rest-api</link>
      <pubDate>Wed, 30 Oct 2013 16:01:21 GMT</pubDate>
      <dc:creator><![CDATA[Stephen Kaufman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/skaufman/2013/10/30/creating-azure-vms-with-the-rest-api/</guid>
      <description><![CDATA[There are many ways to create virtual machines in Azure. Of course the Azure Portal is the easiest...]]></description>
      <content:encoded><![CDATA[<p>There are many ways to create virtual machines in Azure. Of course the Azure Portal is the easiest but it is completely manual.&nbsp; When you have a lot of virtual machines that are part of your solution then you definitely want to script that process.&nbsp; When you script your Azure deployment you can do it with PowerShell or directly against the REST API.&nbsp; There are many examples on the web that provide PowerShell examples.&nbsp; However, I have not found a lot of material around the REST API.&nbsp;</p>
<p>So if you are trying to use the REST API, here are a couple of findings that I have run into that I hope will help you.</p>
<p>When creating a virtual machine you have two APIs that you can use.&nbsp; The first is the <a href="https://msdn.microsoft.com/en-us/library/windowsazure/jj157186.aspx">Add Role</a> and the second is the <a href="https://msdn.microsoft.com/en-us/library/windowsazure/jj157194.aspx">Create Virtual Machine Deployment</a>.&nbsp;</p>
<p>Which one should you utilize?&nbsp;&nbsp; If you are creating only one virtual machine you can create it with either API.&nbsp;</p>
<p>However, the issues start to arise when you need to create multiple virtual machines in the same script.&nbsp; If you use the Add Role API you will be able to create the first virtual machine but when the second virtual machine in the script is encountered you will receive a 400 Bad Request error (keep in mind that there are a number of 400 error codes that can be returned so make sure to look at the text and not just the HTTP status code).&nbsp;&nbsp; You can find all the Error codes <a href="https://msdn.microsoft.com/en-us/library/windowsazure/ee460801.aspx">here</a>.</p>
<p>When you have multiple virtual machines to create in the script then you will need to start with the Create Virtual Machine Deployment API to create the first virtual machine and then use the Add Role API to create all subsequent virtual machines in your deployment.</p>
<p>You will notice when you look at the XML payload you need to include in the API call that the Create Virtual Machine Deployment contains a &lt;Role&gt; element within a &lt;Deployment&gt; element.&nbsp;&nbsp;&nbsp; When you look at the Add Role XML everything falls under the &lt;PersistVMRole&gt; element.&nbsp; So you need to run the API the does the &lt;Deployment&gt; first before running the &lt;PersistVMRole&gt; elements.</p>
<p><strong>NOTE</strong>: It is very important that you have all the XML nodes in the correct order.&nbsp;</p>
<p>This is important because if the elements are not in the correct order, your VM can still be created (usually) but things like the Availability Set or EndPoints won't get created.&nbsp; What I have found is that when everything is in the right order (based on the examples in the documentation) then everything worked and all the virtual machines were created as expected.&nbsp;</p>
<p>In addition, if simple things like the &lt;Protocol&gt; node is before the &lt;LoadBalancerProbe&gt; element (in the documentation it is the only element after the &lt;LoadBalancerProbe&gt; element) then the endpoints will be created but the Load Balancer won't and you will see that the Load Balancer Set Name column in the portal will show an error stating Missing Probe.</p>]]></content:encoded>
    </item>
    <item>
      <title>Presenting at the BizTalk Summit 2012</title>
      <link>https://docs.microsoft.com/archive/blogs/skaufman/presenting-at-the-biztalk-summit-2012</link>
      <pubDate>Wed, 05 Dec 2012 11:17:23 GMT</pubDate>
      <dc:creator><![CDATA[Stephen Kaufman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/skaufman/2012/12/05/presenting-at-the-biztalk-summit-2012/</guid>
      <description><![CDATA[As many of you know, the BizTalk Team is putting on a BizTalk Summit.  The BizTalk Summit 2012 is a...]]></description>
      <content:encoded><![CDATA[<p>As many of you know, the BizTalk Team is putting on a BizTalk Summit.</p>  <p>The BizTalk Summit 2012 is a 2 day pre-release event to prepare for the launch of the next version of BizTalk Server. Activities at the summit will include a Keynote by Scott Guthrie, product roadmap, and technical sessions by the Engineering Team, MCS and Partners.</p>  <p>I, along with my co-presenter Michael Muta, will be doing a presentation on Notes from the Field and will include case studies of projects and their architecture (on-premise and hybrid with Azure) along with best practices and how to get your applications ready for the cloud.</p>  <p>This two day event is being held at the Microsoft campus December 10th and 11th.&#160; If you are planning on attending check out the session and stop by and say hello.</p>]]></content:encoded>
    </item>
    <item>
      <title>Blob Storage and Shared Access Signatures</title>
      <link>https://docs.microsoft.com/archive/blogs/skaufman/blob-storage-and-shared-access-signatures</link>
      <pubDate>Mon, 15 Oct 2012 20:02:39 GMT</pubDate>
      <dc:creator><![CDATA[Stephen Kaufman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/skaufman/2012/10/15/blob-storage-and-shared-access-signatures/</guid>
      <description><![CDATA[I am working on a project where we are uploading client files to Azure Blob Storage.&#160; Blob...]]></description>
      <content:encoded><![CDATA[<p>I am working on a project where we are uploading client files to Azure Blob Storage.&#160; Blob storage is perfect for this type of application and uploading them with public access is the default behavior.&#160; Therefore any anonymous client can read blob data out of your container.&#160; This doesn’t work so well for this situation.&#160; Luckily there is the Shared Access Signature feature.&#160; </p>  <p>The Shared Access Signature feature provides a means for you to provide permissions, policies and a time window for those permissions and policies to be valid.&#160; You can also modify or revoke the permissions as necessary.&#160; This is important because Azure storage works by providing a password for your storage account.&#160; Anyone who has that password has access/ownership of your storage account.&#160; That is why you can’t give out your shared key.&#160; The only exception to this is of course if you mark your container public.&#160; The Shared Access Signature features allows you to give permissions but still keep control over security.</p>  <p>So, the Shared Access Signatures provides code that lets us separate the code that signs the request from the execution.&#160; It is implemented as a query string parameter that proves that the creator of the URL is authorized to perform the operations.&#160;&#160; The following <a href="https://msdn.microsoft.com/en-us/library/ee395415.aspx">MSDN</a> article shows how to manually create the signature string.&#160; This is here just so that you can see what is provided and how the string is make up.&#160; In addition, there is another <a href="https://msdn.microsoft.com/en-us/library/hh508996.aspx">MSDN</a> article that shows how to create a shared access signature and provides the following graphic to show the part that make up the query string.</p>  <p>&#160;</p>  <p><img title="Parameter elements of a SAS URL" alt="Parameter elements of a SAS URL" src="https://i.msdn.microsoft.com/dynimg/IC588553.png" /></p>  <p>&#160;</p>  <p>How can we code the blob access (upload and download) to include the Shared Access Signature?&#160; </p>  <p>The following code shows how to upload a file to blob storage using a Shared Access Signature:</p>  <pre class="csharpcode">        <span class="kwrd">public</span> <span class="kwrd">string</span> UploadBlobToAzure(<span class="kwrd">string</span> fileName)
        {
            <span class="kwrd">if</span> (fileName == <span class="kwrd">null</span>)
            {
                <span class="kwrd">throw</span> <span class="kwrd">new</span> ArgumentNullException(<span class="str">&quot;fileName&quot;</span>);
            }

            <span class="kwrd">try</span>
            {
                <span class="rem">// create storage account</span>
                <span class="kwrd">string</span> storageConnnectString = <span class="kwrd">string</span>.Format(<span class="str">&quot;DefaultEndpointsProtocol={0}; AccountName={1}; <br />                       AccountKey={2}&quot;</span>, <span class="str">&quot;http&quot;</span>, ConfigurationManager.AppSettings[<span class="str">&quot;storageAccountName&quot;</span>], <br />                       ConfigurationManager.AppSettings[<span class="str">&quot;storageAccountKey&quot;</span>]);
                var account = CloudStorageAccount.Parse(storageConnnectString);
               
                <span class="rem">// create blob client</span>
                CloudBlobClient blobStorage = account.CreateCloudBlobClient();
                
                <span class="rem">//Get the container.  This is what we will attach the signature to.</span>
                CloudBlobContainer container = blobStorage.GetContainerReference(<span class="str">&quot;&lt;storagecontainername&gt;&quot;</span>);
                container.CreateIfNotExist();

                <span class="rem">//Create the shared access permissions and policy</span>
                BlobContainerPermissions containerPermissions = <span class="kwrd">new</span> BlobContainerPermissions();
                <span class="kwrd">string</span> sas = container.GetSharedAccessSignature(<span class="kwrd">new</span> SharedAccessPolicy()
                    {
                        SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(30), Permissions = <br />                            SharedAccessPermissions.Write | SharedAccessPermissions.Read
                    });
                <span class="rem">//Turn off public access</span>
                containerPermissions.PublicAccess = BlobContainerPublicAccessType.Off;
                container.SetPermissions(containerPermissions);

                <span class="kwrd">string</span> uniqueBlobName = <span class="kwrd">string</span>.Format(<span class="str">@&quot;&lt;storagecontainername&gt;/&lt;filename&gt;_{0}.config&quot;</span>, <br />                       Guid.NewGuid().ToString());

                <span class="rem">//assign the shared access policy</span>
                CloudBlobClient blobClient = <span class="kwrd">new</span> CloudBlobClient(account.BlobEndpoint, <span class="kwrd">new</span> <br />                       StorageCredentialsSharedAccessSignature(sas));

                CloudBlob blb = blobClient.GetBlobReference(uniqueBlobName);

                <span class="rem">//upload the file</span>
                blb.UploadFile(fileName);

                System.Console.WriteLine(<span class="str">&quot;File successfully uploaded to &quot;</span> + blb.Uri);
                <span class="kwrd">return</span> <span class="str">&quot;File successfully uploaded to &quot;</span> + blb.Uri;
            }
            <span class="kwrd">catch</span> (StorageClientException e)
            {
                <span class="kwrd">return</span> <span class="str">&quot;Blob Storage error encountered: &quot;</span> + e.Message;
            }
            <span class="kwrd">catch</span> (Exception e)
            {
                <span class="kwrd">return</span> <span class="str">&quot;Error encountered: &quot;</span> + e.Message;
            }
            <span class="kwrd">finally</span>
            {
            }
        }</pre>


<p>&#160;</p>

<p>Once you upload the file then you can use the following code to access that file and download it locally:</p>

<pre class="csharpcode">        <span class="kwrd">public</span> <span class="kwrd">string</span> DownloadBlobfromAzure(<span class="kwrd">string</span> fileName)
        {
            <span class="kwrd">if</span> (fileName == <span class="kwrd">null</span>)
            {
                <span class="kwrd">throw</span> <span class="kwrd">new</span> ArgumentNullException(<span class="str">&quot;fileName&quot;</span>);
            }

            <span class="kwrd">try</span>
            {
                <span class="rem">// create storage account</span>
                <span class="kwrd">string</span> storageConnnectString = <span class="kwrd">string</span>.Format(<span class="str">&quot;DefaultEndpointsProtocol={0}; AccountName={1}; <br />                          AccountKey={2}&quot;</span>, <span class="str">&quot;http&quot;</span>, ConfigurationManager.AppSettings[<span class="str">&quot;storageAccountName&quot;</span>], <br />                          ConfigurationManager.AppSettings[<span class="str">&quot;storageAccountKey&quot;</span>]);
                var account = CloudStorageAccount.Parse(storageConnnectString);;
                <span class="rem">// create blob client</span>
                CloudBlobClient blobStorage = account.CreateCloudBlobClient();

                CloudBlobContainer container = blobStorage.GetContainerReference(<span class="str">&quot;&lt;storagecontainername&gt;&quot;</span>);
                container.CreateIfNotExist();

                <span class="rem">//Create the shared access permission and policy</span>
                BlobContainerPermissions containerPermissions = <span class="kwrd">new</span> BlobContainerPermissions();
                <span class="kwrd">string</span> sas = container.GetSharedAccessSignature(<span class="kwrd">new</span> SharedAccessPolicy()
                {
                    SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(30),
                    Permissions = SharedAccessPermissions.Write | SharedAccessPermissions.Read
                });
                <span class="rem">//Turn off public access</span>
                containerPermissions.PublicAccess = BlobContainerPublicAccessType.Off;
                container.SetPermissions(containerPermissions);

                <span class="kwrd">string</span> uniqueBlobName = <span class="kwrd">string</span>.Format(fileName);

                <span class="rem">//Assign the shared access policy</span>
                CloudBlobClient blobClient = <span class="kwrd">new</span> CloudBlobClient(account.BlobEndpoint, <span class="kwrd">new</span> <br />                      StorageCredentialsSharedAccessSignature(sas));

                <span class="rem">//Get a point to the blob object</span>
                CloudBlob blb = blobClient.GetBlobReference(uniqueBlobName);

                <span class="kwrd">string</span> fileLocation = <span class="str">@&quot;C:\Documents\&quot;;
                int pos = fileName.IndexOf('/');
                string fname = fileName.Substring(pos + 1, fileName.Length - pos - 1 );

                //Download the blob object
                blb.DownloadToFile(fileLocation + fname);

                System.Console.WriteLine(&quot;</span>File successfully downloaded to <span class="str">&quot; + fileLocation + fname);

                return &quot;</span>File successfully downloaded to <span class="str">&quot; + fileLocation + fname;
            }
            catch (StorageClientException e)
            {
                return &quot;</span>Blob Storage error encountered: <span class="str">&quot; + e.Message;
            }
            catch (Exception e)
            {
                return &quot;</span>Error encountered: &quot; + e.Message;
            }
            <span class="kwrd">finally</span>
            {
            }
        }</pre>


<p>You may have noticed that when we created the policy we didn’t specify a SharedAccessStartTime attribute.&#160; We can specify a start time that policy will be good for or we can leave it off in which case the policy will go into effect immediately.</p>

<p><strong>NOTE</strong>:&#160; The files names are case sensitive.&#160; If you attempt to find a blob and are not using lower case for the file name you will receive a return error </p>

<p>Outer Exception</p>

<p>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.</p>

<p>Inner Exception Message</p>

<p>{&quot;The remote server returned an error: (403) Forbidden.&quot;}</p>]]></content:encoded>
    </item>
    <item>
      <title>Integration Patterns utilizing the Windows Azure Service Bus–Part II</title>
      <link>https://docs.microsoft.com/archive/blogs/skaufman/integration-patterns-utilizing-the-windows-azure-service-buspart-ii</link>
      <pubDate>Mon, 16 Apr 2012 09:47:10 GMT</pubDate>
      <dc:creator><![CDATA[Stephen Kaufman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/skaufman/2012/04/16/integration-patterns-utilizing-the-windows-azure-service-buspart-ii/</guid>
      <description><![CDATA[In the previous post I covered the Messaging Channel group of patterns. In this post, I will cover...]]></description>
      <content:encoded><![CDATA[<p>In the <a href="https://blogs.msdn.com/b/skaufman/archive/2012/04/16/integration-patterns-utilizing-the-windows-azure-service-bus.aspx">previous post</a> I covered the Messaging Channel group of patterns. In this post, I will cover the Message Routing Group patterns.&nbsp; This group contains:</p>  <blockquote>   <p>Content Based Router, Message Filter, Recipient List, Splitter, Aggregator, Resequencer, Composed Message Processor, Scatter-Gather, Process Manager and Message Broker.</p> </blockquote>  <p>So, lets dive right in to each of these patterns and see how these can be implemented.</p>  <p>&nbsp;</p>  <p><font color="#0000ff"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/0003.ContentRouter_14869F97.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/0003.ContentRouter_5F00_14869F97.png"><img style="display: inline; background-image: none;" title="ContentRouter" border="0" alt="ContentRouter" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/4628.ContentRouter_thumb_5B038F9F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/4628.ContentRouter_5F00_thumb_5F00_5B038F9F.png" width="84" height="53"></a>&nbsp; <font size="3">Content-Based Router</font></font> </p>  <p>This pattern requires the the router system inspect each message and direct that message to different channels based on data elements contained in the message.&nbsp; The routing should be configurable to route based on different fields, the existence or non-existence of a specific value and the routing rules should be easily maintained as there are typically frequent changes</p>  <p>This pattern can be implement in Azure using a Service Bus Topic.&nbsp; There are two parts that need to be implemented to put this pattern into use.&nbsp; The first is that subscriptions need to be setup and the second is that a message needs to be created with the specific properties populated to match the subscription which follows the diagram below:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/5773.ContentBasedRouter_289FBC20.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/5773.ContentBasedRouter_5F00_289FBC20.jpg"><img style="display: inline; background-image: none;" title="ContentBasedRouter" border="0" alt="ContentBasedRouter" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/4520.ContentBasedRouter_thumb_67913CBB.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/4520.ContentBasedRouter_5F00_thumb_5F00_67913CBB.jpg" width="385" height="114"></a></p>  <p>&nbsp;</p>  <p>The following code shows to create the subscriptions as well as the submitted message.&nbsp; Let’s first start by creating the subscriptions</p>  <pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> CBRPatternExampleWithTopic(String topicName)
 {
 String serviceNamespace = ....;
 String issuer = ....;
 String key = ....;
 
 SharedSecretCredential credential =.... 
</pre>

<pre class="csharpcode"> ....</pre>

<pre class="csharpcode"> ServiceBusNamespaceClient namespaceClient = <span class="kwrd">new</span> ServiceBusNamespaceClient(serviceBusUri, credential);
 Topic topic = namespaceClient.GetTopic(topicName);</pre>

<pre class="csharpcode"><font color="#4bacc6"> //using the AddSubscription(String, FilterExpression) method overload</font> </pre>

<pre class="csharpcode"> topic.AddSubscription(“PremiumMemberType”,<span class="kwrd">new</span> SqlFilter(<span class="str">"MemberType = Premium"</span>));</pre>

<pre class="csharpcode"><pre class="csharpcode"> topic.AddSubscription(<span class="str">"OtherMemberTypes"</span>, <span class="kwrd">new</span> SqlFilter(<span class="str">"MemberType &lt;&gt; Premium"</span>));</pre><pre class="csharpcode"> }</pre></pre>&nbsp;&nbsp;&nbsp;&nbsp; <p>Then we will create the message with the property populated that the subscriptions will key off of.</p>

<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> SubmitMessageToTopic()
 {
 String issuer = ....;
 String key = ....;
</pre>

<pre class="csharpcode"> TokenProvider tp = TokenProvider.CreateSharedSecretTokenProvider(issuer, key); 
 Uri uri = ServiceBusEnvironment.CreateServiceUri(<span class="str">.., .., ..</span>);

 MessagingFactory factory = MessagingFactory.Create(uri, tp);
 MessageSender myTopic = factory.CreateMessageSender(<span class="str">"&lt;TopicName&gt;"</span>);</pre>


<pre class="csharpcode"> BrokeredMessage message = <span class="kwrd">new</span> BrokeredMessage(); </pre>

<pre class="csharpcode"><font color="#4bacc6"> //This will create a message that will be routed to the first subscription above</font> </pre>

<pre class="csharpcode"> message.Properties.Add(<span class="str">"MemberType"</span>, Premium); </pre>

<pre class="csharpcode"><font color="#4bacc6"> //OR add the following property instead to have it routed to the other subscription above</font></pre>

<pre class="csharpcode">message.Properties.Add(<span class="str">"MemberType"</span>, Gold);</pre>


<pre class="csharpcode">myTopic.Send(message);</pre>


<p>&nbsp;</p>

<p><font color="#0000ff"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/2068.Filter_78956A9E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/2068.Filter_5F00_78956A9E.png"><img style="display: inline; background-image: none;" title="Filter" border="0" alt="Filter" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/1376.Filter_thumb_5F2D6764.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/1376.Filter_5F00_thumb_5F00_5F2D6764.png" width="86" height="54"></a>&nbsp; <font size="3">Message Filter</font></font> </p>

<p>This pattern requires that any message that doesn’t match the criteria of a subscription will be discarded.&nbsp; This pattern is used to eliminate any messages that aren’t routed to a subscriber such as those setup using the Content Based Router pattern.&nbsp; If the message doesn’t fall into a filter used by the subscriber then the message should be routed to a filter channel.&nbsp; </p>

<p>When using an Azure Service Bus Topic you can utilize the RuleDescription object along with the <a href="https://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.filters.filteraction.aspx">FilterAction</a> and <a href="https://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.filters.filterexpression.aspx">FilterExpression</a> objects to setup the subscriber filters.&nbsp; You can explicitly utilize the <a href="https://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.filters.matchnonefilterexpression.aspx">MatchNoneFilterExpression</a> object to subscribe to messages that haven’t been routed to any other subscriber.&nbsp; Once routed to this subscriber you can either log that the message wasn’t picked up and you can either process it or discard the message</p>

<p>The following code shows how to add a subscriber to the Topic for a MatchNoneFilterExpression</p>

<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> AddFilterPatternSubscriptionToTopic(String topicName)
 {
 String serviceNamespace = ....;
 String issuer = ....;
 String key = ....;
 
 SharedSecretCredential credential =.... 
</pre>

<pre class="csharpcode"> ....</pre>

<pre class="csharpcode"> ServiceBusNamespaceClient namespaceClient = <span class="kwrd">new</span> ServiceBusNamespaceClient(serviceBusUri, credential);
 Topic topic = namespaceClient.GetTopic(topicName);</pre>

<pre class="csharpcode"> &lt;place other subscriber code here&gt;</pre>

<pre class="csharpcode"> RuleDescription matchNoneRule = <span class="kwrd">new</span> RuleDescription()
 {
     FilterAction = <span class="kwrd">new</span> SqlFilterAction(“set defer = ‘yes’;”),
     FilterExpression = <span class="kwrd">new</span> MatchNoneFilterExpression()
 };
 </pre>

<pre class="csharpcode"> <font color="#4bacc6">//using the AddSubscription(String, RuleDescription) method overload</font></pre>

<pre class="csharpcode"> Subscription matchNoneFilterSubscription =
 topic.AddSubscription(“matchNoneFilterSubscription”, matchNoneRule);  </pre>

<pre class="csharpcode"> }
</pre>


<pre class="csharpcode">&nbsp;&nbsp; </pre>

<p><font color="#0000ff" size="3"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/3630.DynamicRouter_2CC993E5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/3630.DynamicRouter_5F00_2CC993E5.png"><img style="display: inline; background-image: none;" title="DynamicRouter" border="0" alt="DynamicRouter" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/3146.DynamicRouter_thumb_04B6E4C6.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/3146.DynamicRouter_5F00_thumb_5F00_04B6E4C6.png" width="86" height="54"></a>&nbsp; Dynamic Router</font> </p>

<p> This pattern provides for the scenario in that each recipient would register and list the conditions or rules for which messages or types of messages it can handle.&nbsp; The conditions or rules are stored so that when a message arrives, the rules run and the message parameters are evaluated against the rules and then the message is routed accordingly to the correct receiver.&nbsp; The benefit of this is that you can achieve predictive routing, with eased maintenance and less dependency on each receiver.</p><p>This pattern is implemented in Azure by default in both the Topic and the Queues.&nbsp; When you create a subscription and a receiver for a topic you are registering with the service and as part of that registration process you also provide rules or conditions for the types of messages or the value of properties that you want to filter for.&nbsp; </p><p><strong>But</strong> what if we want to take this a step further and provide even more dynamic functionality.&nbsp; What if we could implement the functionality that is available in BizTalk called <u>Promoted Properties</u> but do it completely within the functionality of Azure.&nbsp; Promoted Properties is a way of taking data contained in the body of an object or message and put that in a properties collection that can then be used to route messages.&nbsp; When working with Azure, the <a href="https://msdn.microsoft.com/en-us/library/windowsazure/microsoft.servicebus.messaging.brokeredmessage.aspx">BrokeredMessage</a> object contains a properties collection that can be used to route however, you manually have to set these properties at design time.&nbsp; Our goal is to take the values of properties in the object body itself and promote those to the BrokeredMessage properties collection so that they can be assigned and routed at run time.</p><p>The subscribers on the Topic still need to be created and registered but this functionality allows the data in the message to direct the flow of the message and provides further dynamic routing scenarios.&nbsp; </p><p>I have been working with Michael Muta (MCS Consultant) and he came up with a great implementation of this pattern.&nbsp; Lets look at how this can be accomplished.&nbsp; </p><p>First, we would create a new class that will be serialized as the message body of the BrokeredMessage.&nbsp; In this case we will create a class for membership.</p><pre class="csharpcode">    [Serializable]
    <span class="kwrd">public</span> <span class="kwrd">class</span> Member
    {
        <span class="kwrd">public</span> Member()
        {
            
        }

        <span class="kwrd">public</span> <span class="kwrd">bool</span> NewMember { get; set; }
        <span class="kwrd">public</span> <span class="kwrd">string</span> Name { get; set; }
        <span class="kwrd">public</span> <span class="kwrd">string</span> Address { get; set; }

        [PromotedProperty(<span class="str">"ReceiveEMail"</span>, PropertyDirection.ReadAndWrite)]   
        <span class="kwrd">public</span> <span class="kwrd">string</span> ReceiveEmailAds { get; set; }

        [PromotedProperty(<span class="str">"Licensed"</span>, PropertyDirection.ReadOnly)]
        <span class="kwrd">public</span> <span class="kwrd">bool</span> Licensed
        {
            get { <span class="kwrd">return</span> (....); }
        }
    }</pre><p>As you can see we have decorated a number of the properties with custom attributes.&nbsp; We decorate every property that we will want to add to the BrokeredMessage properties collection.&nbsp; In addition, we can set the PropertyDirection to either ReadOnly or ReadAndWrite.&nbsp; ReadOnly certainly makes sense – we just need to take a value of the property and promote that into the collection.&nbsp; However, we can take this beyond just static promotion.&nbsp; With the ReadAndWrite we can provide the functionality to update the property as the message is received from the Topic.&nbsp; With the Subscriptions on our Topics we have the ability to perform an action in the rules.&nbsp; In that action we can set the value of a property, and in this case, we can push that modification all that way back to the internal property on the object.&nbsp; We can then use that for other downstream actions in our processing of the message.&nbsp; This give us a lot more flexibility and functionality in our solution.&nbsp; </p><p>After we have our object decorated we can put together the code to send the message.&nbsp; We can take the same method that we used earlier to submit a message but we will do a couple of different things.&nbsp; </p><p>As you will notice, the code to submit the message is pretty much the same – we create the factory, create the message sender, create an instance of our member object and create a BrokeredMessage.&nbsp; In order to get our promoted properties code to work as an extension to the BrokereMessage we needed to utilize the Extension Methods functionality in C#.&nbsp; We needed to do this because the the BrokeredMessage class is sealed.&nbsp; One of the drawbacks of the Extension Methods functionality is that it doesn’t work on the objects constructor.&nbsp; Therefore, we need to call the PromoteProperties method that is placed on the BrokeredMessage class.&nbsp; By doing this, this method will interrogate all of decorated properties on your object and promote them.&nbsp; </p><pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> SubmitMessageToTopic()
 {
 String issuer = ....;
 String key = ....;
</pre><pre class="csharpcode"> TokenProvider tp = TokenProvider.CreateSharedSecretTokenProvider(issuer, key); 
 Uri uri = ServiceBusEnvironment.CreateServiceUri(<span class="str">.., .., ..</span>);

 MessagingFactory factory = MessagingFactory.Create(uri, tp);
 MessageSender myTopic = factory.CreateMessageSender(<span class="str">"&lt;TopicName&gt;"</span>);</pre><pre class="csharpcode"> </pre><pre class="csharpcode"> <font color="#008000">//Create our message body object </font></pre><pre class="csharpcode"> Member memberItem = new Member();</pre>



<pre class="csharpcode"> BrokeredMessage message = <span class="kwrd">new</span> BrokeredMessage(memberItem); </pre><pre class="csharpcode"><font color="#4bacc6"> </font><font color="#008000">//Now that we have created the message and passed in our object we need to do one more thing</font> </pre><pre class="csharpcode"> message.PromoteProperties(memberItem); </pre><pre class="csharpcode"><font color="#4bacc6"> </font><font color="#008000">//even thought we are promoting properties, we can still add properties at design time as usual as shown below</font></pre><pre class="csharpcode"> <font color="#008000">//</font><font color="#008000">message.Properties.Add(<span class="str">"MemberType"</span>, Gold);</font></pre>



<pre class="csharpcode"> myTopic.Send(message);</pre><pre class="csharpcode">}</pre><p>One other item I want to mention in the code above is that even though you promote properties decorated in your object you can still add properties to the BrokeredMessage properties collection at design time as usual.</p><p>&nbsp;</p><p>So, we now have our object decorated and we have the code to submit the message to the Topic.&nbsp; Lets look at the extension method that promotes the properties.</p><pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> PromoteProperties(<span class="kwrd">this</span> BrokeredMessage msg, <span class="kwrd">object</span> serializableObject)
        {
            PropertyInfo[] properties = serializableObject.GetType().GetProperties();

            <span class="kwrd">foreach</span> (PropertyInfo prop <span class="kwrd">in</span> properties)
            {
                <span class="kwrd">foreach</span> (PromotedProperty promotedProp <span class="kwrd">in</span> prop.GetCustomAttributes(<span class="kwrd">typeof</span>(PromotedProperty), <span class="kwrd">true</span>))
                {
                    <span class="kwrd">object</span> <span class="kwrd">value</span> = prop.GetValue(serializableObject, <span class="kwrd">null</span>);
                    msg.Properties.Add(promotedProp.Name, <span class="kwrd">value</span>);
                }
            }
        }</pre>This method loops through the properties in the object, find the promoted properties and adds the value of the property with the name provided in the attribute to the BrokeredMessage’s property collection.&nbsp; There are other other methods in the extension class for things such as setting the properties value for our ReadAndWrite property direction but this gives an overview on how we can add this functionality and provide not only a great implementation of this pattern but also extend the functionality of the Azure Topics and routing functionality.

<p>&nbsp;</p>

<p><font color="#0000ff" size="3"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/5277.RecipientList_0A91885F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/5277.RecipientList_5F00_0A91885F.png"><img style="display: inline; background-image: none;" title="RecipientList" border="0" alt="RecipientList" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/8308.RecipientList_thumb_498308FA.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/8308.RecipientList_5F00_thumb_5F00_498308FA.png" width="86" height="54"></a>&nbsp; Recipient List</font></p>

<p>This pattern is related to the Content Based Router pattern in that the CBR pattern routes messages based on the message content.&nbsp; The Recipient List pattern provides a means for the message to contain a list of one or more recipients to receive the message.&nbsp; This differs from CBR in that we may want to submit a message to multiple order fulfillment suppliers in order to receive back prices thus allowing for the comparison of responses and the selection of the cheapest supplier as shown in the diagram below:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/8311.RecipientList_0C7ED768.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/8311.RecipientList_5F00_0C7ED768.jpg"><img style="display: inline; background-image: none;" title="RecipientList" border="0" alt="RecipientList" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/0474.RecipientList_thumb_47660A31.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/0474.RecipientList_5F00_thumb_5F00_47660A31.jpg" width="367" height="109"></a></p>

<p><font size="2">This pattern can be implemented in the Azure Service Bus Topic very similarly to that of the Content Based Router example.&nbsp;&nbsp; The difference will be that we will create the subscriptions using the SQLFilter but will utilize the LIKE keyword.&nbsp; This way the sender can populate the property with a comma separated list and the subscriptions will pick it up and route to N number of receivers.</font></p>
<font size="2"></font>

<p><font size="2">So, if we created three subscriptions</font></p>

<pre class="csharpcode">topic.AddSubscription(<span class="str">"OtherMemberTypes"</span>, <span class="kwrd">new</span> SqlFilter(<span class="str">"MemberType LIKE ‘%Premium%’"</span>));</pre>

<pre class="csharpcode"><pre class="csharpcode">topic.AddSubscription(<span class="str">"OtherMemberTypes"</span>, <span class="kwrd">new</span> SqlFilter(<span class="str">"MemberType LIKE ‘%Gold%’"</span>));</pre><pre class="csharpcode">topic.AddSubscription(<span class="str">"OtherMemberTypes"</span>, <span class="kwrd">new</span> SqlFilter(<span class="str">"MemberType LIKE ‘%Silver%’"</span>));</pre></pre>

<p><font size="2">and we wanted to create a message that would be routed to Premium and Gold we would create a BrokeredMessage and set the following property:</font></p>

<pre class="csharpcode">message.Properties.Add(<span class="str">"MemberType"</span>, “Premium,Gold”);</pre>

<pre class="csharpcode"><font face="Segoe UI">This would allow us to set, at the client,  the recipients that we wanted to send the message to.</font></pre>


<pre class="csharpcode"> </pre>

<pre class="csharpcode"><font color="#0000ff" size="3" face="Segoe UI"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/6758.Splitter_4A97F219.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/6758.Splitter_5F00_4A97F219.png"><img style="display: inline; background-image: none;" title="Splitter" border="0" alt="Splitter" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/1440.Splitter_thumb_6A46CBE1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/1440.Splitter_5F00_thumb_5F00_6A46CBE1.png" width="86" height="54"></a>  Splitter</font></pre>

<p>This pattern provides the ability to break apart a composite message into its separate message parts and process the related message parts separately.&nbsp; This pattern is useful in scenarios where you might have an order that has many order items and each of the order items need to be sent to different receivers or sent to different inventory systems.&nbsp;&nbsp; </p>

<p>This pattern can be implemented in Azure using the Service Bus Topic or Queue by utilizing the sessions feature.&nbsp; To setup a queue or topic for sessions we need to set the RequiresSession property in the QueueDescription or SubscriptionDescription.&nbsp; Then each message needs a SessionId in order to relate the individual messages.&nbsp; The receiver will read a message and accept the session.&nbsp; Once the session is accepted, the session is locked and other receivers won’t be able accept it.&nbsp; This ensures that there are no competing receivers.&nbsp; One thing to note about sessions and Azure is that session ordering is guaranteed even if the receiver crashes.&nbsp; Another thing to think about is this pattern comes in handy when you need to provide support for sending messages larger than the allowed message size.&nbsp; To send larger message, you can chunk the message into smaller sizes and use the session id in order to receive all the messages in the same session and then reassemble them.</p><p>There is a great example of this that <a href="https://geekswithblogs.net/asmith/archive/2012/04/10/149275.aspx">Alan Smith</a> has put together so I won’t duplicate the effort.&nbsp; Take a look at his blog for an example of implementing this pattern.</p>

<p>&nbsp;</p>

<p><font size="3"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/7823.Aggregator_098972B5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/7823.Aggregator_5F00_098972B5.png"><img style="display: inline; background-image: none;" title="Aggregator" border="0" alt="Aggregator" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/0572.Aggregator_thumb_57259F35.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/0572.Aggregator_5F00_thumb_5F00_57259F35.png" width="86" height="54"></a>&nbsp; <font color="#0000ff">Aggregator</font></font><font color="#0000ff"> </font></p>

<p>This pattern is related to the splitter pattern.&nbsp; Whereas the splitter processes separate messages, the aggregator is used to bring all the separate messages back together.</p>

<p>This pattern can be implemented in Azure using the Service Bus Topic and correlation.&nbsp; When setting up the subscription you can use the CorrelationFilterExpression just as we did with the FilterExpressions in the code samples shown above in previous patterns.&nbsp; So the submitter would set the CorrelationId property of the BrokeredMessage object to an identifier.&nbsp; Then this same identifier would be used in the CorrelationFilter object that was configured when creating the subscription.&nbsp; Also, you will want to know when the processing is finished for this correlation set.&nbsp; You could easily create a custom property on the BrokeredMessage object (as we did previously with the MemberType property) that lists the total number of messages that are in the set or you may just decide to create a flag that states that this is the last message in the set.&nbsp; Once the total count has been received or the message containing the flag is received then you can perform whatever task is required to aggregate all the messages together.</p>

<p>You might ask, why use Correlation over Session.&nbsp; The CorrelationId property provides an exact match, the CorrelationId is saved in a hash table and the CorrelationId processing is better optimized for matching performance than the SQL expression filters.</p>

<p>There is a great example of this that <a href="https://geekswithblogs.net/asmith/archive/2012/04/10/149275.aspx">Alan Smith</a> has put together that is in the same article as his Splitter implementation so I won’t duplicate the effort.  Take a look at his blog for an example of implementing this pattern.</p>

<p>&nbsp;</p>

<p><font color="#0000ff" size="3">&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/4760.resequencer_48E72645.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/4760.resequencer_5F00_48E72645.png"><img style="display: inline; background-image: none;" title="resequencer" border="0" alt="resequencer" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/7801.resequencer_thumb_67BD9A23.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/7801.resequencer_5F00_thumb_5F00_67BD9A23.png" width="94" height="54"></a> Resequencer </font></p>

<p>The Resequencer pattern provides guidance around putting messages back in order.&nbsp; Individual messages may be processed by a downstream system and returned faster than other downstream systems can process their messages and thus leading to messages that are out of order.&nbsp; This pattern uses a buffer to store messages so that they can be resequenced.&nbsp; Typically the Resequencer does not modify the message in any way.&nbsp; Once in the required order, the messages can be delivered as shown in the following diagram.&nbsp; </p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/5658.Resequencer_0289C030.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/5658.Resequencer_5F00_0289C030.jpg"><img style="border: 0px currentcolor; display: inline; background-image: none;" title="Resequencer" border="0" alt="Resequencer" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/3000.Resequencer_thumb_45858E9D.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/3000.Resequencer_5F00_thumb_5F00_45858E9D.jpg" width="580" height="153"></a></p>

<p>&nbsp;</p>

<p>This pattern can be implemented in Azure through a Service Bus Queue.&nbsp; The queue becomes the buffer to not only store the messages that are submitted but also to store the messages that are out of order.&nbsp; There are a number of steps that will be required to put this pattern in practice.&nbsp; First, there is no change to the code that is used to submit the messages to the queue however you will need to populate the MessageId property of the BrokeredMessage object.&nbsp; While there is nothing out of the ordinary to submit, there is a bit of work to be done by the receiver.&nbsp; Next, we are going to take advantage of the Defer() method which will allow us to put a message back on to the queue that we detect is in the wrong sequence.&nbsp; Then we can dequeue it later when we need that message by calling the receive message and passing in the message sequence.&nbsp; This means that we need to keep a list of message sequence numbers in our code.&nbsp; One thing to note is that once we defer a message and put it back on the queue the only way that we can retrieve it again is to call the receive and pass in the sequence number.&nbsp; Another thing to note is that the Service Bus Sequencing may be different than the applications sequence numbering.&nbsp; Therefore you may need to store both in either session state or an internal list.</p>

<p>Lets look at the code to put this pattern into place.&nbsp; </p>

<p>First, let’s look at what is needed to send the message to the queue.</p><pre class="csharpcode"><span class="kwrd"> string</span> issuer = <span class="str">"...."</span>;
 <span class="kwrd">string</span> key = <span class="str">"...."</span>;

 <span class="rem">//create the token provider and URI that are needed to send to the MessagingFactory</span>
 TokenProvider tp = TokenProvider.CreateSharedSecretTokenProvider(issuer, key); 
 Uri uri = ServiceBusEnvironment.CreateServiceUri(<span class="str">"sb"</span>, <span class="str">"&lt;ServiceNamespace&gt;"</span>, <span class="kwrd">string</span>.Empty);

 <span class="rem">//retrieve the MessageSender for the SeqQueue within the namespace</span>
 MessagingFactory factory = MessagingFactory.Create(uri, tp);
 MessageSender SeqQueue = factory.CreateMessageSender(<span class="str">"SeqQueue"</span>);</pre><pre class="csharpcode"><span class="rem"> //create a message and use a string for the body.  We will put the sequence here as well as in a property.</span>
 BrokeredMessage message1 = <span class="kwrd">new</span> BrokeredMessage(<span class="str">"MessageSequence 1”</span>);

 <span class="rem">//set some additional custom app-specific properties</span>
 message.Properties[<span class="str">"MessageNumber"</span>] = <span class="str">"1"</span>;
 message.Properties[<span class="str">"TotalMsgsInSequence"</span>] = <span class="str">"3"</span>;   
<span class="rem"> //send the first message to the queue</span>
 SeqQueue.Send(message1);</pre><pre class="csharpcode">&nbsp;</pre><pre class="csharpcode"><span class="rem">//create the next message in the sequence. This message will be out of order.</span>
 BrokeredMessage message3 = <span class="kwrd">new</span> BrokeredMessage(<span class="str">"MessageSequence 3”</span>);
 message.Properties[<span class="str">"MessageNumber"</span>] = <span class="str">"3"</span>;
 message.Properties[<span class="str">"TotalMsgsInSequence"</span>] = <span class="str">"3"</span>;   
<span class="rem"> //send the first message to the queue</span>
 SeqQueue.Send(message3);</pre><pre class="csharpcode"><span class="rem">//create the last message in the sequence.</span>
 BrokeredMessage message2 = <span class="kwrd">new</span> BrokeredMessage(<span class="str">"MessageSequence 2”</span>);
 message.Properties[<span class="str">"MessageNumber"</span>] = <span class="str">"2"</span>;
 message.Properties[<span class="str">"TotalMsgsInSequence"</span>] = <span class="str">"3"</span>;   
<span class="rem"> //send the first message to the queue</span>
 SeqQueue.Send(message2);</pre><pre class="csharpcode"></pre><p>Now we have three messages in our queue that are out of order.&nbsp; Next, let’s look at what is needed to receive the message and process them in order.&nbsp; By the way, I will be utilizing the <a href="https://msdn.microsoft.com/en-us/library/windowsazure/microsoft.servicebus.messaging.queueclient.aspx">QueueClient</a> object as this supports more advanced features (including sessions).</p><pre class="csharpcode"><span class="kwrd">private</span> <span class="kwrd">static</span> <span class="kwrd">void</span> ReadMessagesFromQueue()</pre><pre class="csharpcode">{</pre><pre class="csharpcode">.... </pre>

<pre class="csharpcode"><span class="rem">// Read messages from queue until queue is empty: </span>
 
MessageReceiver Qreceiver = queueClient.CreateReceiver(); 
List&lt;MessageReceipt&gt; MessageReceiptsDeferred = <span class="kwrd">new</span> List&lt;MessageReceipt&gt;(); 
 
BrokeredMessage receivedMessage; 
<span class="kwrd">while</span> (Qreceiver.TryReceive(TimeSpan.FromSeconds(10), <span class="kwrd">out</span> receivedMessage)) 
{ 
     </pre><pre class="csharpcode">  msgCount++;
<span class="rem">  //check the received message and determine if it is in the sequence we need </span>
  <span class="kwrd">if</span> (receivedMessage.Properties[<span class="str">"MessageNumber"</span>].ToString() == msgCount) 
  { 
     
     ProcessEachMessage(receivedMessage); 
  } 
<span class="kwrd">  else</span> 
  { 
     receivedMessage.Defer();</pre><pre class="csharpcode">     <span class="rem">//store the message receipt for later </span>
     MessageReceiptsDeferred.Add(receivedMessage.MessageReceipt); 
  } 
} 
 
 
<span class="rem">//we have now processed messages 1 and 2.  We need to go back and get message 3. </span>
<span class="kwrd">foreach</span> (MessageReceipt receipt <span class="kwrd">in</span> MessageReceiptsDeferred) 
{ 
      ProcessEachMessage(Qreceiver.Receive(receipt)); 
} 
 
 
Qreceiver.Close(); 
 
 
</pre><pre class="csharpcode"><span class="kwrd">}</span></pre><pre class="csharpcode"><span class="kwrd">private</span> <span class="kwrd">static</span> <span class="kwrd">void</span> ProcessEachMessage(BrokeredMessage message) 
{ 
         <span class="rem">//This is where we do the work we need to on the messages (i.e., reassemble, send off to a LOB system, etc.)</span></pre><pre class="csharpcode"><span class="rem">         //Do your work here</span></pre><pre class="csharpcode">       
         message.Complete(); 
} 
 </pre>


<p>&nbsp;</p>

<p>This example shows you how we can put this pattern into code.&nbsp; As with all code examples, there is still work that needs to be done to this code if you are going to use this as a sample.&nbsp; </p><p>As you think about putting this pattern into practice, it could be useful for situations in which you want to process messages that have high and low priority all on one queue.&nbsp; You may not know what order the messages are submitted but you can receive all the messages, process the ones marked as high priority and defer the other submitted messages and then go back and process those messages after all the high priority messages have been drained.</p>

<p>&nbsp;</p>

<p><font color="#0000ff" size="3"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/0535.Composed_6B7B3EF3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/0535.Composed_5F00_6B7B3EF3.png"><img style="display: inline; background-image: none;" title="Composed" border="0" alt="Composed" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/2117.Composed_thumb_43688FD4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/2117.Composed_5F00_thumb_5F00_43688FD4.png" width="86" height="54"></a>&nbsp; Composed Msg. Processor</font> </p>

<p>This pattern provides guidance for message processing where there are a number of sub messages (i.e., order line items) that need to be routed to individual destinations, processed, returned and aggregated back into a single message.&nbsp; This pattern is composed of a number of other patterns that include the Splitter, Content Based Router and Aggregator.</p><p>Because this pattern utilizes patterns already covered in this article I won’t duplicate the code as that can be found in each patterns implementation.&nbsp; However, I will include a diagram that shows how these patterns can come together to create this complex pattern.</p><p>&nbsp;</p><p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/0535.ComposedMessageProcessor_5E34B5E0.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/0535.ComposedMessageProcessor_5F00_5E34B5E0.jpg"><img style="border: 0px currentcolor; display: inline; background-image: none;" title="ComposedMessageProcessor" border="0" alt="ComposedMessageProcessor" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/8867.ComposedMessageProcessor_thumb_159AC70F.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/8867.ComposedMessageProcessor_5F00_thumb_5F00_159AC70F.jpg" width="746" height="339"></a></p>

<p>&nbsp;</p><p><font color="#0000ff" size="3">Scatter-Gather</font> </p>

<p>This pattern outlines how a single message can be sent to many receivers, or a message may be split and its parts sent to many receivers so that one of many external providers may process the message.&nbsp; Once the message has been processed and returned then the messages need to be aggregated and brought back into one message that will be processed.&nbsp; Think of an order that could be fulfilled by a number of suppliers.&nbsp; You can scatter the messages to those suppliers and gather all the responses and decide if you are going to take the first message returned and continue processing or if you analyze all the responses and take the lowest cost supplier.&nbsp; Either way, once you have received all the messages you will take the message and send it on to the next step in the process.</p><p>To put this pattern in practice we can take implementations of other patterns.&nbsp; The scatter portion can be implemented through the use of the Splitter pattern whereas the Gather portion can be implemented through the use of the Aggregator pattern.&nbsp; Both of which are covered above.</p><p>&nbsp;</p><p><font color="#0000ff" size="3"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/4744.ProcessMgr_6D1BE4FA.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/4744.ProcessMgr_5F00_6D1BE4FA.png"><img style="display: inline; background-image: none;" title="ProcessMgr" border="0" alt="ProcessMgr" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/0042.ProcessMgr_thumb_72F68893.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/0042.ProcessMgr_5F00_thumb_5F00_72F68893.png" width="86" height="54"></a>&nbsp; Process Manager</font> </p><p>The process manager pattern outlines how you send a message through a number of processing steps that aren’t known at design time. These steps may not even be sequential.&nbsp; In addition, the sequence of the processing steps may also be modified based on the results of the previously executed processing step.</p><p>To put this pattern into practice you can utilized Windows Workflow.&nbsp; There are a number of blog articles showing how you can implement the currently released version of WF 4 in your code and deploy it to Azure.&nbsp; In addition, there was a <a href="https://blogs.msdn.com/b/appfabric/archive/2011/06/20/announcing-the-windows-azure-appfabric-june-ctp.aspx">CTP</a> of WF in Azure that was released last summer.&nbsp; Lastly, there is also the <a href="https://blogs.msdn.com/b/windowsazure/archive/2011/09/01/now-available-workflow-foundation-windows-azure-activity-pack-ctp-1.aspx">Workflow Activity Pack for Windows Azure</a> that allows you to run WF on-premises and interact with artifacts in Azure.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p>]]></content:encoded>
    </item>
    <item>
      <title>Integration Patterns utilizing the Windows Azure Service Bus</title>
      <link>https://docs.microsoft.com/archive/blogs/skaufman/integration-patterns-utilizing-the-windows-azure-service-bus</link>
      <pubDate>Mon, 16 Apr 2012 09:36:56 GMT</pubDate>
      <dc:creator><![CDATA[Stephen Kaufman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/skaufman/2012/04/16/integration-patterns-utilizing-the-windows-azure-service-bus/</guid>
      <description><![CDATA[For years we have all utilized Gregor Hohpe’s Enterprise Integration Patterns book (and the web...]]></description>
      <content:encoded><![CDATA[<p>For years we have all utilized Gregor Hohpe’s Enterprise Integration Patterns book (and the <a href="https://www.enterpriseintegrationpatterns.com/">web site</a>).&#160; Many of these patterns, if not most, are well known and there are many resources out there that talk about how these patterns can be implemented.&#160; There are also a number of resources that talk about how these patterns can be implemented in BizTalk or Windows Server AppFabric.&#160; </p>  <p>However, there is very little that shows how these patterns can be implemented using the Windows Azure Service Bus.&#160; This two part series will take a patterns first&#160; look at how these different patterns can be implemented.&#160; </p>  <p>The patterns that will be covered in this post will focus on the Messaging Channel groupings.&#160; The patterns in that fall in the Messaging Channel group contain:</p>  <blockquote>   <p>Point to Point, Publish/Subscribe, Datatype Channel, Invalid Message Channel, Dead Letter Channel, Guaranteed Delivery, Channel Adapter, Messaging Bridge and Message Bus.&#160;&#160; </p> </blockquote>  <p>In the next post we will focus on the patterns that fall in the Message Routing group, which contain:</p>  <blockquote>   <p>Content Based Router, Message Filter, Recipient List, Splitter, Aggregator, Resequencer, Composed Message Processor, Scatter-Gather, Process Manager and Message Broker.</p> </blockquote>  <p>There is also the Messaging Systems group of patterns but those are being addressed with the Azure Integration Components (that is currently in CTP).&#160; As those components get closer to release I will cover those patterns as well.</p>  <p>Lets start out by looking at each of the patterns in the Messaging Channel Group including a description of the pattern and then how it can be implemented.</p>  <p><font color="#0000ff">Point-to-Point Channel</font> requires that only one receiver gets the message.&#160; If there are multiple receivers, then only one must still get the message.&#160; This functionality can be done directly through WCF (the Service Bus can also be included by hosting the WCF service).&#160; This pattern can also be accomplished through the use of the Service Bus Queue and controlling what services are listening. </p>  <p><font color="#0000ff">Publish-Subscribe Channel</font> requires that the message or event sent to the channel will be delivered to each and every receiver.&#160; Once the receiver obtains a copy of the message it is removed from the channel.&#160; This can be implemented through the use of Service Topics.&#160; </p>  <p>A Service Bus Topic can have multiple subscriptions with each subscription being able to be individually managed.&#160; The subscriber receive all messages, based on filters, that are sent once the subscriber is created.&#160; If a message satisfies the filter criteria for more than one subscriber the message will be delivered to each subscriber and then onto the receiver.&#160; When a message needs to be delivered to more than one subscriber, the message is not duplicated.&#160; The meta data for the filter/subscriptions is stored and is tracked based on which subscriber/receiver has received the message.&#160; In terms of removing it from the channel, think of the concept of ref counts.&#160; One other thing to keep in mind is that if the Receiver is not online to receive the message, then it is stored until the receiver comes on-line.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/7167.pubsub_281B5546.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/7167.pubsub_5F00_281B5546.jpg"><img style="border: 0px currentcolor; display: inline; background-image: none;" title="pubsub" border="0" alt="pubsub" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/0880.pubsub_thumb_78E969AE.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/0880.pubsub_5F00_thumb_5F00_78E969AE.jpg" width="363" height="121" /></a></p>  <p><font color="#0000ff">Datatype Channel</font> requires that each channel will contain the same type of data.&#160; Thereby when the receiver obtains a message from the channel it will always be the same type.&#160; This can be accomplished with directly with WCF (the Service Bus can also be included by hosting the WCF service).&#160;&#160; </p>  <p>In addition, an Azure Queue can also be utilized.&#160; You can create a new queue for each type of message that will flow through the queue.&#160; </p>  <p><font color="#0000ff">Invalid Message Channel</font> requires that a message that is deemed to be invalid be moved to a Invalid Message Channel where they will not be processed by the normal receiver.</p>  <p>The Azure Queue implements the dead letter queue concept and uses the $DeadLetterQueue subqueue to store invalid messages.&#160; Messages are placed in the dead letter subqueue:</p>  <blockquote>   <p>When a message expires and deadlettering for expired messages is set to true in a queue or subscription.      <br />When the max delivery count for a message is exceeded on a queue or subscription.       <br />When a filter evaluation exception occurs in a subscription and deadlettering is enabled on filter evaluation exceptions</p> </blockquote>  <p>To get to the dead letter queue you would use:</p>  <div>   <blockquote>     <pre class="csharpcode"><span class="kwrd">string</span> queueDeadletterPath = <font color="#006080">QueueClient</font>.FormatDeadLetterPath(<span class="str">&quot;<font color="#d16349">&lt;your queue name&gt;</font>&quot;</span>);</pre>
  </blockquote>
  </div>

<p>the same behavior is available with Topics.&#160; However, to get to the dead letter queue for a topic you would use:</p>

<blockquote>
  <pre class="csharpcode"><span class="kwrd">string</span> subscriptionDeadletterPath = <font color="#006080">SubscriptionClient</font>.FormatDeadLetterPath(<span class="str">&quot;<font color="#c0504d">&lt;Your Topic Name&gt;</font>&quot;</span>, <span class="str">&quot;<font color="#c0504d">&lt;Subscription Name&gt;</font>&quot;</span>);</pre>
</blockquote>


<p><font color="#0000ff">Dead Letter Channel</font> requires that if the system can’t deliver a message there is a mechanism to move the message to a dead letter channel.&#160; This capability is handled like the Invalid Message Channel above.&#160; However, check out this link from MSDN on the <a href="https://msdn.microsoft.com/en-us/library/microsoft.servicebus.queuepolicy.poisonmessagedrop.aspx">QueuePolicy.PoisonMessageDrop</a> property.&#160; It points to the prerelease documentation but it is interesting to read what is being planned.&#160; </p>

<p><font color="#0000ff">Guaranteed Delivery</font> requires that the system persists the message so that it is not lost if there is a crash or outage.&#160; In using the Service Bus Queues, you are ensured of guaranteed delivery as the queue uses SQL Azure as the backing store.</p>

<p><font color="#0000ff">Channel Adapter</font> requires that there is an interface so that any application can connect and be integrated with other applications.&#160; The Service Bus Queues and Topics both provide a full API that can be utilized by a number of different technologies.</p>

<p><font color="#0000ff">Messaging Bridge</font> provides a connection between different messaging systems.&#160; Essentially to transmit message that was intended for another messaging system.&#160; This can be done through either the Service Bus Queues or Topics with the receiver getting the message and forwarding it to endpoints provided by the other messaging system.&#160; In addition, the receiver can get the message and forward it on to on-premise messaging systems through WCF.</p>

<p><font color="#0000ff">Message Bus</font> provides a means for separate application to work together in a decoupled manner with the ability for the applications to be added or removed with no affect on any other applications.&#160; The ability to be decoupled but still allowing the application to work together, share data and operate in a unified manner is the basis for this pattern.&#160; This pattern can be easily implemented through the Azure Service Bus and WCF endpoints.&#160; We will come back to this pattern again when we spend more time covering the integration components. </p>

<p>In this post I have talked about the Service Bus Queue, but there is still some confusion between the Windows Azure Queue and the Service Bus Queue.&#160; Yes, there are two Queues and they are different and have different uses and purposes.&#160; Everything I have been referring to here is in reference to the Service Bus Queue.&#160; You can find more information on the differences between Azure Queues and Azure Service Bus Queues in this article - <a href="https://msdn.microsoft.com/library/windowsazure/hh767287(v=vs.103).aspx">Windows Azure Queues and Windows Azure Service Bus Queues - Compared and Contrasted</a>.</p>

<p>Lastly, in talking about Gregor Hohpe and his patterns book, there are a number of diagrams that are utilized that represent the patterns.&#160; These diagrams can be downloaded and used in Visio which you can find at <a title="https://www.eaipatterns.com/downloads.html" href="https://www.eaipatterns.com/downloads.html">https://www.eaipatterns.com/downloads.html</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Services Hosted in Windows Azure Service Bus</title>
      <link>https://docs.microsoft.com/archive/blogs/skaufman/services-hosted-in-windows-azure-service-bus</link>
      <pubDate>Tue, 20 Mar 2012 12:50:45 GMT</pubDate>
      <dc:creator><![CDATA[Stephen Kaufman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/skaufman/2012/03/20/services-hosted-in-windows-azure-service-bus/</guid>
      <description><![CDATA[In my last post, I talked about the BizTalk AppFabric Connect for Services functionality for...]]></description>
      <content:encoded><![CDATA[<p>In my <a href="https://blogs.msdn.com/b/skaufman/archive/2012/03/20/biztalk-appfabric-connect-for-services.aspx">last post</a>, I talked about the BizTalk AppFabric Connect for Services functionality for BizTalk.&#160; As you start to make your services accessible through the cloud you may find that you hit an error when you try to access the endpoint.&#160; You might also find that your endpoint doesn’t show up in the Windows Azure Portal.&#160; </p>  <p>In my case, I saw this error, in the screen shot below, when I clicked on the URL for my service in the AppFabric portal. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/4760.clip_image002_3E574BF4.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/4760.clip_5F00_image002_5F00_3E574BF4.jpg"><img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="clip_image002" border="0" alt="clip_image002" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/0385.clip_image002_thumb_71B30F50.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/0385.clip_5F00_image002_5F00_thumb_5F00_71B30F50.jpg" width="527" height="374" /></a></p>  <p>Then I saw that I had the following error in the Event Log. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/6648.clip_image0025_16D059BD.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/6648.clip_5F00_image0025_5F00_16D059BD.jpg"><img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="clip_image002[5]" border="0" alt="clip_image002[5]" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/35/47/metablogapi/0044.clip_image0025_thumb_20B54B28.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-35-47-metablogapi/0044.clip_5F00_image0025_5F00_thumb_5F00_20B54B28.jpg" width="530" height="521" /></a></p>  <p>I knew why the error in the Event Log was showing up.&#160; I have Windows Server AppFabric installed and had configured my service to Auto-Start.&#160; What I didn’t know was why I was getting the underlying error of not being able to reach watchdog.servicebus.windows.net.&#160; After doing a lot of searching on-line I couldn’t find anything that could solve the problem.</p>  <p>So, after talking to a member of the dev team who created the wizard functionality we found a fix.&#160; It turns out you will get this error when the service can not communicate with Azure.&#160; Since I had a proxy server in the mix, the fix was to add an entry in the config file in order for communications to flow through the proxy server.&#160; When the wizard completed it created a set of artifacts in IIS including a config file.&#160; Open that config file and we will add the entry below and place it just before the system.web section.</p>  <p>...    <br />&lt;connectionString /&gt;     <br />    <br />&lt;system.net&gt;     <br />&#160;&#160; &lt;defaultProxy useDefaultCredentials=<span class="str">&quot;true&quot;</span>&gt;     <br />&#160;&#160;&#160;&#160;&#160; &lt;proxy proxyaddress=<span class="str">&quot;[your proxy address here]&quot;</span> /&gt;     <br />&#160;&#160; &lt;/defaultProxy&gt;     <br />&lt;/system.net&gt;     <br />    <br />&lt;system.web&gt;     <br />...</p>    <p>Enter your proxy address and you should see this error go away.</p>]]></content:encoded>
    </item>
    <item>
      <title>BizTalk AppFabric Connect For Services</title>
      <link>https://docs.microsoft.com/archive/blogs/skaufman/biztalk-appfabric-connect-for-services</link>
      <pubDate>Tue, 20 Mar 2012 12:36:10 GMT</pubDate>
      <dc:creator><![CDATA[Stephen Kaufman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/skaufman/2012/03/20/biztalk-appfabric-connect-for-services/</guid>
      <description><![CDATA[Last week I spoke at the Twin Cities Connected Systems User Group Meeting.&#160; The title of my...]]></description>
      <content:encoded><![CDATA[<p>Last week I spoke at the Twin Cities Connected Systems User Group Meeting.&#160; The title of my presentation was Integration with Windows Azure – Connecting to the Cloud.&#160; During my presentation I talked about ways to expand on-premise applications to the cloud as well as how to connect cloud applications back to on-premise resources.&#160; As part of my presentation I talked about the functionality provided through the BizTalk AppFabric Connect for Services.&#160; There were a number of people that hadn’t heard of it so this entry talks about what it is and how it can be used.</p>  <p>So, as you build your composite applications, or just look to extend your current application, you may want to take advantage of the benefits offered by extending your application to Windows Azure.&#160; This will let you leverage your existing on-premise artifacts, and LOB systems, in order to expose them and extend their reach to external clients in a secure manner.</p>  <p>Microsoft released the <a href="https://www.microsoft.com/downloads/en/details.aspx?FamilyID=f7735a19-cdb3-4f52-8e7b-c58f04c5c86a">BizTalk Server 2010 AppFabric Connect for Services</a> as a new feature for BizTalk 2010 which provides functionality to expose your BizTalk artifacts (schemas and Orchestrations) as WCF Services exposed through the Windows Azure cloud.&#160; This new functionality is exposed through changes to the BizTalk WCF Service Publishing Wizard.&#160; When you run this wizard you will see a number of new screens in addition to the screens that you are already familiar with.</p>  <p>To expose BizTalk services to Windows Azure, specifically Windows Azure ServiceBus, you will need to have a few prerequisite components installed.&#160; </p>  <p>First, of course, you must have BizTalk 2010 and the BizTalk development tools installed on the machine where the AppFabric Connect for Service feature will be used.</p>  <p>Next, you must have the Windows Azure AppFabric SDK (1.0 or later) installed.</p>  <p>Lastly, there are benefits of having Windows Server AppFabric installed.&#160; While this is not a requirement, it makes configuration setting easier (such as Auto-Start).</p>  <p>After all the pre-requisites have been installed, you will need a Windows Azure account and you will need to create a namespace for the Service Bus in the Azure Portal.&#160; </p>  <p>Once this is done then you can start the wizard and walk through each of the screens.&#160; The wizard walks you through selecting the type of endpoint (service or metadata) – as it did previously.&#160; The next screen will be a new screen which will fork between the functionality of the old wizard (exposing web services on-premise only) or to sprinkle in the new screens to allow you to expose the services to the cloud.&#160; This screen presents a single checkbox asking if you want to add a Service Bus endpoint.&#160; It also reminds you that you need to have a ServiceBus service namespace.&#160; Select the checkbox (otherwise there is really no need to keep reading this post).&#160; The next five screens are the same as the screen in the original wizard (select either schemas or Orchestrations, select the assembly, select the public ports, assign the target namespace (and remember to check allow anonymous access)).&#160; One thing that I found very helpful is that the wizard will take all of the selected ports and merge them into a single WCF service.&#160; The last two screens are specific to the configuration of the Service Bus.&#160; </p>  <p>The first is the Endpoint Configuration.</p>  <p><img border="0" alt="" src="https://social.technet.microsoft.com/wiki/cfs-file.ashx/__key/CommunityServer-Wikis-Components-Files/00-00-00-00-05/4530.Screen_5F00_8.jpg" /></p>  <p>There are a number of options that will effect the output of the wizard.&#160; The first is the Relay Binding option and you have three choices – BasicHTTPRelayBinding, NetTcpRelayBinding, and the WS2007HttpRelayBinding.&#160; The Service Namespace is the namespace that you created in the Azure portal.&#160; I am sure that this goes without saying but what you enter here must match with the name you created in the Portal.&#160; </p>  <p>The Enable Discover checkbox lets the services you are exposing be publicly discoverable through the ATOM feed page created by Azure for your Azure Service Bus account.&#160; </p>  <p>Lastly, the Enable metadata exchange on cloud tells the wizard to create the metadata endpoint in the cloud so that external clients can generate a proxy for your service.</p>  <p>The next screen takes the authentication information that you can find on the portal site.&#160; </p>  <p><img border="0" alt="" src="https://social.technet.microsoft.com/wiki/cfs-file.ashx/__key/CommunityServer-Wikis-Components-Files/00-00-00-00-05/0601.Screen_5F00_9_5F00_2.jpg" /></p>  <p>You will need to enter the Issuer Name and Key.&#160; When you created the namespace in the Azure ServiceBus the issuer name defaults to owner.&#160; Enter both the Name and Key into the text boxes.&#160; The first checkbox controls whether the consumer needs to authenticate using to the relay service to consume the endpoint.&#160; The second checkbox controls the same but for the metadata endpoint.&#160; Since you are charged per access to your endpoints you may want to set these to prevent unauthorized access.</p>  <p>Click Next and Finish to complete the wizard.&#160; Once it is finished you will have a new Receive Port/Location and a site in IIS.&#160; However, there are still a number of important steps that need to be done in order for your service to work.</p>  <p>If you created a service based on an Orchestration then you need to bind the port to the orchestration in the BizTalk Administrator.&#160; You will also need to Enable the Receive Location and Enlist the Orchestration.</p>  <p>Next we move to IIS.&#160; We need to have an Application Pool that is configured to use the .NET Framework 4.0 with the Pipeline set to Integrated.&#160; Set the site to use the Application Pool by right clicking on the site that was created.&#160; In the popup menu, select Manage Application and then click on Advanced Settings.&#160; When the Advanced settings dialog box appears change the Application Pool to use the one you just created.</p>  <p>Lastly, we need to start our service.&#160; If you are running IIS 7.5 (Windows 7 or Windows Server 2008 R2) then you can configure Auto-Start.&#160; If you are running a different OS version then you will need to start the services using the on-premise endpoint with a local client.&#160; Once the service is started it will make contact with Windows Azure and register the service.&#160; One thing to note is that this is the first time in the entire process that your service has communicated with Azure.</p>  <p>If you have Windows Server AppFabric installed then configuring Auto-Start if very simple.&#160; To do this, right click on your site and select Manage WCF and WF Services in the popup menu, then click the configure item in the fly out menu.&#160; When the dialog box appears, select Auto-Start from the left hand side and then click the Enabled radio button.</p>  <p>You are now ready to test your endpoint.&#160; Point your browser to <a href="https://&lt;servicebusnamespace&gt;.servicebus.windows.net">.servicebus.windows.net&quot;&gt;.servicebus.windows.net&quot;&gt;https://&lt;servicebusnamespace&gt;.servicebus.windows.net</a>.&#160; You should see the ATOM feed page and your service should be listed.&#160; You can click on the service and you should see a new page with your service and MEX endpoint.&#160; You can now consume this endpoint the same is if it were on-premise.</p>]]></content:encoded>
    </item>
    <item>
      <title>Can you move a Virtual Machine from VirtualPC to Hyper-V?</title>
      <link>https://docs.microsoft.com/archive/blogs/skaufman/can-you-move-a-virtual-machine-from-virtualpc-to-hyper-v</link>
      <pubDate>Wed, 18 Jan 2012 16:31:43 GMT</pubDate>
      <dc:creator><![CDATA[Stephen Kaufman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/skaufman/2012/01/18/can-you-move-a-virtual-machine-from-virtualpc-to-hyper-v/</guid>
      <description><![CDATA[I was recently asked if I could help move a virtual machine that had been setup and running in...]]></description>
      <content:encoded><![CDATA[<p>I was recently asked if I could help move a virtual machine that had been setup and running in VirtualPC and move it to run under Hyper-V.&#160; </p>  <p>The answer is yes it can be done.&#160; Movement from Hyper-V to VirtualPC is not as easy (and many times not possible) but there are a number of blog posts on this topic already so I won’t cover that here.&#160; One of the reasons that it is easier to move from VirtualPC to Hyper-V is that VirtualPC is only 32 bit.&#160; </p>  <p>There are a number of steps that must be occur for a successful move. </p>  <p>First, start by uninstalling the integration components while the virtual machine is running in VirtualPC.&#160; You can do this through the Add/Remove programs feature in Windows in the Virtual Machine.&#160; The Hyper-V drivers and additions will not install over the VirtualPC additions and that is why you must remove them first.</p>  <p>Next, move the vhd file to a location where it can be accessed by your Hyper-V instance.&#160; Walk through the wizard to create a new virtual machine but when prompted to create a new drive or select and existing drive, pick select an existing drive and point it to your .vhd file.</p>  <p>Finally, once you have the virtual machine configured in your Hyper-V instance then start the machine.&#160; Go through the Settings Menu and install the Hyper-V additions.&#160; Once you do this, the Hyper-V additions installs a new HAL as well as new drivers for network, video and sound devices.&#160; The process of installing the new HAL is one of the reasons that a Hyper-V image is no longer portable back to VirtualPC.</p>  <p>However, at this point, you might think that everything is done and you are ready to use the virtual machine.&#160; Most of the time this is correct, however, there are situations that require additional steps.&#160; You will know that you have additional steps if your integration components aren’t working – you can tell really quickly if your mouse doesn’t move outside of the virtual machine.</p>  <p>You are more likely to have this occur if your virtual machine is running versions of Windows prior to Vista or if you are running Windows Server 2008 as these do not have the ability to dynamically detect the HAL at boot time.</p>  <p>So, to fix this run MSConfig.exe – by clicking the Start menu, selecting Run and typing msconfig.&#160; Once the utility launches, click on the Boot tab and click the Advanced Options Button.&#160; When the BOOT Advanced Options dialog appears, click the Detect HAL checkbox and hit ok.&#160; Restart the virtual machine and you should be good to go!</p>]]></content:encoded>
    </item>
    <item>
      <title>Composite Applications</title>
      <link>https://docs.microsoft.com/archive/blogs/skaufman/composite-applications</link>
      <pubDate>Wed, 16 Mar 2011 13:49:09 GMT</pubDate>
      <dc:creator><![CDATA[Stephen Kaufman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/skaufman/2011/03/16/composite-applications/</guid>
      <description><![CDATA[It has been a long time since my last blog post.&#160; It certainly hasn’t been for a lack of...]]></description>
      <content:encoded><![CDATA[<p>It has been a long time since my last blog post.&#160; It certainly hasn’t been for a lack of content but it is amazing how fast time flies when you are busy.&#160; I have been spending a lot of time lately working on composite applications and will be posting a number of entries around this topic.</p>  <p>One of the first questions that people ask is what is a composite app?&#160; </p>  <p>Composite apps can take on many forms and use many differing technologies.&#160; Many times people will talk about composite Apps and will only be referring to the UI tier.&#160; While the concept of a UI composite can be compared to a mashup (a UI that combines publically available web based services to create a meaningful combination of information to a user) a UI composite is built to use business sources – in many scenarios these sources (assets) already exist within the organization from previous application development efforts.&#160; </p>  <p>A composite app can also refer to just the middle tier as well.&#160; Many companies have spend a lot of time and money over the past many years building out SOA services.&#160; A composite app can consist of orchestration services that draw on the functionality of these different services.&#160; One thing to keep in mind however, is that a composite app is not make a SOA architecture.&#160; Instead they they will build on top of the work that has already been done to create a SOA architecture.&#160; </p>  <p>The idea of a composite app is to build upon existing software assets to quickly bring data to consumers in new way.&#160; </p>  <p>Many of the articles and blogs on this subject talk a lot around the UI tier.&#160; While that is a very important part of a composite application, I am going to spend time over the next few posts talking about composites at the middle tier.</p>  <p>There is a very good all-up article titled <a href="https://msdn.microsoft.com/en-us/library/bb220803.aspx">What Are Composite Applications</a> from <a href="https://blogs.msdn.com/b/atanu/">Atanu Banerjee</a> where he walks through the full composite application stack.&#160; In this article he outlines three steps that a solution architect must do to design a composite application.&#160; Those things are to:</p>  <ul>   <li><strong>Choose a composition stack.</strong> Pick one or more containers from each tier, and a set of component types that are deployable into those containers. </li>    <li><strong>Choose components.</strong> Define the repository of assets that must be built from this set of component types, based on business needs. </li>    <li><strong>Specify the composite application.</strong> Define the ways in which those assets will be connected, to provide a particular cross-functional process. The platform should enable these connections to be loosely coupled. </li> </ul>  <p>Each of these things are required so that the consumer can get the most benefit.&#160; Over and above this, the organization should start to benefit by realizing faster time-to-benefit turnaround as well as faster time-to-deployment.&#160; These two, along with exposing existing LOB data are the three driving factors that are making the idea of composite applications so popular.</p>  <p>In my next several posts, I will cover some of the technical choices, how to bring bridge between services that live in BizTalk and services that live in AppFabric, and some of the lessons learned. </p>]]></content:encoded>
    </item>
    <item>
      <title>Twin Cities Connected Systems User Group Meeting–March 17th, 2011</title>
      <link>https://docs.microsoft.com/archive/blogs/skaufman/twin-cities-connected-systems-user-group-meetingmarch-17th-2011</link>
      <pubDate>Wed, 16 Mar 2011 08:39:29 GMT</pubDate>
      <dc:creator><![CDATA[Stephen Kaufman]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/skaufman/2011/03/16/twin-cities-connected-systems-user-group-meetingmarch-17th-2011/</guid>
      <description><![CDATA[If you are in Minneapolis on Thursday March 17th please join us for the Twin Cities Connected...]]></description>
      <content:encoded><![CDATA[<p>If you are in Minneapolis on Thursday March 17th please join us for the Twin Cities Connected Systems User Group Meeting.</p>  <p>The meeting takes place at 6:00 p.m. at the Microsoft offices at 8300 Norman Center Drive, Bloomington, MN 55437.</p>  <p>Andy Morrison will be presenting on a Lap Around BizTalk 2010 and the ESB Toolkit 2.1</p>]]></content:encoded>
    </item>
  </channel>
</rss>