<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>MiddlewareInTheCloud</title>
	<atom:link href="http://middlewareinthecloud.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://middlewareinthecloud.com</link>
	<description>Blog focused on Microsoft Middleware running in the cloud</description>
	<lastBuildDate>Fri, 29 Jun 2012 12:16:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='middlewareinthecloud.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>MiddlewareInTheCloud</title>
		<link>http://middlewareinthecloud.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://middlewareinthecloud.com/osd.xml" title="MiddlewareInTheCloud" />
	<atom:link rel='hub' href='http://middlewareinthecloud.com/?pushpress=hub'/>
		<item>
		<title>Azure&#8211;Service Bus Queues in Worker Roles</title>
		<link>http://middlewareinthecloud.com/2012/06/23/azureservice-bus-queues-in-worker-roles/</link>
		<comments>http://middlewareinthecloud.com/2012/06/23/azureservice-bus-queues-in-worker-roles/#comments</comments>
		<pubDate>Sat, 23 Jun 2012 22:06:23 +0000</pubDate>
		<dc:creator>Kent</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[ServiceBus]]></category>

		<guid isPermaLink="false">https://middlewareinthecloud.wordpress.com/?p=442</guid>
		<description><![CDATA[&#160; Another nugget of information that I picked up at TechEd North America is a new template that ships as part of the Azure SDK 1.7 called Worker Role with Service Bus Queue.&#160; What got me interested in this feature is some of the work that I did last year with the AppFabric Applications (Composite [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=442&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>&#160;</p>
<p>Another nugget of information that I picked up at TechEd North America is a new template that ships as part of the Azure SDK 1.7 called <strong>Worker Role with Service Bus Queue.&#160; </strong></p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image20.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb20.png?w=404&#038;h=253" width="404" height="253" /></a></p>
<p>What got me interested in this feature is some of the work that I did last year with the <a href="http://middlewareinthecloud.com/2011/07/24/appfabric-apps-june-2011-ctp-simple-service-bus-queue-app/" target="_blank">AppFabric Applications (Composite Apps) CTP</a>.&#160; I was a big fan of that CTP as it allowed you to wire-up different cloud services rather seamlessly.&#160; That CTP has been officially shut-down so I can only assume that this template was introduced to address some of the problems that the AppFabric Applications CTP sought to solve.</p>
<p>&#160;</p>
<p>The <strong>Worker Role with Service Bus Queue</strong> feature works in both Visual Studio 2010 or Visual Studio 2012 RC.&#160; For this post I am going to be using 2012 RC.</p>
<p>I am going to use a similar scenario to the one that I used in the App Fabric Applications CTP.&#160; I will build a simple Web Page that will allow a “customer” to populate a power outage form.&#160; I will then submit this message to a Service Bus Queue and will then have a Worker role dequeue this message. For the purpose of this post I will simply write a trace event to prove that I am able to pull the message off of the queue.</p>
<p>&#160;</p>
<p><strong>Building the Application</strong></p>
<ul>
<li>Create a new project by clicking on <strong>File </strong>(or is it FILE)<strong> – New Project</strong> </li>
<li>Select <strong>Cloud</strong> template and then you will see a blank pane with no template able to be selected.&#160; The Azure SDK is currently built on top of .Net 4.0 not 4.5.&#160; With this in mind, we need to select <strong>.Net Framework 4</strong> </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image21.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb21.png?w=404&#038;h=229" width="404" height="229" /></a></p>
<ul>
<li>We now need to select the Cloud Services that will make up our solution.&#160; In my scenario I am going to include an <strong>ASP.Net Web Role</strong> and a <strong>Worker Role with</strong> <strong>Service Bus Queue</strong>. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image22.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb22.png?w=404&#038;h=258" width="404" height="258" /></a></p>
<p><strong>Note:</strong> we do have the opportunity to rename these artifacts by hovering over the label and then clicking on the pencil. This was a gap that existed in the old AppFabric Apps CTP.&#160; After renaming my artifacts my solution looks like this:</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image23.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;margin:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb23.png?w=237&#038;h=102" width="237" height="102" /></a></p>
<ul>
<li>I want to send and receive a strongly typed message so I am going to create a <strong>Class Library</strong> and call it <strong>CustomerEntity.</strong> </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image24.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb24.png?w=404&#038;h=225" width="404" height="225" /></a></p>
<ul>
<li>In this project I will simply have one class called <strong>Customer</strong> with the following properties </li>
</ul>
<p>namespace CustomerEntity    <br />{     <br />&#160;&#160;&#160; public class Customer     <br />&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; public string Address { get; set; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; public string City { get; set; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; public string State { get; set; }     <br />&#160;&#160;&#160; }     <br />}     </p>
<p>&#160;</p>
<ul>
<li>I will then add a reference in both the Web Project and Worker Role projects to this <strong>CustomerEntity</strong> project. </li>
</ul>
<p>&#160;</p>
<ul>
<li>Within the <strong>PowerOutageWeb</strong> project clear out all of the default markup in the Default.aspx page and add the following controls. </li>
</ul>
<p>&lt;h3&gt;Customer Information:&lt;/h3&gt;    <br />Address: &lt;asp:TextBox ID=&quot;txtAddress&quot; runat=&quot;server&quot;&gt;&lt;/asp:TextBox&gt;&lt;br /&gt;&#160;&#160;&#160; <br />City: &lt;asp:TextBox ID=&quot;txtCity&quot; runat=&quot;server&quot;&gt;&lt;/asp:TextBox&gt; &lt;br /&gt;     <br />State: &lt;asp:TextBox ID=&quot;txtState&quot; runat=&quot;server&quot;&gt;&lt;/asp:TextBox&gt;&lt;br /&gt;     <br />&lt;asp:Button ID=&quot;btnSubmit&quot; runat=&quot;server&quot; Text=&quot;Submit&quot;&#160; OnClick=&quot;btnSubmit_Click&quot; /&gt;     <br />&lt;asp:Label ID=&quot;lblResult&quot; runat=&quot;server&quot; Text=&quot;&quot;&gt;&lt;/asp:Label&gt;     </p>
<p>&#160;</p>
<ul>
<li>Also within the <strong>PowerOutageWeb</strong> project we need to add references to the Service Bus Assembly:&#160; <strong>Microsoft.ServiceBus.dll</strong> and Runtime Serialization Assembly: <strong>System.Runtime.Serialization.dll</strong> </li>
</ul>
<p>&#160;</p>
<ul>
<li>We now need to provide the following include statements: </li>
</ul>
<p>using CustomerEntity;    <br />using Microsoft.WindowsAzure;     <br />using Microsoft.ServiceBus;     <br />using Microsoft.ServiceBus.Messaging;</p>
<p>&#160;</p>
<ul>
<li>Next we need to provide a click event for our submit button and then include the following code:
<p>protected void btnSubmit_Click(object sender, EventArgs e)        <br />&#160; {         <br />&#160;&#160;&#160;&#160;&#160; Customer cs = new Customer();         <br />&#160;&#160;&#160;&#160;&#160; cs.Address = txtAddress.Text;         <br />&#160;&#160;&#160;&#160;&#160; cs.City = txtCity.Text;         <br />&#160;&#160;&#160;&#160;&#160; cs.State = txtState.Text;</p>
<p>&#160;&#160;&#160;&#160;&#160; const string QueueName = &quot;PowerOutageQueue&quot;;</p>
<p>&#160;&#160;&#160;&#160; //Get the connection string from Configuration Manager </p>
<p>&#160;&#160;&#160;&#160; string connectionString = CloudConfigurationManager.GetSetting(&quot;Microsoft.ServiceBus.ConnectionString&quot;);</p>
<p>&#160;&#160;&#160;&#160;&#160; var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);</p>
<p>&#160;&#160;&#160;&#160; //Check to see if Queue exists, if it doesn’t, create it        <br />&#160;&#160;&#160;&#160;&#160; if (!namespaceManager.QueueExists(QueueName))         <br />&#160;&#160;&#160;&#160;&#160; {         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; namespaceManager.CreateQueue(QueueName);         <br />&#160;&#160;&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160;&#160;&#160; MessagingFactory factory = MessagingFactory.CreateFromConnectionString(connectionString);</p>
<p>&#160;&#160;&#160;&#160;&#160; //Create Queue CLient        <br />&#160;&#160;&#160;&#160;&#160; QueueClient myQueueClient = factory.CreateQueueClient(QueueName);</p>
<p>&#160;&#160;&#160;&#160;&#160; BrokeredMessage bm = new BrokeredMessage(cs);</p>
<p>&#160;&#160;&#160;&#160; //Send Message</p>
<p>&#160;&#160;&#160;&#160;&#160; myQueueClient.Send(bm);</p>
<p>&#160;&#160;&#160;&#160; //Update Web Page</p>
<p>&#160;&#160;&#160;&#160;&#160; lblResult.Text = &quot;Message sent to queue&quot;;        <br />&#160; }         </p>
</li>
</ul>
<p>&#160;</p>
<ul>
<li>Another new feature in this SDK that you may have noticed is the <strong>CreateFromConnectionString</strong> method that is available to the MessagingFactory and NamespaceManager classes.&#160; This allows us to retrieve our configuration settings from our project properties page.&#160; To access the project properties right mouse click on the particular role and then select <strong>Properties</strong>.&#160; Next, click on <strong>Settings</strong> where you will find Key/Value Pairings.&#160; The name of the key that we are interested in is: <strong>Microsoft.ServiceBus.ConnectionString</strong> and our value is </li>
</ul>
<p><strong>Endpoint=sb://[your namespace].servicebus.windows.net;SharedSecretIssuer=owner;SharedSecretValue=[your secret]</strong></p>
<ul>
<li>Since both our Web and Worker Roles will be accessing the Queue we will want to&#160;&#160; ensure that both configuration files have this entry included.&#160; This will allow our code to make a connection to our Service Bus Namespace where our Queue may be found.&#160; If we edit this property here in these locations, then we do not need to modify the <strong>Cloud.cscfg</strong> and <strong>Local.cscfg</strong> configuration files because Visual Studio will take care of this for us.</li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image25.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb25.png?w=1028&#038;h=208" width="1028" height="208" /></a></p>
<ul>
<li>Next we want to shift focus to the <strong>Worker Role</strong> and edit the <strong>WorkerRole.cs</strong> file.&#160; Since we are going to be dequeuing our typed CustomerService message we want to include a reference to this namespace: </li>
</ul>
<p>&#160;&#160;&#160; using CustomerEntity;</p>
<ul>
<li>Something that you probably noticed when you opened up the <strong>WorkerRole.cs</strong> file is that there is already some code written for us.&#160; We can leverage most of it but can delete the code that is highlighted in red below: </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image26.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb26.png?w=504&#038;h=323" width="504" height="323" /></a></p>
<ul>
<li>Where we deleted this code, we will want to add the following: </li>
</ul>
<p align="left">Customer cs = receivedMessage.GetBody&lt;Customer&gt;();    <br />Trace.WriteLine(receivedMessage.SequenceNumber.ToString(), &quot;Received Message&quot;);     <br />Trace.WriteLine(cs.Address, &quot;Address&quot;);     <br />Trace.WriteLine(cs.City, &quot;City&quot;);     <br />Trace.WriteLine(cs.State, &quot;State&quot;);     <br />receivedMessage.Complete();     </p>
<p align="left">In this code we are going to receive a typed Customer message and then simply write out the contents of this message using the Trace utility.&#160; If we wanted to save this information to a Database, this would a good place to write that code.</p>
<ul>
<li>
<div align="left">We also want to make sure that we update the name of Queue so that it matches the name that we specified in the Web Role:</div>
</li>
</ul>
<p align="left">// The name of your queue    <br />const string QueueName = &quot;PowerOutageQueue&quot;; </p>
<p align="left">&#160;</p>
<p align="left"><strong>Creating our Queue</strong></p>
<p align="left">We have a few options when it comes to creating our Queue that is required for this solution to work. The code in our ASP.NET Web page code-behind will take care of this for us.&#160; So for our solution to work, this method is sufficient but perhaps we want to use a design-time alternative to specify some more advanced features.&#160; In this case we do have a few options:</p>
<ul>
<li>
<div align="left">Using the <a href="http://www.windowsazure.com" target="_blank">http://www.windowsazure.com</a> portal.<a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image32.png"><img title="image" style="border-top:0;border-right:0;background-image:none;border-bottom:0;padding-top:0;padding-left:0;border-left:0;display:inline;padding-right:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb32.png?w=404&#038;h=188" width="404" height="188" /></a></div>
</li>
<li>
<div align="left">Similarly we can use the <strong>Service Bus</strong> <strong>Explorer </strong>tool that was written by Paolo Salvatori.&#160; Steef-Jan Wiggers has provided an in-depth walk through of this tool so I won’t go into more details here. <a title="http://soa-thoughts.blogspot.ca/2012/06/visual-studio-service-bus-explorer.html" href="http://soa-thoughts.blogspot.ca/2012/06/visual-studio-service-bus-explorer.html" target="_blank">http://soa-thoughts.blogspot.ca/2012/06/visual-studio-service-bus-explorer.html</a></div>
</li>
<li>
<div align="left">As part of the Azure 1.7 SDK release, a <strong>Visual Studio Service Bus Explorer </strong>is now included.&#160; It is accessible from the <strong>Server Explorer</strong> view from within Visual Studio.&#160; Using this tool we can perform some functions like:</div>
</li>
<ul>
<li>
<div align="left">Creating Queues/Topics</div>
</li>
<li>
<div align="left">Set advanced properties: Queue Size, Time to Live, Lock Duration etc</div>
</li>
<li>
<div align="left">Send and Receive Test Messages</div>
</li>
<li>
<div align="left">Get the current Queue Depth</div>
</li>
<li>
<div align="left">Get our Service Bus Connection string</div>
</li>
</ul>
</ul>
<p align="left"><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image33.png"><img title="image" style="border-top:0;border-right:0;background-image:none;border-bottom:0;padding-top:0;padding-left:0;border-left:0;display:inline;padding-right:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb33.png?w=353&#038;h=225" width="353" height="225" /></a></p>
<p align="left">&#160;</p>
<p align="left">Any of these methods will work.&#160; As I mentioned earlier, if we do nothing, the code will take care of it for us.</p>
<p align="left"><strong>Testing</strong></p>
<p align="left">We are just going to test our code locally, with the exception of our ServiceBus Queue.&#160; That is going to be created in Azure.&#160; To test our example:</p>
<ul>
<li>
<div align="left">Hit the F5 and our website should be displayed</div>
</li>
</ul>
<p align="left"><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image27.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb27.png?w=303&#038;h=259" width="303" height="259" /></a></p>
<ul>
<li>
<div align="left">Since we have our Trace statements included in our Worker Role code, we need to launch our Compute Emulator.&#160; To do this right mouse click on the Azure icon that is located in your taskbar and select <strong>Show Compute Emulator UI</strong>.</div>
</li>
</ul>
<p> <a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image28.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;margin:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb28.png?w=244&#038;h=241" width="244" height="241" /></a>
<ul>
<li>A “Console” like window will appear.&#160; We will want to click on the <strong>ServiceBusWorker</strong> label </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image29.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb29.png?w=464&#038;h=358" width="464" height="358" /></a></p>
<ul>
<li>Switch back to our Web Application, provide some data and click the submit button.&#160; We should see that our <strong>results</strong> label is updated to indicate that our <strong>Message sent to queue</strong>. <a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image30.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb30.png?w=320&#038;h=308" width="320" height="308" /></a></li>
</ul>
<ul>
<li>If we switch back to our Compute Emulator we should discover that our message has been dequeued. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image31.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb31.png?w=404&#038;h=170" width="404" height="170" /></a></p>
<p>&#160;</p>
<p><strong>Conclusion</strong></p>
<p>While the experience is a little different than that of the AppFabric Applications CTP, it is effective.&#160; Especially for developers who may not be all that familiar with “integration”.&#160; This template really provides a great starter point and allows them to wire up a Service Bus queue to their Web Application very quickly.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewareinthecloud.wordpress.com/442/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewareinthecloud.wordpress.com/442/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=442&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewareinthecloud.com/2012/06/23/azureservice-bus-queues-in-worker-roles/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/568970e0114bc0052f7b362b2077b444?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wearsyinc</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb20.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb21.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb22.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb23.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb24.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb25.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb26.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb32.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb33.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb27.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb28.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb29.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb30.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb31.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Azure Service Bus&#8211;Don&#8217;t run as Root!</title>
		<link>http://middlewareinthecloud.com/2012/06/20/azure-service-busdont-run-as-root/</link>
		<comments>http://middlewareinthecloud.com/2012/06/20/azure-service-busdont-run-as-root/#comments</comments>
		<pubDate>Thu, 21 Jun 2012 02:30:56 +0000</pubDate>
		<dc:creator>Kent</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[ServiceBus]]></category>

		<guid isPermaLink="false">https://middlewareinthecloud.wordpress.com/?p=411</guid>
		<description><![CDATA[&#160; So I can’t take credit for the catchy tag line for this post.&#160; It was inspired by a recent session that Clemens Vasters and Abhishek Lal provided at TechEd North America 2012.&#160; You can watch the entire session here.&#160; While watching the presentation, this particular segment, on not running as root,&#160; really resonated with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=411&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>&#160;</p>
<p>So I can’t take credit for the catchy tag line for this post.&#160; It was inspired by a recent session that Clemens Vasters and Abhishek Lal provided at TechEd North America 2012.&#160; You can watch the entire session <a href="http://channel9.msdn.com/Events/TechEd/NorthAmerica/2012/AZR308" target="_blank">here</a>.&#160; </p>
<p>While watching the presentation, this particular segment, on not running as root,&#160; really resonated with me.&#160; I have built some proof of concept mobile applications that use REST APIs to send messages to Service Bus Queues.&#160; In these applications I use the default owner key to submit messages.&#160; I knew at the time that this could not be a good practice but since it was just a POC it was acceptable.&#160; I was curious about how I could solve this problem in a better manner and I think what Microsoft has done here is definitely a step in the right direction.</p>
<p>If you are familiar with the Azure Service Bus, and Azure in general, there are 3 fundamental ‘artifacts’ that are required whenever you try to provision or manipulate Azure Services.&#160; These artifacts include:</p>
<ul>
<li>Namespace </li>
<li>Default Issuer (username) </li>
<li>Default Key (password)</li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image18.png"><img title="image" style="border-top:0;border-right:0;background-image:none;border-bottom:0;padding-top:0;padding-left:0;margin:0;border-left:0;display:inline;padding-right:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb18.png?w=244&#038;h=96" width="244" height="96" /></a></p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image1.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb1.png?w=404&#038;h=152" width="404" height="152" /></a></p>
<p><strong></strong></p>
<p><strong>The Problem</strong></p>
<p>In 99.99% of the demos and blog posts that exist on the interwebs, people are embedding their Default Issuer and Default Key in their solution.&#160; This creates issues on a few different levels:</p>
<ul>
<li>The account really is “root” when it comes to your namespace.&#160; Using your “account” allows you to create services like Queues, Topics, ACS Trust relationships, provision Cache etc.&#160; Do you see the problem with embedding these credentials in your app and then distributing it? </li>
<li>If your account does become compromised, it could be used to maliciously manipulate your solution.&#160; If you comprimised a solution that processed Customer Orders, wouldn’t it be nice to add your own subscriber to the Topic Subscription and receive a copy of each customer’s Credit Card number?</li>
</ul>
<p>Like any other security principal, we want to ensure that people, or systems, have the minimum level of security rights that they need to perform a specific function.&#160; A parallel example to this scenario is giving end users Domain Admin.&#160; You wouldn’t give that to end users, much like you shouldn’t embed your “owner ‘s” credential in your application.</p>
<p><strong>Enter SBAzTool</strong></p>
<p>There is a tool that is part of the Windows Azure 1.7 SDK that can help us assign fine grained authorization to “Default Name(s)” (Usernames).&#160; You can download the source code for this tool <a href="http://code.msdn.microsoft.com/windowsazure/Authorization-SBAzTool-6fd76d93" target="_blank">here</a>.&#160; In the rest of this post I will demonstrate how you can use this tool and then show an example that demonstrates why this tool is beneficial and that creating authorization rules is not so hard.</p>
<p><strong>Create Namespace in Portal</strong></p>
<p>Even though I have a functional namespace I am going to go ahead and create one from scratch so that we are all beginning at the same starting point.&#160; If you have an existing namespace that you want to use, you can.&#160; You don’t have to go through these next few steps where I create the namespace.</p>
<ul>
<ul>
<li>From <a href="http://www.windowsazure.com">http://www.windowsazure.com</a>, log in and then select the previous(old) portal as Service Bus and ACS do not exist in the new portal…yet. </li>
<li>Next, click on the <strong>Service Bus</strong> label and then click on the <strong>{New}</strong> button</li>
</ul>
<p>   <a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image2.png"><img title="image" style="background-image:none;float:none;padding-top:0;padding-left:0;margin-left:auto;display:block;padding-right:0;margin-right:auto;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb2.png?w=244&#038;h=173" width="244" height="173" />       &#160; </a>
<li>In this case I am selecting Access Control, Service Bus, a namespace and a Country/Region.&#160; Since United States (West) is closest to my locale, I will use it.</li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image3.png"><img title="image" style="background-image:none;float:none;padding-top:0;padding-left:0;margin-left:auto;display:block;padding-right:0;margin-right:auto;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb3.png?w=644&#038;h=274" width="644" height="274" /></a></p>
<p>&#160;</p>
<ul>
<li>So I now have a Namespace called <strong>DontRunAsRoot</strong>.&#160; It may take a couple minutes to create.&#160; You will also notice that we have a tree like structure where our Queues and Topics will be displayed.</li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image19.png"><img title="image" style="border-top:0;border-right:0;background-image:none;border-bottom:0;float:none;padding-top:0;padding-left:0;margin-left:auto;border-left:0;display:block;padding-right:0;margin-right:auto;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb19.png?w=404&#038;h=91" width="404" height="91" /></a></p>
<p>&#160;</p>
<ul>
<li>For the purpose of this demo we are going to create a Queue called <strong>MyQueue</strong> by clicking on the <strong>New Queue</strong> button.<a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image5.png"><img title="image" style="background-image:none;float:none;padding-top:0;padding-left:0;margin-left:auto;display:block;padding-right:0;margin-right:auto;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb5.png?w=404&#038;h=214" width="404" height="214" /></a></li>
</ul>
<p>&#160;</p>
<ul>
<li>We will need to populate the <strong>Name</strong> text box and then can accept the defaults.</li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image6.png"><img title="image" style="background-image:none;float:none;padding-top:0;padding-left:0;margin-left:auto;display:block;padding-right:0;margin-right:auto;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb6.png?w=404&#038;h=404" width="404" height="404" /></a></p>
<p>&#160;</p>
<ul>
<li>Voila, we have our newly created Namespace and Queue</li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image7.png"><img title="image" style="background-image:none;float:none;padding-top:0;padding-left:0;margin-left:auto;display:block;padding-right:0;margin-right:auto;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb7.png?w=404&#038;h=160" width="404" height="160" /></a></p>
<ul>
<li>We are going to need our “owner” key so we might as well get it while we are in the portal.&#160; Click on the <strong>View</strong> button and then click the <strong>Copy to Clipboard </strong>button.</li>
</ul>
<p>&#160;</p>
<ul><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image8.png"><img title="image" style="background-image:none;float:none;padding-top:0;padding-left:0;margin-left:auto;display:block;padding-right:0;margin-right:auto;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb8.png?w=354&#038;h=205" width="354" height="205" /></a></ul>
<ul></ul>
<ul></ul>
<p><strong>Compiling SBAzTool</strong></p>
<p>Once you have <a href="http://code.msdn.microsoft.com/windowsazure/Authorization-SBAzTool-6fd76d93" target="_blank">downloaded</a> the SBAzTool you can compile the solution and then open a command prompt and launch the tool by specifying <strong>sbaztool.exe.</strong>&#160; You can now see all of the command line arguments.&#160; However you can also access this documentation from the download page as well.</p>
<p>&#160;</p>
<p><strong>StoreOptions</strong></p>
<p>In order to set permissions for other users/issuers we need to be authenticated ourselves using the Key that we previously retrieved from the portal.&#160; By using the <strong>storeoptions</strong> argument we can continue to execute commands without having to re-issue our key/password.&#160; To do this we will want to execute the following command:</p>
<p>sbaztool.exe storeoptions –n &lt;namespace&gt; –k &lt;key&gt;</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image9.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb9.png?w=644&#038;h=58" width="644" height="58" /></a></p>
<p>&#160;</p>
<p><strong>MakeId</strong></p>
<p>So lets now create a new “user” by specifying the <strong>makeid </strong>command.&#160; In this case we can actually specify a “username” instead of the regular “owner” that we are so use to.&#160; </p>
<p>sbaztool.exe makeid &lt;username&gt;</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image10.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb10.png?w=644&#038;h=88" width="644" height="88" /></a></p>
<p>As you can see, a Key has been provided for this user(which I have whited out).&#160; We also have the ability to specify a password but including our own &lt;key&gt; provided it is a 32 byte, base64 encoded value. </p>
<p><strong>Grant</strong></p>
<p>Now that we have a Issuer/User created, we can actually assign this user permissions.&#160; The command to do so is:</p>
<p>grant &lt;operation&gt; &lt;path&gt; &lt;name&gt;</p>
<p>The available operations that we have access to are:</p>
<ul>
<li>Send </li>
<li>Listen </li>
<li>Manage</li>
</ul>
<p>Send and Listen are pretty self explanatory but Manage deserves further elaboration.&#160; We can actually delegate the authority to manage resources to a particular user based upon the path.&#160; So lets imagine we have a path that looks like this:</p>
<p>/organization/department/engineering</p>
<p>If we wanted to allow someone to administrate the<strong> </strong>/engineering services we could do so using this command.</p>
<p>For the purpose of this blog post, lets keep things simple and assign <strong>Send </strong>and <strong>Listen </strong>privileges to<strong>&#160;</strong>our <strong>QueueUser </strong>for our queue which is called <strong>myqueue</strong>.&#160; </p>
<p>Send</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image11.png"><img title="image" style="background-image:none;padding-top:0;padding-left:0;display:inline;padding-right:0;border-width:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb11.png?w=644&#038;h=40" width="644" height="40" /></a></p>
<p>Listen</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image12.png"><img title="image" style="border-top:0;border-right:0;background-image:none;border-bottom:0;padding-top:0;padding-left:0;border-left:0;display:inline;padding-right:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb12.png?w=644&#038;h=40" width="644" height="40" /></a></p>
<p><strong>Show</strong></p>
<p>To verify that our permissions have been set correctly we can execute the <strong>Show </strong>command by providing the following:</p>
<p>show &lt;path&gt;</p>
<p>As you can see below the <strong>QueueUser</strong> now has <strong>Send </strong>and <strong>Listen</strong> permissions on the queue called <strong>myqueue</strong>.&#160; This is a much better solution than giving entire rights to a namespace when you only need to specify rights on a particular queue.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image13.png"><img title="image" style="border-top:0;border-right:0;background-image:none;border-bottom:0;padding-top:0;padding-left:0;border-left:0;display:inline;padding-right:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb13.png?w=644&#038;h=146" width="644" height="146" /></a></p>
<p>&#160;</p>
<p><strong>Test permissions</strong></p>
<p>So in order to validate that this stuff actually works and this is not smoke and mirrors I am going to create a very simple console application that will use these credentials to send and receive a message.&#160; Once we have validated that this works we will pull the Send permission and see what happens.</p>
<p>The following code will create a QueueClient, send a message to the queue and then receive the message.</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; const string QueueName = &quot;myqueue&quot;;   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; const string ServiceNamespace = &quot;DontRunAsRoot&quot;;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; const string IssuerName = &quot;QueueUser&quot;;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; const string IssuerKey = &quot;&lt;removed&gt;&quot;;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Sending the message</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; TokenProvider credentials = TokenProvider.CreateSharedSecretTokenProvider(IssuerName, IssuerKey);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Uri serviceUri = ServiceBusEnvironment.CreateServiceUri(&quot;sb&quot;, ServiceNamespace, string.Empty);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; MessagingFactory factory = null;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; try   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; factory = MessagingFactory.Create(serviceUri, credentials);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //This code assumes that queue has already been created since we have   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //provisioned access    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueClient myQueueClient = factory.CreateQueueClient(QueueName);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Console.WriteLine(&quot;\nCreated Queue Client&quot;);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Create Brokered Message   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BrokeredMessage bm = new BrokeredMessage(&quot;I hope this works&quot;);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Console.WriteLine(&quot;\nSending messages to Queue&#8230;&quot;);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; myQueueClient.Send(bm);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Console.WriteLine(&quot;\nMessage sent to Queue&quot;);   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Console.WriteLine(&quot;\nPress Any ENTER to receive message&quot;);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Console.ReadLine();</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; bm = myQueueClient.Receive(TimeSpan.FromSeconds(5));</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (bm != null)   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Console.WriteLine(string.Format(&quot;Message received: Id = {0}, Body = {1}&quot;, bm.MessageId, bm.GetBody&lt;string&gt;()));    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Further custom message processing could go here&#8230;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; bm.Complete();    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Console.WriteLine(&quot;\nNo more messages to process&quot;);   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Console.WriteLine(&quot;\nPress ENTER Key to exit&quot;);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Console.ReadLine();    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; catch (Exception ex)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Console.WriteLine(ex.ToString());     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160;&#160; }   </p>
<p></p>
<p>When we run the application we will discover that it is executing correctly:</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image14.png"><img title="image" style="border-top:0;border-right:0;background-image:none;border-bottom:0;padding-top:0;padding-left:0;border-left:0;display:inline;padding-right:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb14.png?w=644&#038;h=196" width="644" height="196" /></a></p>
<p>&#160;</p>
<p><strong>Revoke</strong></p>
<p>Let’s now make this a little interesting.&#160; Let’s remove the <strong>QueueUser’s</strong> ability to send messages to the Queue and see what happens.&#160; To do this we will use the following command:</p>
<p>revoke &lt;operation&gt; &lt;path&gt; &lt;user&gt;</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image15.png"><img title="image" style="border-top:0;border-right:0;background-image:none;border-bottom:0;padding-top:0;padding-left:0;border-left:0;display:inline;padding-right:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb15.png?w=644&#038;h=43" width="644" height="43" /></a></p>
<p>To validate that the permission revoke was successful lets run the <strong>show </strong>command again.&#160; As you can see our revoke command was successful.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image16.png"><img title="image" style="border-top:0;border-right:0;background-image:none;border-bottom:0;padding-top:0;padding-left:0;border-left:0;display:inline;padding-right:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb16.png?w=644&#038;h=133" width="644" height="133" /></a></p>
<p>&#160;</p>
<p>Let’s now try to send a message and see what happens.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2012/06/image17.png"><img title="image" style="border-top:0;border-right:0;background-image:none;border-bottom:0;padding-top:0;padding-left:0;border-left:0;display:inline;padding-right:0;" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb17.png?w=644&#038;h=115" width="644" height="115" /></a></p>
<p>As expected we get an authentication exception as we should.</p>
<p>&#160;</p>
<p><strong>Conclusion</strong></p>
<p>With the introduction of the <strong>SBAzTool</strong> tool there is no excuse for using your “owner” credentials when building applications.&#160; The SBAzTool has a wide variety of commands that facilitate managing and even delegating permissions.&#160; Since this is a command line tool you can even script these permissions as you provision your Service Bus artifacts.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewareinthecloud.wordpress.com/411/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewareinthecloud.wordpress.com/411/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=411&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewareinthecloud.com/2012/06/20/azure-service-busdont-run-as-root/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/568970e0114bc0052f7b362b2077b444?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wearsyinc</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb18.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb19.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb7.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb8.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb9.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb10.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb11.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb12.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb13.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb14.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb15.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb16.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2012/06/image_thumb17.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Slide Deck from Prairie Dev Con Session</title>
		<link>http://middlewareinthecloud.com/2012/03/14/slide-deck-from-prairie-dev-con-session/</link>
		<comments>http://middlewareinthecloud.com/2012/03/14/slide-deck-from-prairie-dev-con-session/#comments</comments>
		<pubDate>Wed, 14 Mar 2012 16:35:07 +0000</pubDate>
		<dc:creator>Kent</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://middlewareinthecloud.com/2012/03/14/slide-deck-from-prairie-dev-con-session/</guid>
		<description><![CDATA[Thank you to those of you who attended my &#8220;Introduction to Microsoft&#8217;s Middleware in the Cloud&#8221; session yesterday at PrairieDevCon West in Calgary.  I appreciated the level of engagement and the amount of questions that were asked.  Below you will find a link to the Slide Deck you saw yesterday.  I have also added a few [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=373&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Thank you to those of you who attended my &#8220;Introduction to Microsoft&#8217;s Middleware in the Cloud&#8221; session yesterday at <a href="http://www.prairiedevcon.com" target="_blank">PrairieDevCon </a>West in Calgary.  I appreciated the level of engagement and the amount of questions that were asked.  Below you will find a link to the Slide Deck you saw yesterday.  I have also added a few slides to include screen shots of the demo applications that you saw to provide some additional context.</p>
<p><a href="https://skydrive.live.com/redir.aspx?cid=db51ef47e2bb432a&amp;resid=DB51EF47E2BB432A!5663&amp;parid=DB51EF47E2BB432A!375&amp;authkey=!AOe1Rn7b80mPYdg" target="_blank">https://skydrive.live.com/redir.aspx?cid=db51ef47e2bb432a&amp;resid=DB51EF47E2BB432A!5663&amp;parid=DB51EF47E2BB432A!375&amp;authkey=!AOe1Rn7b80mPYdg</a>  (Open in Powerpoint for Animations)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewareinthecloud.wordpress.com/373/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewareinthecloud.wordpress.com/373/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=373&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewareinthecloud.com/2012/03/14/slide-deck-from-prairie-dev-con-session/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/568970e0114bc0052f7b362b2077b444?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wearsyinc</media:title>
		</media:content>
	</item>
		<item>
		<title>SAP meet Azure Service Bus &#8211; EAI/EDI December 2011 CTP</title>
		<link>http://middlewareinthecloud.com/2011/12/29/sap-meet-azure-service-bus-eaiedi-december-2011-ctp/</link>
		<comments>http://middlewareinthecloud.com/2011/12/29/sap-meet-azure-service-bus-eaiedi-december-2011-ctp/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 15:47:00 +0000</pubDate>
		<dc:creator>Kent</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[EAI/EDI December 2011 CTP]]></category>
		<category><![CDATA[SAP]]></category>

		<guid isPermaLink="false">https://middlewareinthecloud.wordpress.com/?p=365</guid>
		<description><![CDATA[&#160; The Azure Service Bus EAI/EDI December 2011 CTP has been out for about 2 weeks at the time of this blog post.&#160; As soon as I saw the Service Bus Connect feature in the documentation I wanted to try and hook up the Service Bus to SAP.&#160; The organization that I work for utilizes [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=365&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>&#160;</p>
<p>The Azure Service Bus EAI/EDI December 2011 CTP has been out for about 2 weeks at the time of this blog post.&#160; As soon as I saw the Service Bus Connect feature in the documentation I wanted to try and hook up the Service Bus to SAP.&#160; The organization that I work for utilizes SAP to support many of its core business processes.&#160; We are also heavily invested in BizTalk Server when integrating SAP with other Corporate Systems. For the past 5 years much of my work experience has involved integration with SAP. So much that I had the opportunity to write a couple chapters on BizTalk-SAP integration in the Microsoft BizTalk 2010 Line of Business Systems Integration <a href="http://www.packtpub.com/microsoft-biztalk-2010-line-of-business-systems-integration/book" target="_blank">book</a>.</p>
<p>Integrating with SAP is of great interest to me both personally and professionally.&#160; I like the challenge of taking two different types of systems that would seemingly be impossible to integrate yet find a way to do it.&#160; I also enjoy the expression on SAP consultants face when you take a Microsoft product and successfully execute operations inside their system like creating customer records or creating Work Orders.&#160; </p>
<p>Using the Service Bus Connect feature is not the only way of bridging your On-Premise Line of Business Systems with external parties via cloud based messaging technologies.&#160; Within the past year Microsoft also introduced a feature called BizTalk Server 2010 AppFabric Connect for Services.&#160; This tool allows for BizTalk to expose an endpoint via a Service Bus Relay.&#160; I have also used this mechanism to communicate with SAP via a Mobile Device and it does work.&#160; </p>
<p>There are a few differences between Service Bus Connect and AppFabric Connect for Services.&#160; Some of these differences include:</p>
<ul>
<li>Any message transformations that need to take place actually take place in the Cloud instead of On Premise.&#160; When integrating with SAP, you never want to expose SAP schemas to calling clients.&#160; They are ugly to say the least. In this scenario we can expose a client friendly, or conical schema, and then transform this message into our SAP request in Azure. </li>
<li>AppFabric Connect for Services utilizes a full deployment of BizTalk in your environment where as Service Bus Connect only requires the BizTalk Adapter Pack when communicating with SAP. All message transformations and orchestration takes place On Premise and the cloud (Azure Service Bus) is basically used as a communication relay. </li>
</ul>
<p>When connecting to On-Premise Line of Business Systems, both methods require the BizTalk Adapter Pack to be installed On-Premise.&#160; The BizTalk Adapter Pack is included in your BizTalk license.&#160; Licensing details for Service Bus Connect have not been released at the time of this writing.</p>
<p>The following walkthrough assumes you have some experience with the new Service Bus CTP.&#160; If you haven’t looked at the CTP before I suggest that you visit a few of the following links to get more familiar with the tool:</p>
<ul>
<li><a href="http://middlewareinthecloud.com/2011/12/17/introduction-to-the-azure-service-bus-eaiedi-december-2011-ctp/" target="_blank">Introduction to the Azure Service Bus EAI/EDI December 2011 CTP</a> by Kent Weare (me) </li>
<li><a href="http://rickgaribay.net/archive/2011/12/16/azure-service-bus-connect-eai-and-edi-ldquointegration-servicesrdquo-ctp.aspx" target="_blank">Azure Service Bus Connect EAI and EDI “Integration Services” CTP</a> by Rick Garibay </li>
<li><a href="http://www.breezetraining.com.au/news/blogs/mick-badran.aspx" target="_blank">Azure AppFabric Labs–EAI, Service Bus in the Cloud</a> by Mick Badran </li>
<li><a href="http://blog.codit.eu/post/2011/12/20/How-the-Azure-ServiceBus-EAI-EDI-Labs-SDK-impacts-Microsoft-integration.aspx" target="_blank">How the Azure ServiceBus EAI &amp; EDI Labs SDK impacts Microsoft integration</a> by Sam Vanhoutte </li>
<li><a href="http://blogical.se/blogs/mikael/archive/2011/12/18/azure-service-bus-eai-edi-december-2011-ctp-content-based-routing.aspx" target="_blank">Azure Service Bus EAI/EDI December 2011 CTP – Content Based Routing</a> by Mikael Håkansson </li>
</ul>
<p>Also it is worth pointing out another blog <a href="http://soa-thoughts.blogspot.com/2011/12/azure-service-bus-eaiedi-december-2011.html" target="_blank">post</a> written by Steef-Jans Wiggers where he discusses Oracle integration with Service Bus Connect.</p>
<p><strong>Building our Application</strong></p>
<ul>
<li>The first thing we need to do is to create a new <strong>ServiceBus &#8211; Enterprise Application Integration</strong> project.&#160; In my case I am calling it <strong>HelloSAP</strong>. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image11.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb11.png?w=444&#038;h=250" width="444" height="250" /></a></p>
<p>&#160;</p>
<ul>
<li>Since we know that we want to communicate with an On-Premise LOB system like SAP we need to Add a <strong>ServiceBus Connect Server</strong>.&#160; We can do this by accessing Server Explorer, right mouse clicking on <strong>ServiceBus Connect Servers</strong> and then selecting <strong>Add Server</strong>.&#160; When prompted we can provide a host name of <strong>localhost</strong> since this is a local environment. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image12.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb12.png?w=444&#038;h=267" width="444" height="267" /></a> </p>
<p>&#160;</p>
<ul>
<li>We now can expand our <strong>Service Bus Connect Servers</strong> hierarchy.&#160; Since we want to build an SAP interface we can right mouse click on SAP and select <strong>Add SAP Target</strong>… </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image13.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb13.png?w=444&#038;h=349" width="444" height="349" /></a></p>
<p>&#160;</p>
<ul>
<li>If you have ever used the BizTalk Adapter Pack before, you are now in familiar territory.&#160; This is (almost) the same wizard that we use to generate schemas when connecting to SAP systems via BizTalk.&#160; There is a subtle difference in the bottom left corner called <strong>Configure Target Path</strong> which we will discuss in a few moments.&#160; If you are unfamiliar with this screen you are going to need some help from your SAP BASIS Admin to provide you with the connection details required to connect to SAP.&#160; Also if you are interested in further understanding everything that is going on in this screen I recommend you pick up the BizTalk LOB book that I previously talked about as I discuss the different aspects of this wizard in great detail.&#160; (ok..no more shameless plugs) </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image14.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb14.png?w=444&#038;h=398" width="444" height="398" /></a> </p>
<p>&#160;</p>
<ul>
<li>We now want to select the type of interface that we want to interact with.&#160; For the purpose of this blog post I am going to select a custom <strong>IDOC</strong> that is used when submitting timesheets from our field personnel.&#160; In my case, the version of SAP that I am connecting to is <strong>700</strong> so that is why I am selecting the <strong>ZHR_CATS</strong> IDOC that corresponds to this version.&#160; Once again, if you are unsure you will need to speak to your BASIS Admin. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image15.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb15.png?w=444&#038;h=400" width="444" height="400" /></a> </p>
<p>&#160;</p>
<ul>
<li>Notice how we cannot click the <strong>OK</strong> button after establishing a connection to SAP and selecting an IDOC?&#160; We now need to create a <strong>Target Path</strong>.&#160; Creating a Target Path will provide the Bridge from the Azure Service Bus into SAP.&#160; Click the <strong>Configure</strong> button to continue. </li>
</ul>
<p> <a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image16.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb16.png?w=444&#038;h=48" width="444" height="48" /></a>
<p>&#160;</p>
<ul>
<li>Assuming that we have not been through this exercise before we need to select <strong>Add New LobRelay</strong>&#160; from the <strong>Select LOB Relay to host the LOB Target:</strong> dropdown list.&#160; </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image17.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb17.png?w=444&#038;h=184" width="444" height="184" /></a></p>
<p>&#160;</p>
<ul>
<li>Another dialog box will appear. Within this dialog box we need to provide our CTP Labs <strong>namespace</strong>, a <strong>Relay path</strong>,<strong> Issuer name</strong> and <strong>key</strong>.&#160; For <strong>Relay path:</strong>, we can really provide whatever we want here.&#160; It will essentially make up the latter portion of URI for the Endpoint that is about to be created. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image18.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb18.png?w=354&#038;h=288" width="354" height="288" /></a></p>
<p>&#160;</p>
<ul>
<li>Now we are are prompted to <strong>Enter LOB Target sub-path.&#160; </strong>Once again this value can be whatever we want to choose.&#160; Since the HR Timesheet module inside of SAP is often called <strong>CATS</strong> I will go ahead and use this value here. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image19.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb19.png?w=444&#038;h=184" width="444" height="184" /></a></p>
<ul>
<li>Now with our <strong>Target Path</strong> configured we are able to select the OK button to proceed. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image20.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb20.png?w=444&#038;h=50" width="444" height="50" /></a></p>
<ul>
<li>Inside Server Explorer we now have an entry underneath SAP.&#160; This represents our End Point that will bridge requests coming from the cloud to SAP. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image21.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb21.png?w=344&#038;h=221" width="344" height="221" /></a>     </p>
<ul>
<li>At this point we haven’t added any artifacts to our Enterprise Application Integration project that we created earlier.&#160; This is about to change.&#160; We need to right mouse click on our SAP endpoint and then select <strong>Add schemas to HelloSAP</strong>…</li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image22.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb22.png?w=444&#038;h=277" width="444" height="277" /></a></p>
<ul>
<li>We will now get prompted for some additional information in order to re-establish a connection to SAP so that we can generate Schemas that will enable us to send a message to SAP in a format that it is expecting.&#160; You may also notice that we aren’t being prompted for any SAP server information.&#160; In the <strong>Properties</strong> grid you will notice that this information is already populated because we had previously specified it when using the Consume Adapter Service Wizard. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image23.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb23.png?w=444&#038;h=200" width="444" height="200" /></a></p>
<ul>
<li>Inside our solution, we will now discover that we have our SAP schemas in a folder called <strong>LOB Schemas</strong>. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image24.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb24.png?w=444&#038;h=249" width="444" height="249" /></a></p>
<ul>
<li>For the purpose of this blog post, I have created another folder called Schemas and saved a Custom Schema called <strong>CloudRequest.xsd</strong> here.&#160; This is the message that our MessageSender application will be sending in once we test our solution.&#160; (BTW: I do find that the Schema editor that is included in BizTalk is much more intuitive and user friendly than this one.&#160; I am not a big fan of this one) </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image25.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb25.png?w=354&#038;h=278" width="354" height="278" /></a></p>
<ul>
<li>We now need to create a Map, or Transform, to convert our request message into a request that SAP will understand. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image26.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb26.png?w=699&#038;h=227" width="699" height="227" /></a></p>
<ul>
<li>Next we need to add a Bridge on to the surface of our Bridge Configuration.&#160; Our Bridge will be responsible for executing our Map that we just created and then our message will get routed to our On-Premise end point so that our Timesheet can be sent to SAP. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image27.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb27.png?w=165&#038;h=137" width="165" height="137" /></a></p>
<ul>
<li>We now need to set the message type that we expect will enter the bridge.&#160; By double clicking on our <strong>TimeSheetBridge</strong> we can then use the Message Type picker to select our Custom message type: <strong>CloudRequest</strong>. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image28.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb28.png?w=444&#038;h=245" width="444" height="245" /></a></p>
<p>&#160;</p>
<ul>
<li>Once we have selected our message type, we can then select a transform by clicking on the <strong>Transform</strong> –<strong> Xml Transform</strong> box and then selecting our map from the <strong>Maps Collection</strong>. </li>
</ul>
<p>&#160;<a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image29.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb29.png?w=444&#038;h=294" width="444" height="294" /></a> </p>
<p>&#160;</p>
<ul>
<li>Before we drag our LOB Connection shape onto our canvas we need to set our <strong>Service Namespace</strong>.&#160; This is the value that we created when we signed up for the CTP in the Azure Portal.&#160; To set the <strong>Service Namespace</strong> we need to click on any open space, in the <strong>Bridge Configuration</strong> canvas, and then look in the <strong>Properties</strong> Page.&#160; Place your <strong>Service Namespace</strong> here. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image30.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb30.png?w=444&#038;h=140" width="444" height="140" /></a></p>
<p>&#160;</p>
<ul>
<li>We are now at the point where we need to wire up our XML One-Way Bridge to our On-Premise LOB system.&#160; In order to do so we we need to drag our SAP instance onto the Bridge Configuration canvas. </li>
</ul>
<p> <a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image31.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb31.png?w=444&#038;h=148" width="444" height="148" /></a>
<p>&#160;</p>
<ul>
<li>Next, we need to drag a Connection shape onto the canvas to connect our Bridge to our LOB system. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image32.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb32.png?w=444&#038;h=116" width="444" height="116" /></a></p>
<p>&#160;</p>
<ul>
<li>The next action that needs to take place is setting up a <strong>Filter Condition</strong> between our LOB Shape and our Bridge.&#160; You can think of this like creating a subscription.&#160; If we wanted to filter messages by their content we would be able to do so here.&#160; Since we are interested in all messages we will just <strong>Match All</strong>.&#160; In order to set this property we need to select our <strong>Connection arrow</strong> then click on the <strong>Filter Condition</strong> ellipses. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image33.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb33.png?w=444&#038;h=244" width="444" height="244" /></a></p>
<p>&#160;</p>
<ul>
<li>If you have used the BizTalk Adapter Pack in the past you will be familiar with SOAP Action headers that need to be be set in your BizTalk Send Port.&#160; Since we don’t have Send Ports per say, we need to set this action in the <strong>Route Action</strong> as part of the <strong>One-Way Connection shape</strong>.&#160; In the <strong>Expression</strong> text box we want to put the name of our Operation which is <a title="http://Microsoft.LobServices.Sap/2007/03/Idoc/3/ZHR_CATS//700/Send" href="http://Microsoft.LobServices.Sap/2007/03/Idoc/3/ZHR_CATS//700/Send"><strong>http://Microsoft.LobServices.Sap/2007/03/Idoc/3/ZHR_CATS//700/Send</strong></a>&#160;<strong>wrapped with single quotes ‘ ’</strong>.&#160; We can obtain this value by selecting our Service Bus Connect Server endpoint and then viewing the Properties page.&#160; Within the Properties page there is an Operations arrow that can be expanded on and we will find this value here.&#160; In the <strong>Destination (Write To)</strong> we want to set our <strong>Type</strong> to <strong>Soap</strong> and our <strong>Identifier</strong> to <strong>Action</strong>. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image34.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb34.png?w=444&#038;h=409" width="444" height="409" /></a></p>
<p>&#160;</p>
<ul>
<li>There is one last configuration that needs to take place before enable and deploy our service.&#160; We need to set our <strong>Security Type</strong>.&#160; We can do so by selecting our SAP – ServiceBus Connect Server instance from Server Explorer.&#160; Then in the Properties Page, click on the <strong>SecurityType</strong> ellipses.&#160; Determining which <strong>Security type</strong> to use will depend upon how your SAP instance ahs been configured.&#160; In my case, I am using <strong>ConfiguredUsername</strong> and I need to provide both a <strong>Username</strong> and <strong>Password</strong>. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image35.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb35.png?w=444&#038;h=234" width="444" height="234" /></a></p>
<ul>
<li>With our configuration set, we can now enable our SAP – ServiceBus Connect Server instance by right mouse clicking on it and then selecting Enable. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image36.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb36.png?w=444&#038;h=211" width="444" height="211" /></a></p>
<p>&#160;</p>
<ul>
<li>We can now deploy our application to Azure by right mouse clicking on our Visual Studio solution and selecting Deploy. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image37.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb37.png?w=354&#038;h=199" width="354" height="199" /></a></p>
<p>&#160;</p>
<p><strong>Testing Application</strong></p>
<ul>
<li>In order to test our application we can use the MessageSender tool that is provided with the CTP Samples/Tools.&#160; It will simply allow us to submit EDI, or in this case XML, messages to an endpoint in the Azure Service Bus.&#160; In order to successfully submit these messages we need to provide our Service Namespace, Issuer Name, Shared Secret, Service Bus endpoint address, a path to our XML file that we want to submit and indicate that we are submitting an xml document.&#160; Once we have provide this information we can hit the enter key and provided we do not have errors we will see a <strong>Message sent successfully message</strong>. </li>
</ul>
<p>Note: In the image below I have blocked my Shared Secret (in red) for privacy reasons.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image38.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb38.png?w=524&#038;h=112" width="524" height="112" /></a></p>
<ul>
<li>If we launch our SAP GUI we should discover that it has received a message successfully. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image39.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb39.png?w=544&#038;h=128" width="544" height="128" /></a></p>
<ul>
<li>We can then drill down into the message and discover the information that has been posted to our timesheet </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image40.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb40.png?w=244&#038;h=242" width="244" height="242" /></a></p>
<p>&#160;</p>
<p><strong>Exceptions</strong></p>
<p>While testing, I ran into an exception.&#160; In the <strong>CATSHOURS</strong> field I messed up the format of the field and sent in too much data.&#160; The BizTalk Adapter Pack/SAP Adapter validated this incoming data against the SAP schema that is being used to send messages to SAP.&#160; The result is a message was returned back to the <strong>MessageSender</strong> application.&#160; I thought that this was pretty interesting.&#160; Why?&#160; In my solution I am using a One-Way bridge and this exception is still being propagated to the calling application.&#160; Cool and very beneficial.</p>
<p>&#160;<a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image41.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0 0 0 20px;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb41.png?w=544&#038;h=128" width="544" height="128" /></a></p>
<p><strong></strong></p>
<p><strong>Conclusion</strong></p>
<p>Overall the experience of using Service Bus connect was good.&#160; There were a few times I had to forget how we do this in BizTalk and think about how the Service Bus Connect does it.&#160; An example of this was the SOAP Action Headers that BizTalk developers are use to manipulating inside of Send Ports.&#160; I am not saying one way is better than the other but they are just different.&#160; Another example is the XML Schema editor.&#160; I find the BizTalk editor to be much more user friendly.</p>
<p>While I am not convinced that the current state of Service Bus Connect is ready for primetime (they have CTPs for a reason), I am <u>very impressed</u> that the Microsoft team could build this type of functionality into a CTP.&#160; For me personally, this type of functionality(connecting to On Premise LOB Systems) is a MUST HAVE as organizations start evolving towards Cloud computing.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewareinthecloud.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewareinthecloud.wordpress.com/365/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=365&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewareinthecloud.com/2011/12/29/sap-meet-azure-service-bus-eaiedi-december-2011-ctp/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/568970e0114bc0052f7b362b2077b444?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wearsyinc</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb11.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb12.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb13.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb14.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb15.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb16.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb17.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb18.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb19.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb20.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb21.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb22.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb23.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb24.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb25.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb26.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb27.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb28.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb29.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb30.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb31.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb32.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb33.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb34.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb35.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb36.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb37.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb38.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb39.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb40.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb41.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Azure Service Bus EAI/EDI December 2011 CTP &#8211; New Mapper</title>
		<link>http://middlewareinthecloud.com/2011/12/17/azure-service-bus-eaiedi-december-2011-ctp-new-mapper/</link>
		<comments>http://middlewareinthecloud.com/2011/12/17/azure-service-bus-eaiedi-december-2011-ctp-new-mapper/#comments</comments>
		<pubDate>Sun, 18 Dec 2011 05:48:03 +0000</pubDate>
		<dc:creator>Kent</dc:creator>
				<category><![CDATA[AppFabric]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[EAI/EDI December 2011 CTP]]></category>

		<guid isPermaLink="false">https://middlewareinthecloud.wordpress.com/?p=300</guid>
		<description><![CDATA[In this blog post we are going to explore some of the new functoids that are available in the Azure Service Bus Mapper. At first glance, the Mapper looks pretty similar to the BizTalk 2010 Mapper. Sure there are some different icons, perhaps some lipstick applied but conceptually we are dealing with the same thing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=300&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>In this blog post we are going to explore some of the new functoids that are available in the Azure Service Bus Mapper.</p>
<p>At first glance, the Mapper looks pretty similar to the BizTalk 2010 Mapper. Sure there are some different icons, perhaps some lipstick applied but conceptually we are dealing with the same thing right?</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image9.png"><img style="border-bottom:0;border-left:0;display:block;float:none;margin-left:auto;border-top:0;margin-right:auto;border-right:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb9.png?w=426&#038;h=227" width="426" height="227" /></a> </p>
<p>Wrong! It isn’t until we take a look at the toolbox that we discover this isn’t your Father’s mapper.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image10.png"><img style="border-bottom:0;border-left:0;display:block;float:none;margin-left:auto;border-top:0;margin-right:auto;border-right:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb10.png?w=152&#038;h=772" width="152" height="772" /></a> </p>
</p>
<p>This post isn’t meant to be an exhaustive reference guide for the new mapper but here are some of the new functoids that stick out for me.</p>
<p align="left">&#160;</p>
<div align="left">
<table border="0" cellspacing="0" cellpadding="2" width="517" align="center">
<tbody>
<tr>
<td valign="top" width="133"><strong>Functoid Section</strong></td>
<td valign="top" width="140"><strong>Functoid Name</strong></td>
<td valign="top" width="242"><strong>Description</strong></td>
</tr>
<tr>
<td valign="top" width="133">Loop Operations</td>
<td valign="top" width="140">MapEach Loop</td>
<td valign="top" width="242">This functoid will loop over a repeating record from the source document and evaluate an operation at each iteration of the loop.&#160; If the criteria of the operation is met then a record in the target document will be created.</td>
</tr>
<tr>
<td valign="top" width="133">Expressions</td>
<td valign="top" width="140">Arithmetic Expression</td>
<td valign="top" width="242">No we haven’t lost our Addition or Subtraction functionality!&#160; Many functoids that you would have found in the BizTalk 2010 Mathematical Functoids section have been consolidated in the Arithmetic Expression operation.</td>
</tr>
<tr>
<td valign="top" width="133">Expressions</td>
<td valign="top" width="140">Logical Expression</td>
<td valign="top" width="242">Similar to the Arithmetic Expressions, these have now been consolidated and can be found within a single Expression including &gt;, &lt;, &gt;=, &lt;=, ==, !=, Logical Negation, Conditional ADD and Conditional OR</td>
</tr>
<tr>
<td valign="top" width="133">Expressions</td>
<td valign="top" width="140">If-Then-Else</td>
<td valign="top" width="242">A much anticipated operation! BizTalk developers have been wanting a If-Then-Else functoid in BizTalk for many years.&#160; If a condition has been evaluated to True then we can provide a particular value.&#160; Otherwise we can provide different value when the condition has not been satisfied.</td>
</tr>
<tr>
<td valign="top" width="133">List Operations</td>
<td valign="top" width="140">All of them</td>
<td valign="top" width="242">Complete new functionality provides us with the ability to manipulate Lists within a map.&#160; Functionality includes creating a list, adding an item to the list, selecting a unique group, selecting a value, selecting entries, getting items, and ordering the list.&#160; Wow!&#160; Will be interesting to see how this progresses.</td>
</tr>
<tr>
<td valign="top" width="133">Date/Time Operations</td>
<td valign="top" width="140">DateTime Reformat</td>
<td valign="top" width="242">This one should be useful.&#160; I am constantly re-formatting dates when integrating with SAP.&#160; Usually this formatting winds up in a Helper assembly which tends to be overkill for what really needs to take place.</td>
</tr>
<tr>
<td valign="top" width="133">Misc Operations</td>
<td valign="top" width="140">Data Lookup</td>
<td valign="top" width="242">This one is interesting.&#160; It allows us to access data from SQL Azure within a transform at runtime.</td>
</tr>
<tr>
<td valign="top" width="133">Misc Operations</td>
<td valign="top" width="140">Generate ID</td>
<td valign="top" width="242">This functoid will generate a GUID.&#160; It is the equivalent of calling the GUID.NewGuid method in .Net.</td>
</tr>
<tr>
<td valign="top" width="133">Misc Operations</td>
<td valign="top" width="140">Get Context Property</td>
<td valign="top" width="242">Another useful operation!&#160; This operation allows us to retrieve a value from context.&#160; This is something that just isn’t possible in BizTalk.</td>
</tr>
</tbody>
</table></div>
<div align="left">&#160;</div>
<div align="left"><strong>What’s Missing?</strong></div>
<p align="left">I can’t take credit for discovering this, but while chatting with Mikael Håkansson he mentioned “hey – where is the scripting functoid?”&#160; Perhaps this is just a limitation of the CTP but definitely something that needs to be addressed for RTM.&#160; It is always nice to be able to fall back on a .Net helper assembly or custom XSL<font>T.</font></p>
<div align="left"><strong>Conclusion</strong></div>
<div align="left">While this post was not intended to be comprehensive, I hope it has highlighted some new opportunities that warrant some further investigation.&#160; It is nice to see that Microsoft is evolving and maturing in this area of EAI.</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewareinthecloud.wordpress.com/300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewareinthecloud.wordpress.com/300/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=300&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewareinthecloud.com/2011/12/17/azure-service-bus-eaiedi-december-2011-ctp-new-mapper/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/568970e0114bc0052f7b362b2077b444?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wearsyinc</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb9.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb10.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Introduction to the Azure Service Bus EAI/EDI December 2011 CTP</title>
		<link>http://middlewareinthecloud.com/2011/12/17/introduction-to-the-azure-service-bus-eaiedi-december-2011-ctp/</link>
		<comments>http://middlewareinthecloud.com/2011/12/17/introduction-to-the-azure-service-bus-eaiedi-december-2011-ctp/#comments</comments>
		<pubDate>Sat, 17 Dec 2011 23:00:45 +0000</pubDate>
		<dc:creator>Kent</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[EAI/EDI December 2011 CTP]]></category>
		<category><![CDATA[Queue]]></category>

		<guid isPermaLink="false">https://middlewareinthecloud.wordpress.com/?p=293</guid>
		<description><![CDATA[The Azure team has recently reached a new milestone; delivering on Service Bus enhancements for the December 2011 CTP.&#160; More specifically, this CTP provides Enterprise Application Integration (EAI) and Electronic Data Interchange (EDI) functionality.&#160; Within the Microsoft stack, both EAI and EDI have historically been tackled by BizTalk.&#160; With this CTP we are seeing an [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=293&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>The Azure team has recently reached a new milestone; delivering on Service Bus enhancements for the December 2011 CTP.&#160; More specifically, this CTP provides Enterprise Application Integration (EAI) and Electronic Data Interchange (EDI) functionality.&#160; Within the Microsoft stack, both EAI and EDI have historically been tackled by BizTalk.&#160; With this CTP we are seeing an early glimpse into how Microsoft envisions these types of integration scenarios being addressed in a Platform as a Service (PaaS) based environment.</p>
<p>&#160;<strong>What is included in this CTP?</strong></p>
<p>There are 3 core areas to this release:</p>
<ol>
<li><strong>Enterprise Application Integration</strong>: In Visual Studio, we will now have the ability to create <strong>Enterprise Application Integration </strong>and <strong>Transform</strong> projects.&#160; </li>
<li><strong>Connectivity to On-premise LOB applications</strong>: Using this feature will allow us to bridge our on-premise world with the other trading partners using the Azure platform.&#160; This is of particular interest to me.&#160; My organization utilizes systems like SAP, Oracle and 3rd party work order management and GIS systems.&#160; In our environment, these applications are not going anywhere near the cloud anytime soon.&#160; But, we also do a lot of data exchange with external parties.&#160; This creates an opportunity to bridge the gap using existing on-premise systems in conjunction with Azure. </li>
<li><strong>Electronic Data Interchange: </strong>We now have a Trading Partner Management portal<strong>&#160;</strong>that allows us to manage EDI message exchanges with our various business partners.&#160; The Trading Partner Management Portal is available <a href="http://go.microsoft.com/fwlink/?LinkId=235056" target="_blank">here</a>. </li>
</ol>
<p><strong>What do I need to run the CTP?</strong></p>
<ul>
<li>The first thing you will need is the actual SDK (WindowsAzureServiceBusEAI-EDILabsSDK-x64.exe) which you can download <a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=17691" target="_blank">here</a>.&#160; </li>
<li>A tool called Service Bus Connect (not to be confused with AppFabric Connect) enables us to bridge on-premise with Azure.&#160; The setup msi can also be accessed from the same page as the SDK. Within this setup we have the ability to install the Service Bus Connect SDK(which includes the BizTalk Adapter Pack), Runtime and Management tools.&#160; In order for the runtime to be installed, we need to have <a href="http://www.microsoft.com/download/en/details.aspx?id=15848" target="_blank">Windows Server AppFabric 1.0</a> installed. </li>
<li>Once we have the SDKs installed, we will have the ability to create <strong>ServiceBus</strong> projects in Visual Studio. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image1.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb1.png?w=504&#038;h=309" width="504" height="309" /></a></p>
<ul>
<li>Since our applications will require resources from the Azure cloud, we need to create an account in the Azure CTP Labs environment.&#160; To create a namespace in this environment, just follow these simple <a href="http://msdn.microsoft.com/en-us/library/windowsazure/hh697699.aspx" target="_blank">instructions</a>. </li>
<li>Next, we need to register our account with the <a href="https://edi.appfabriclabs.com/" target="_blank">Windows Azure EDI Portal</a>. </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image2.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb2.png?w=454&#038;h=438" width="454" height="438" /></a> </p>
<p>&#160;<strong>Digging into the samples</strong></p>
<p>For the purpose of this blog post I will describe some of what is going on in the first <strong>Getting Started</strong> sample called <strong>Order Processing</strong>.</p>
<p>When we open up the project and launch the <strong>BridgeConfiguration.bcs </strong>file we will discover a canvas with a couple shapes on it.&#160; I have outlined, in black, a Bridge and I have highlighted, in Green, what is called a Route Destination.&#160; So the scenario that has been built for us is one that will receive a typed xml message, transform it and then place it on a Service Bus Queue. </p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image3.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb3.png?w=504&#038;h=169" width="504" height="169" /></a> </p>
<p>When we dig into the <strong>Xml One-Way Bridge</strong> shape, we will discover something that looks similar to a BizTalk Pipeline.&#160; Within this “shape” we can add the various message types that are going to be involved in the bridge.&#160; We can then provide the names of the maps that we want to execute.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image4.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb4.png?w=454&#038;h=314" width="454" height="314" /></a> </p>
<p>Within our <strong>BridgeConfiguration.bcs</strong> “canvas” we need to provide our service namespace.&#160; We can set this by click on the whitespace within the canvas and then populate the Service Namespace property.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image5.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb5.png?w=354&#038;h=129" width="354" height="129" /></a> </p>
<p>We need to set this Service Namespace so that we know where to send the result of Xml One-Way bridge.&#160; In this case we are sending it to a Service Bus Queue that resides within our namespace.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image6.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb6.png?w=504&#038;h=92" width="504" height="92" /></a>&#160;</p>
<p>With our application configured we can build our application as we normally would.&#160; In order to deploy, we simply right mouse click on solution, or project, and select Deploy.&#160; We will once again be asked to provide our Service Bus credentials.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image7.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb7.png?w=399&#038;h=227" width="399" height="227" /></a> </p>
<p>The deployment is quick, but then again we aren’t pushing too many artifacts to the Service Bus.</p>
<p>Within the SDK samples, Microsoft has provided us with <strong>MessageReceiver</strong> and <strong>MessageSender</strong> tools.&#160; With the <strong>MessageReceiver</strong> tool, we can use it to create our Queue and receive a message.&#160; The <strong>MessageSender</strong> tool is used to send the message to the Queue.</p>
<p>When we test our application we will be asked to provide an instance of our typed Xml message.&#160; It will be sent to the Service Bus, transformed (twice) and then the result will be placed on a Queue.&#160; We will then pull this message off of the queue and the result will be displayed in our Console.</p>
<p>&#160;</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image8.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb8.png?w=504&#038;h=112" width="504" height="112" /></a> </p>
<p><strong>Conclusion</strong></p>
<p>So far is seems pretty cool and looks like this team is headed in the right direction.&#160; Much like the AppFabric Apps CTP, there will be some gaps in the technology, and bugs, that have been delivered as this is still just a technical preview.&#160; If you have any feedback for the Service Bus team or want some help troubleshooting a problem, a <a href="http://social.msdn.microsoft.com/Forums/en-US/servicebuslabs" target="_blank">forum</a> has been set up for this purpose.</p>
<p>I am definitely looking forward to digging into this technology further – especially in the area of connecting to on-premise LOB systems such as SAP.&#160; Stay tuned for more posts on these topics.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewareinthecloud.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewareinthecloud.wordpress.com/293/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=293&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewareinthecloud.com/2011/12/17/introduction-to-the-azure-service-bus-eaiedi-december-2011-ctp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/568970e0114bc0052f7b362b2077b444?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wearsyinc</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb7.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb8.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Speaking at Prairie Dev Con West&#8211;March 2012</title>
		<link>http://middlewareinthecloud.com/2011/12/02/speaking-at-prairie-dev-con-westmarch-2012/</link>
		<comments>http://middlewareinthecloud.com/2011/12/02/speaking-at-prairie-dev-con-westmarch-2012/#comments</comments>
		<pubDate>Sat, 03 Dec 2011 03:32:12 +0000</pubDate>
		<dc:creator>Kent</dc:creator>
				<category><![CDATA[AppFabric]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[Queue]]></category>

		<guid isPermaLink="false">https://middlewareinthecloud.wordpress.com/?p=275</guid>
		<description><![CDATA[I have recently been informed that my session abstract has been accepted and I will be speaking at Prairie Dev Con West in March.&#160; My session will focus on Microsoft’s Cloud based Middleware platform: Azure AppFabric.&#160; In my session I will be discussing topics such as Service Bus,&#160; AppFabric Queues/Subscriptions and bridging on-premise Line of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=275&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I have recently been informed that my session abstract has been accepted and I will be speaking at Prairie Dev Con West in March.&#160; My session will focus on Microsoft’s Cloud based Middleware platform: Azure AppFabric.&#160; In my session I will be discussing topics such as Service Bus,&#160; AppFabric Queues/Subscriptions and bridging on-premise Line of Business systems with cloud based integration.</p>
<p>You can read more about the Prairie Dev Con West <a href="http://www.prairiedevcon.com">here</a> and find more information about registration <a href="http://www.prairiedevcon.com/Registration">here</a>.&#160;&#160; Do note there is some early bird pricing in effect.</p>
<p>&#160;</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/12/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb.png?w=644&#038;h=176" width="644" height="176" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewareinthecloud.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewareinthecloud.wordpress.com/275/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=275&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewareinthecloud.com/2011/12/02/speaking-at-prairie-dev-con-westmarch-2012/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/568970e0114bc0052f7b362b2077b444?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wearsyinc</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/12/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>AppFabric Apps (June 2011 CTP)&#8211;Only 1 SQL Azure Instance at a time</title>
		<link>http://middlewareinthecloud.com/2011/09/10/appfabric-apps-june-2011-ctponly-1-sql-azure-instance-at-a-time/</link>
		<comments>http://middlewareinthecloud.com/2011/09/10/appfabric-apps-june-2011-ctponly-1-sql-azure-instance-at-a-time/#comments</comments>
		<pubDate>Sat, 10 Sep 2011 15:51:58 +0000</pubDate>
		<dc:creator>Kent</dc:creator>
				<category><![CDATA[AppFabric]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[SQL Azure]]></category>

		<guid isPermaLink="false">https://middlewareinthecloud.wordpress.com/2011/09/10/appfabric-apps-june-2011-ctponly-1-sql-azure-instance-at-a-time/</guid>
		<description><![CDATA[I must have missed it in the release notes but when you have access to the AppFabric Apps CTP, you are only allowed on SQL Azure instance within this Labs environment.&#160; When you first log into the Portal you will see a SQL Azure DB that has a name of LabsSqlDatabase.&#160; The problem is that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=272&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I must have missed it in the release notes but when you have access to the AppFabric Apps CTP, you are only allowed on SQL Azure instance within this Labs environment.&#160; When you first log into the Portal you will see a SQL Azure DB that has a name of <strong>LabsSqlDatabase</strong>.&#160; The problem is that you can’t actually create another one here and if you do try to access this database you will not be able to connect to it using the Database Name <strong>LabsSqlDatabase</strong>.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/09/image.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/09/image_thumb.png?w=644&#038;h=231" width="644" height="231" /></a></p>
<p>What is a little confusing is when you are working within your Local Dev Fabric that you can specify any name you want in your SQL Azure cofig for your <strong>DatabaseName</strong>.&#160; The problem is this name will not exist in the cloud if you want to access it after you have published your AppFabric Application.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/09/image1.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/09/image_thumb1.png?w=404&#038;h=212" width="404" height="212" /></a></p>
<p>The error message that you will receive will resemble the following:</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/09/image2.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/09/image_thumb2.png?w=504&#038;h=166" width="504" height="166" /></a></p>
<p>So due to this current limitation (it is CTP&#160; &#8211; I am ok with it), you need to use the database that was provisioned for you when you were granted access to the CTP Labs enviornment.&#160; To do this you will need to get your connection string from the Labs Portal by clicking on <strong>LabsSqlDatabase </strong>then click on the <strong>View </strong>button below the <strong>Connection String</strong> label.&#160; A dialog box will appear and you can copy your connection string by clicking the <strong>Copy to Clipboard</strong> button.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/09/image3.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/09/image_thumb3.png?w=804&#038;h=365" width="804" height="365" /></a></p>
<p>If we paste this value in notepad we will discover the following connection string.&#160; The <strong>Data Source</strong> represents the name of the server (s) that our database will be running on.&#160; Next we have an <strong>Initial Catalog</strong> value <u>which is the actual name of our database that has been provisioned for us</u>….not <strong>LabsSqlDatabase</strong>.&#160; In my case, and I would imagine others, my Initial Catalog value is the same as my user id.&#160; If have blacked out portions of these values for privacy reasons.<a href="http://middlewareinthecloud.files.wordpress.com/2011/09/image4.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/09/image_thumb4.png?w=804&#038;h=87" width="804" height="87" /></a></p>
<p>If I now try to connect to this database either through SQL Management Studio or <a href="https://manage-sn1.sql.azure.com/">Database Manager Portal</a>, using this initial catalog value for my Database Name,&#160; I will have success.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/09/image5.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/09/image_thumb5.png?w=644&#038;h=422" width="644" height="422" /></a></p>
<p>At this point we are free to run any of our SQL scripts to generate tables, stored procedures or load data.</p>
<p><strong></strong></p>
<p><strong>Conclusion</strong></p>
<p>I hope this post will save some others some time as it did create some confusion for me.&#160; Admittedly I sometimes dive right into things instead of thoroughly reviewing the documentation (what fun is that).&#160; From what I gather, it is possible to hook up an AppFabric Application to an existing SQL Azure database that exists in the NON-LABS environment.&#160; So if you really need to create multiple SQL Azure databases that is also an option.&#160; Since I am just playing around with this stuff having a single SQL Azure instance works for me now that I understand the limitations of the Labs environment.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewareinthecloud.wordpress.com/272/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewareinthecloud.wordpress.com/272/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=272&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewareinthecloud.com/2011/09/10/appfabric-apps-june-2011-ctponly-1-sql-azure-instance-at-a-time/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/568970e0114bc0052f7b362b2077b444?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wearsyinc</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/09/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/09/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/09/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/09/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/09/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/09/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>AppFabric Apps (June 2011 CTP) Accessing AppFabric Queue via REST</title>
		<link>http://middlewareinthecloud.com/2011/08/13/appfabric-apps-june-2011-ctp-accessing-appfabric-queue-via-rest/</link>
		<comments>http://middlewareinthecloud.com/2011/08/13/appfabric-apps-june-2011-ctp-accessing-appfabric-queue-via-rest/#comments</comments>
		<pubDate>Sat, 13 Aug 2011 19:46:26 +0000</pubDate>
		<dc:creator>Kent</dc:creator>
				<category><![CDATA[AppFabric]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[Queue]]></category>

		<guid isPermaLink="false">https://middlewareinthecloud.wordpress.com/2011/08/13/appfabric-apps-june-2011-ctp-accessing-appfabric-queue-via-rest/</guid>
		<description><![CDATA[I recently watched an episode of AppFabric TV where they were discussing the REST API for Azure AppFabric.&#160; I thought the ability to access the AppFabric Service Bus, and therefore other Azure AppFabric services like Queues, Topics and Subscriptions via REST was a pretty compelling scenario.&#160; For example, if we take a look at the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=223&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I recently watched an episode of <a href="http://channel9.msdn.com/Shows/AppFabric-tv/AppFabrictv-ServiceBus-HTTP--REST-API">AppFabric TV</a> where they were discussing the REST API for Azure AppFabric.&#160; I thought the ability to access the AppFabric Service Bus, and therefore other Azure AppFabric services like Queues, Topics and Subscriptions via REST was a pretty compelling scenario.&#160; For example, if we take a look at the “Power Outage” scenario that I have been using to demonstrate some of the features of AppFabric Applications, it means that we can create a Windows Phone 7 (or Windows Phone 7.1/Mango Beta) application and dump messages into an AppFabric Queue securely via the AppFabric Service Bus.&#160; Currently, the Windows Phone SDK does not allow for the managed, Service Bus bindings to be loaded on the phone so using the REST based API over HTTP is a viable option.</p>
<p>Below is a diagram that illustrates the solution that we are about to build.&#160; We will have a Windows Phone 7.1 app that will push messages to an Azure AppFabric Queue.&#160; <em>(You will soon discover that I am not a Windows Phone developer.&#160; If you were expecting to see some whiz bang new Mango features then this post is not for you.)</em>&#160;</p>
<p>The purpose of the mobile is to submit power outage information to an AppFabric Queue.&#160; But before we can do this we need to retrieve a token from the Access Control Service and include this token in our AppFabric Queue message Header.&#160; Once the message is in the Queue,&#160; we will once again use a Code Service to retrieve messages that we will then insert into a SQL Azure table.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb.png?w=628&#038;h=484" width="628" height="484" /></a></p>
<p>&#160;</p>
<p><strong>Building our Mobile Solution</strong></p>
<p>One of the benefits of using AppFabric queues is the loose coupling between publishers and subscribers.&#160; With this in mind, we can proceed with building a Windows Phone 7 application in its own solution.&#160; For the purpose of this blog post I am going to use the latest mango beta sdk bits which are available <a href="http://www.microsoft.com/download/en/details.aspx?id=11321">here</a>.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb1.png?w=644&#038;h=446" width="644" height="446" /></a></p>
<p>Since I have downloaded the latest 7.1 bits, I am going to target this phone version.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image2.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb2.png?w=404&#038;h=193" width="404" height="193" /></a></p>
<p>&#160;</p>
<p>On our WP7 Canvas we are going to add a few controls:</p>
<ul>
<li>TextBlock called <strong>lblAddress</strong> that has a Text property of <strong>Address</strong> </li>
<li>TextBox called <strong>txtAddress</strong> that has an empty Text Property </li>
<li>Button called <strong>btnSubmit</strong> that has a Content property of <strong>Submit</strong> </li>
<li>TextBlock called lblStatus that has an empty Text Property </li>
</ul>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image3.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb3.png?w=258&#038;h=484" width="258" height="484" /></a></p>
<p>&#160;</p>
<p>Within the btnSubmit_Click event we are going to place our code that will communicate with the Access Control Service.</p>
<p><em>private void btnSubmit_Click(object sender, RoutedEventArgs e)     <br />&#160;&#160;&#160;&#160; {</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Build ACS and Service Bus Addresses     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string acsAddress = https + serviceNameSpace + acsSuffix ;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string relyingPartyAddress = http + serviceNameSpace + serviceBusSuffix;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string serviceAddress = https + serviceNameSpace + serviceBusSuffix;</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Formulate Query String     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string postData = &quot;wrap_scope=&quot; + Uri.EscapeDataString(relyingPartyAddress) +      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &quot;&amp;wrap_name=&quot; + Uri.EscapeDataString(issuerName) +      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &quot;&amp;wrap_password=&quot; + Uri.EscapeDataString(issuerKey);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; WebClient acsWebClient = new WebClient();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Since Web/Http calls are all async in WP7, we need to register and event handler      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; acsWebClient.UploadStringCompleted += new UploadStringCompletedEventHandler(acsWebClient_UploadStringCompleted);</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //instantiate Uri object with our acs URL so that we can provide in remote method call     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Uri acsUri = new Uri(acsAddress);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; acsWebClient.UploadStringAsync(acsUri,&quot;POST&quot;,postData);&#160; </em></p>
<p><em>}</em></p>
<p>&#160;</p>
<p>Since we are making an Asynchronous call to the ACS service, we need to implement&#160; the&#160;&#160; handling of the response from the ACS Service.</p>
<p><em>private void acsWebClient_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)     <br />&#160;&#160;&#160; {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (e.Error != null)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; lblStatus.Text = &quot;Error communicating with ACS&quot;;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; else      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //store response since we will need to pull ACS token from it      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string response = e.Result;</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //update WP7 UI with status update     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; lblStatus.Text = &quot;Received positive response from ACS&quot;;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Sleep just for visual purposes      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.Threading.Thread.Sleep(250);</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //parsing the ACS token from response     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string[] tokenVariables = response.Split(&#8216;&amp;&#8217;);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string[] tokenVariable = tokenVariables[0].Split(&#8216;=&#8217;);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string authorizationToken = Uri.UnescapeDataString(tokenVariable[1]);</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Creating our Web client that will use to populate the Queue      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; WebClient queueClient = new WebClient();</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //add our authorization token to our header     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; queueClient.Headers[&quot;Authorization&quot;] = &quot;WRAP access_token=\&quot;&quot; + authorizationToken +&quot;\&quot;&quot;;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; queueClient.Headers[HttpRequestHeader.ContentType] = &quot;text/plain&quot;;</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //capture textbox data     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string messageBody = txtAddress.Text;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //assemble our queue address      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //For example: &quot;</em><a href="https://MyNameSpace.servicebus.appfabriclabs.com/MyQueueName/Messages&quot;"><em>https://MyNameSpace.servicebus.appfabriclabs.com/MyQueueName/Messages&quot;</em></a>    <br /><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string sendAddress = https + serviceNameSpace + serviceBusSuffix + queueName + messages;</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Register event handler     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; queueClient.UploadStringCompleted += new UploadStringCompletedEventHandler(queueClient_UploadStringCompleted);</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Uri queueUri = new Uri(sendAddress);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Call method to populate queue      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; queueClient.UploadStringAsync(queueUri, &quot;POST&quot;, messageBody);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160; </em></p>
<p><em>&#160;&#160;&#160; }</em></p>
<p>So at this point we have made a successful request to ACS and received a response that included our token.&#160; We then registered an event handler as we will call the AppFabric Service Bus Queue using an Asynchronous call.&#160; Finally we made a call to our Service Bus Queue.</p>
<p>We now need to process the response coming back from the AppFabric Service Bus Queue.</p>
<p><em>private void queueClient_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)     <br />{      <br />&#160;&#160;&#160; //Update status to user.      <br />&#160;&#160;&#160; if (e.Error != null)      <br />&#160;&#160;&#160; {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; lblStatus.Text = &quot;Error sending message to Queue&quot;;      <br />&#160;&#160;&#160; }      <br />&#160;&#160;&#160; else      <br />&#160;&#160;&#160; {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; lblStatus.Text = &quot;Message successfully sent to Queue&quot;;      <br />&#160;&#160;&#160; }      <br />}</em>    </p>
<p>&#160;</p>
<p>That concludes the code that is required to submit a message securely to the AppFabric Service Bus Queue using the Access Control Service to authenticate our request.</p>
<p><strong>Building our Azure AppFabric Application</strong></p>
<p>The first artifact that we are going to build is the AppFabric Service Bus Queue called <strong>QueueMobile</strong>.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb21.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image_thumb2[1]" border="0" alt="image_thumb2[1]" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb21_thumb.png?w=640&#038;h=484" width="640" height="484" /></a></p>
<p>Much like we have done in previous posts we need to provide an <strong>IssuerKey, IssuerName and Uri</strong>.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb41.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image_thumb4" border="0" alt="image_thumb4" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb4_thumb.png?w=644&#038;h=402" width="644" height="402" /></a></p>
<p>The next artifact that we need add is a SQL Azure Database. </p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image26_thumb1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image26_thumb" border="0" alt="image26_thumb" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image26_thumb_thumb.png?w=640&#038;h=484" width="640" height="484" /></a></p>
<p>Adding this artifact is only the beginning.&#160; We still need to create our local database in our SQL Express instance.&#160; So what I have done is manually created a Database called <strong>PowerOutage</strong> and a Table called <strong>Outages</strong>.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb61.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image_thumb6" border="0" alt="image_thumb6" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb6_thumb.png?w=404&#038;h=309" width="404" height="309" /></a></p>
<p>Within this table I have two very simple columns: <strong>ID </strong>and <strong>Address.</strong></p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb101.png"><img style="background-image:none;border-bottom:0;border-left:0;padding-left:0;padding-right:0;display:inline;border-top:0;border-right:0;padding-top:0;" title="image_thumb10" border="0" alt="image_thumb10" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb10_thumb.png?w=444&#038;h=146" width="444" height="146" /></a></p>
<p>So the next question is how do I connect to this database.&#160; If you navigate to the AppFabric Applications Manager which is found within the AppFabric Labs portal, we will see that a SQL Azure DB has been provisioned for us.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb121.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image_thumb12" border="0" alt="image_thumb12" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb12_thumb.png?w=644&#038;h=300" width="644" height="300" /></a></p>
<p>Part of this configuration includes our connection string for this Database.&#160; We can access this connection string by clicking on the <strong>View</strong> button that is part of the Connection String panel.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb131.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image_thumb13" border="0" alt="image_thumb13" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb13_thumb.png?w=244&#038;h=56" width="244" height="56" /></a></p>
<p>I have covered up some of the core credential details that are part of my connection string for security reasons.&#160; What I have decided to do though to make things a little more consistent is created a SQL Server account that has these same credentials in my local SQL Express.&#160; This way when I provision to the cloud I only need to change my Data Source.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb17.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image_thumb17" border="0" alt="image_thumb17" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb17_thumb.png?w=644&#038;h=29" width="644" height="29" /></a></p>
<p>For the time being I am only interested my local development fabric so I need to update my connections string to use my local SQL Express version of the database.</p>
<p>&#160;</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb19.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image_thumb19" border="0" alt="image_thumb19" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb19_thumb.png?w=644&#038;h=327" width="644" height="327" /></a></p>
<p>With our Queue and Database now created and configured, we need to focus on our Code Service.&#160; The purpose of this Code Service is to retrieve messages from our AppFabric Queue and insert them into our SQL Azure table.&#160; We will call this Code Service <strong>CodeMobileQueue</strong> and then will click the <strong>OK</strong> button to proceed.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image17_thumb1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image17_thumb" border="0" alt="image17_thumb" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image17_thumb_thumb.png?w=640&#038;h=484" width="640" height="484" /></a></p>
<p>We now need to add references from our Code Service to both our AppFabric Queue and our SQL Azure Instance.&#160; I always like to rename my references so that they have meaningful names.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb51.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image_thumb5" border="0" alt="image_thumb5" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb5_thumb.png?w=644&#038;h=290" width="644" height="290" /></a></p>
<p>Inside our Code Service, It is now time to start focusing on the plumbing of our solutions We need to be able to retrieve messages from the AppFabric Queue and insert them into our SQL Azure table.</p>
<p><em>public void Run(CancellationToken cancelToken)     <br />&#160;&#160;&#160;&#160;&#160; {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Create reference to our Queue CLient      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueClient qClient = ServiceReferences.CreateQueueMobile();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Create reference to our SQL Azure Connection       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SqlConnection sConn =&#160; ServiceReferences.CreateSqlQueueMobile();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; MessageReceiver mr = qClient.CreateReceiver();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BrokeredMessage bm;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Stream qStream;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; StreamReader sReader;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string address;</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.Diagnostics.Trace.TraceInformation(&quot;Entering Queue Retrieval &quot; + System.DateTime.Now.ToString());</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; while (!cancelToken.IsCancellationRequested)     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Open Connection to the database      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sConn.Open();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; while (mr.TryReceive(new TimeSpan(hours: 0, minutes: 30, seconds: 0), out bm))      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; try     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Note: we are using a Stream here instead of a String like in other examples      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //the reason for this is that did not put the message on the wire using a       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //BrokeredMessage(Binary Format) like in other examples.&#160; We just put on raw text.      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //The way to get around this is to use a Stream and then a StreamReader to pull the text out as a String      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qStream = bm.GetBody&lt;Stream&gt;();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sReader = new StreamReader(qStream);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; address = sReader.ReadToEnd();</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //remove message from the Queue     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; bm.Complete();</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.Diagnostics.Trace.TraceInformation(string.Format(&quot;Message received: ID= {0}, Body= {1}&quot;, bm.MessageId, address));</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //Insert Message from Queue and add it to a Database     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SqlCommand cmd = sConn.CreateCommand();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; cmd.Parameters.Add(new SqlParameter(&quot;@ID&quot;, SqlDbType.NVarChar));      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; cmd.Parameters[&quot;@ID&quot;].Value = bm.MessageId;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; cmd.Parameters.Add(new SqlParameter(&quot;@Address&quot;, SqlDbType.NVarChar));      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; cmd.Parameters[&quot;@Address&quot;].Value = address;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; cmd.CommandText = &quot;Insert into Outages(ID,Address) Values (@ID,@Address)&quot;;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; cmd.CommandType = CommandType.Text;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; cmd.ExecuteNonQuery();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.Diagnostics.Trace.TraceInformation(&quot;Record inserted into Database&quot;);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; catch (Exception ex)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.Diagnostics.Trace.TraceError(&quot;error occurred &quot; + ex.ToString());&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Add your code here      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Thread.Sleep(5 * 1000);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mr.Close();     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; qClient.Close();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sConn.Dispose();</em></p>
<p><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160; }</em></p>
<p><strong>Testing Application</strong></p>
<p>We are done with all the coding and configuration for our solution.&#160; Once again I am going to run this application in the local Dev Fabric so I am going to go ahead and type CRTL + F5.&#160; Once my Windows Azure Emulator has been started and our application has been deployed we can start our Windows Phone Project.</p>
<p>For the purpose of this blog post we are going to run our Windows Mobile solution in the provided emulator.&#160; However, I have verified the application can be side-loaded on a WP7 device and the application does work properly.</p>
<p>We are now going to populate our Address text box with a value.&#160; In this case I am going to provide <strong>1 Microsoft Way</strong>&#160; and click the <strong>Submit</strong> button.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb18.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image_thumb[1]" border="0" alt="image_thumb[1]" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb1_thumb.png?w=256&#038;h=484" width="256" height="484" /></a></p>
<p>Once we click the Submit button we can expect our first status message update indicating that we have received a positive response from ACS.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb52.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image_thumb[5]" border="0" alt="image_thumb[5]" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb5_thumb1.png?w=273&#038;h=484" width="273" height="484" /></a></p>
<p>The next update we will have displayed is one that indicates our message has been successfully sent to our AppFabric Queue.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb31.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image_thumb[3]" border="0" alt="image_thumb[3]" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb3_thumb.png?w=272&#038;h=484" width="272" height="484" /></a></p>
<p>As outlined previously, our WP7 app will publish message to our AppFabric Queue, from there we will have our Code Service de-queue the message and then insert our record into a SQL Azure table.&#160; So if we check our Outages table we will discover that a record has been added to our Database.</p>
<p>&#160;</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb71.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image_thumb[7]" border="0" alt="image_thumb[7]" src="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb7_thumb.png?w=644&#038;h=126" width="644" height="126" /></a></p>
<p>&#160;</p>
<p><strong>Conclusion</strong></p>
<p>Overall I am pretty please with how this demo turned out.&#160; I really like the ability to have a loosely coupled interface that a Mobile client can utilize.&#160; What is also nice about using a RESTful interface is that we have a lot of flexibility when porting a solution like this over to other platforms.</p>
<p>Another aspect of this solution that I like is having a durable Queue in the cloud.&#160; In this solution we had a code service de-queuing this message in the cloud.&#160; However, I could also have some code written that is living on-premise that could retrieve these messages from the cloud and then send them to an LOB system like SAP.&#160; Should we have a planned, or unplanned system outage on-premise, I know that all mobile clients can still talk to the Queue in the cloud.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewareinthecloud.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewareinthecloud.wordpress.com/223/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=223&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewareinthecloud.com/2011/08/13/appfabric-apps-june-2011-ctp-accessing-appfabric-queue-via-rest/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/568970e0114bc0052f7b362b2077b444?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wearsyinc</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb21_thumb.png" medium="image">
			<media:title type="html">image_thumb2[1]</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb4_thumb.png" medium="image">
			<media:title type="html">image_thumb4</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image26_thumb_thumb.png" medium="image">
			<media:title type="html">image26_thumb</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb6_thumb.png" medium="image">
			<media:title type="html">image_thumb6</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb10_thumb.png" medium="image">
			<media:title type="html">image_thumb10</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb12_thumb.png" medium="image">
			<media:title type="html">image_thumb12</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb13_thumb.png" medium="image">
			<media:title type="html">image_thumb13</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb17_thumb.png" medium="image">
			<media:title type="html">image_thumb17</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb19_thumb.png" medium="image">
			<media:title type="html">image_thumb19</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image17_thumb_thumb.png" medium="image">
			<media:title type="html">image17_thumb</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb5_thumb.png" medium="image">
			<media:title type="html">image_thumb5</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb1_thumb.png" medium="image">
			<media:title type="html">image_thumb[1]</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb5_thumb1.png" medium="image">
			<media:title type="html">image_thumb[5]</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb3_thumb.png" medium="image">
			<media:title type="html">image_thumb[3]</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/08/image_thumb7_thumb.png" medium="image">
			<media:title type="html">image_thumb[7]</media:title>
		</media:content>
	</item>
		<item>
		<title>AppFabric Apps (June 2011 CTP) Simple Service Bus Topics&#8211;Part 2</title>
		<link>http://middlewareinthecloud.com/2011/07/31/appfabric-apps-june-2011-ctp-simple-service-bus-topicspart-2/</link>
		<comments>http://middlewareinthecloud.com/2011/07/31/appfabric-apps-june-2011-ctp-simple-service-bus-topicspart-2/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 02:44:07 +0000</pubDate>
		<dc:creator>Kent</dc:creator>
				<category><![CDATA[AppFabric]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[Queue]]></category>

		<guid isPermaLink="false">https://middlewareinthecloud.wordpress.com/2011/07/31/appfabric-apps-june-2011-ctp-simple-service-bus-topicspart-2/</guid>
		<description><![CDATA[(…Continued from Part 1, if you have not read it please do so to understand the context of this post) Solution We want customers to be able to submit power outages to our fictitious power company located in the Redmond, Washington area. What is different this time around(from our Queue scenario) is that due to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=182&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>(…Continued from <a href="http://middlewareinthecloud.com/2011/07/31/appfabric-apps-june-2011-ctp-simple-service-bus-topicspart-1/">Part 1</a>, if you have not read it please do so to understand the context of this post)</p>
<p><strong>Solution</strong></p>
<p>We want customers to be able to submit power outages to our fictitious power company located in the Redmond, Washington area. What is different this time around(from our <a href="http://middlewareinthecloud.com/2011/07/24/appfabric-apps-june-2011-ctp-simple-service-bus-queue-app/">Queue scenario</a>) is that due to the growth in the Kirkland, Washington area we have subcontracted power line maintenance to another company. So we want our Redmond system to receive messages for the Redmond area and this other company to receive messages for Kirkland. The Redmond company should not see the Kirkland messages and vice versa.</p>
<p><strong>Configuring Core Artifacts</strong></p>
<p>The user interface for this application will once again be an ASP.Net Web Application.  We will add this Web Application by clicking on the <strong>Add New Service </strong>label which is found on the AppFabric Design View Canvas.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image57.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb57.png?w=108&#038;h=31" alt="image" width="108" height="31" border="0" /></a></p>
<p>Next, we will want to provide an appropriate name for this Web App and click on the <strong>OK</strong> button.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image58.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb58.png?w=641&#038;h=484" alt="image" width="641" height="484" border="0" /></a></p>
<p>We now need to create a <strong>Service Bus Topic </strong>and can do this by once again clicking on the <strong>Add New Service </strong>label which is found on the AppFabric Design View Canvas.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image59.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb59.png?w=641&#038;h=484" alt="image" width="641" height="484" border="0" /></a></p>
<p>Much like we have had to do with other Service Bus artifacts, we need to provide our Service Bus <strong>IssuerKey, IssuerName and Uri.</strong>  For my URI, I have provided the following value:</p>
<p><a title="sb://wearsysblab.servicebus.appfabriclabs.com/SimpleServiceBusTopic" href="//wearsysblab.servicebus.appfabriclabs.com/SimpleServiceBusTopic">sb://&lt;your_namespace&gt;.servicebus.appfabriclabs.com/SimpleServiceBusTopic</a></p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image60.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb60.png?w=244&#038;h=231" alt="image" width="244" height="231" border="0" /></a></p>
<p><strong>Note: </strong>Notice the <strong>RequiresProvisioning</strong> property which is set to True.  When we deploy our AppFabric application the provisioning of our Topic will be taken care of without any additional work from our side. When we shutdown the Azure Compute Emulator, this Topic will be removed.</p>
<p>In many of the May AppFabric CTP examples out there people handle provisioning tasks by using the <strong>ServiceBusNamespaceClient</strong>  class.  No where in this code will we be directly using this class.  I would imagine that under the hood, the provisioning code is using this class.</p>
<p>Next, our Web application we need to add a reference to this newly created Topic.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image61.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb61.png?w=644&#038;h=288" alt="image" width="644" height="288" border="0" /></a></p>
<p>I like to rename my references to provide a more descriptive title than the default Import1 value.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image111.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image11_thumb.png?w=304&#038;h=151" alt="image" width="304" height="151" border="0" /></a></p>
<p>&nbsp;</p>
<p>With our topic now setup we want to add two subscriptions.  The first subscription will be for our Redmond messages and the second subscription will be for our Kirkland subscription.</p>
<p><strong>Redmond</strong><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image62.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb62.png?w=641&#038;h=484" alt="image" width="641" height="484" border="0" /></a></p>
<p>&nbsp;</p>
<p><strong>Kirkland</strong></p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image63.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb63.png?w=641&#038;h=484" alt="image" width="641" height="484" border="0" /></a></p>
<p>&nbsp;</p>
<p>For each of these Subscriptions we need to once again provide  <strong>IssuerKey, IssuerName and Uri</strong> properties<strong>.  </strong>The <strong>Uri </strong>property for subscriptions provides an interesting twist. The actual word “subscriptions” must be included between the name of your Topic and Subscription. The convention for these Uri are:</p>
<p>sb://your_namespace.servicebus.appfabriclabs.com/TopicName/subscriptions/SubscriptionName</p>
<p>&nbsp;</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image64.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb64.png?w=644&#038;h=68" alt="image" width="644" height="68" border="0" /></a></p>
<p>&nbsp;</p>
<p>Much like in the Queue Blog <a href="http://middlewareinthecloud.com/2011/07/24/appfabric-apps-june-2011-ctp-simple-service-bus-queue-app/">Post</a> we are going to use a Code Service to retrieve messages from our Topic via a Subscription.  We need once again click on the <strong>Add New Service </strong>label and select <strong>Code.</strong></p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image65.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb65.png?w=641&#038;h=484" alt="image" width="641" height="484" border="0" /></a></p>
<p>&nbsp;</p>
<p>This Code Service will represent the Redmond Client and therefore we need to add a reference to the <strong>SimpleServiceBusSubscriptionRedmond </strong>Subscription.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image66.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb66.png?w=644&#038;h=119" alt="image" width="644" height="119" border="0" /></a></p>
<p>&nbsp;</p>
<p>The underlying core of our application should be set and we should be able to build our application.  If we look at the AppFabric Design View Canvas we should see the following:</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image67.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb67.png?w=644&#038;h=464" alt="image" width="644" height="464" border="0" /></a></p>
<p>Our Diagram View should look like this:</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image68.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb68.png?w=475&#038;h=484" alt="image" width="475" height="484" border="0" /></a></p>
<p>&nbsp;</p>
<p><strong>Update Web Application</strong></p>
<p>At this point we have simply configured all of the artifacts that are required in our solution but we have not written any code so our application will not be very functional.  In the Source view of the Default.aspx  page we want to add a few controls:</p>
<ul>
<li>Text Box for our Address</li>
<li>Text Box for our City</li>
<li>Button used to submit our form</li>
</ul>
<p>&nbsp;</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image69.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb69.png?w=644&#038;h=174" alt="image" width="644" height="174" border="0" /></a></p>
<p>In the code behind for Default.aspx we will want to add an event handler for the Button clicked event.</p>
<p><em>protected void btnSubmit_Click(object sender, EventArgs e)<br />
{     <br />
    TopicClient tc = ServiceReferences.CreateSimpleServiceBusTopic();</em></p>
<p><em>    MessageSender ms = tc.CreateSender();</em></p>
<p><em>    BrokeredMessage bm = BrokeredMessage.CreateMessage(txtAddress.Text);<br />
    bm.Properties["OutageCity"] = txtCity.Text;</em></p>
<p><em>    ms.Send(bm);</em></p>
<p><em>    txtAddress.Text = &#8220;&#8221;;<br />
    txtCity.Text = &#8220;&#8221;;</em></p>
<p><em>}</em></p>
<p>Some lines of significance include:</p>
<p><em>TopicClient tc = ServiceReferences.CreateSimpleServiceBusTopic();</em> where we are creating an instance of our TopicClient.</p>
<p>The BrokeredMessage instantiation line includes our message body which is our address that is coming from our Address text box.</p>
<p><em>BrokeredMessage bm = BrokeredMessage.CreateMessage(txtAddress.Text);<br />
</em></p>
<p>&nbsp;</p>
<p>You may also notice where we assign our City value to a property called <strong>OutageCity</strong>.  This property is kinda like a BizTalk Context property.  We are going to be able to route our message based upon this value.  We will later use this property when creating a Subscription Filter.</p>
<p><em>bm.Properties["OutageCity"] = txtCity.Text;</em></p>
<p><strong>Note:</strong> this code looks a little different than the May AppFabic CTP code that you have seen.  In the May CTP we had to worry about our Service Bus configuration for our namespace, Issuer owner and key.  We also had to create an instance of  a MessagingFactory object so that we could create a Topic Client.  I like the AppFabric Application approach better.  It is a little cleaner and all of our configuration info is handled in our Application model.</p>
<p>&nbsp;</p>
<p><strong>Update Code Service</strong></p>
<p>We now need to update our <strong>Run</strong> method that exists within our Code Service.  As discussed in the Queue blog post, this method will continue to run until a cancellation request is received.  The purpose of this method is to retrieve messages from our Topic via our Redmond Subscription.</p>
<p>For the purpose of this demonstration we are simply going to log messages that have been retrieved  in our Trace viewer.</p>
<p><em>public void Run(CancellationToken cancelToken)<br />
       {</em></p>
<p><em>           System.Diagnostics.Trace.TraceInformation(&#8220;Entering Code Service Loop&#8221;);</em></p>
<p><em>           while (!cancelToken.IsCancellationRequested)<br />
           {</em></p>
<p><em>               SubscriptionClient subClient = ServiceReferences.CreateSimpleServiceBusSubscription();<br />
               subClient.MessagingFactory.CreateSubscriptionClient(&#8220;SimpleServiceBusTopic&#8221;, &#8220;SimpleServiceBusSubscriptionRedmond&#8221;);</em></p>
<p><em>               MessageReceiver mr = subClient.CreateReceiver();<br />
               BrokeredMessage bm;</em></p>
<p><em>               while (mr.TryReceive(new TimeSpan(hours: 0, minutes: 0, seconds: 5), out bm))<br />
               {<br />
                   System.Diagnostics.Trace.TraceInformation(string.Format(&#8220;Message received: ID=   {0}, Body= {1}&#8221;, bm.MessageId, bm.GetBody&lt;string&gt;()));<br />
                   bm.Complete();<br />
               }</em></p>
<p><em>               // Add your code here<br />
               Thread.Sleep(5 * 1000);</em></p>
<p><em>           }<br />
       }</em></p>
<p>Some lines of significance include:</p>
<p>Our line where we create a subscription client that will include the name of our Topic and our Subscription.</p>
<p><em>subClient.MessagingFactory.CreateSubscriptionClient(&#8220;SimpleServiceBusTopic&#8221;, &#8220;SimpleServiceBusSubscriptionRedmond&#8221;);</em></p>
<p>The next line is our while loop that will attempt to retrieve messages from this subscription.  If a message is retrieved it will be stored in a BrokeredMessage.</p>
<p><em>while (mr.TryReceive(new TimeSpan(hours: 0, minutes: 5, seconds: 0), out bm))</em></p>
<p><strong>Creating a Kirkland client</strong></p>
<p>Our Kirkland client is going to follow a different path than our Redmond client.  At this point everything that we have built exists in the Azure Cloud.  For our Kirkland client, it is going to reside on-premise.  Since our Topics and Subscriptions are provisioned in the cloud we can access them from within the cloud and on-premise.</p>
<p>For this example we will follow the path that many of the May CTP examples took.  It is a console application that is in a separate solution from this AppFabric Application.  In this application I have added references manually to the ServiceBus CTP assemblies.</p>
<p>&nbsp;</p>
<p><em>using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
using Microsoft.ServiceBus;<br />
using Microsoft.ServiceBus.Messaging;<br />
using Microsoft.ServiceBus.Description; </em></p>
<p><em>namespace SimpleTopicOnPrem<br />
{<br />
    class Program<br />
    {<br />
        static void Main(string[] args)<br />
        {</em></p>
<p><em>            Uri sbURI = ServiceBusEnvironment.CreateServiceUri(&#8220;sb&#8221;, &#8220;&lt;your_namespace&gt;&#8221;, string.Empty);<br />
            string name = &#8220;owner&#8221;;<br />
            string key = &#8220;&lt;your_key&gt;&#8221;;</em></p>
<p><em>           </em></p>
<p><em>            MessagingFactory factory = MessagingFactory.Create(sbURI, TransportClientCredentialBase.CreateSharedSecretCredential(name, key));</em></p>
<p><em>            SubscriptionClient subClient = factory.CreateSubscriptionClient(&#8220;SimpleServiceBusTopic&#8221;, &#8220;SimpleServiceBusSubscriptionKirkland&#8221;);</em></p>
<p><em>            //Next we create the MessageReceiver and receive a message.</em></p>
<p><em>            MessageReceiver mr = subClient.CreateReceiver();</em></p>
<p><em>            BrokeredMessage bm;</em></p>
<p><em>            while (mr.TryReceive(new TimeSpan(hours: 0, minutes: 5, seconds: 0), out bm))<br />
            {<br />
                Console.WriteLine(string.Format(&#8220;Message received: ID= {0}, Body= {1}&#8221;, bm.MessageId, bm.GetBody&lt;string&gt;()));<br />
                bm.Complete();<br />
            }</em></p>
<p><em>            Console.WriteLine(&#8220;Done Reading From Queue&#8221;);<br />
            Console.Read();<br />
        }<br />
    }<br />
}</em></p>
<p>&nbsp;</p>
<p>This code looks pretty similar to our Code Service with the exception of how we create a SubscriptionClient and that we need to deal with our credentials and URI in the application.</p>
<p>&nbsp;</p>
<p><strong>Testing the application</strong></p>
<p>For the purpose of this blog post we are going to keep our AppFabric application in our Development Fabric.  We can provision and deploy our application by typing CRTL + F5.  We should see our web application launch.</p>
<p>Next we will want to start an instance of our Kirkland On Premise client by typing F5.  This means that both of our applications are up and running and ready to receive messages.</p>
<p>Since we have not added any filters on our Subscriptions both applications should receive a copy of any message that we submit. </p>
<p>&nbsp;</p>
<p>The first message that we will send will have an Address of <strong>Space Needle</strong> and a City of <strong>Seattle.</strong></p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image70.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb70.png?w=404&#038;h=210" alt="image" width="404" height="210" border="0" /></a></p>
<p>&nbsp;</p>
<p>In our Trace logs and in our Console application we will discover that our message has been received by both clients.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image71.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb71.png?w=904&#038;h=356" alt="image" width="904" height="356" border="0" /></a></p>
<p>&nbsp;</p>
<p>At this point we have proved that our initial deployment has been successful and that we can broadcast this message to multiple clients.  But, this is not the end state that we desire.  Remember we want the Redmond client to only receive the Redmond messages and the Kirkland client to only receive the Kirkland messages.  In order to accomplish this behavior we need to add Subscription rules.</p>
<p>Unless I have missed something(and please let me know if I have), there is no way to specify our filter when we create our Subscription through the AppFabric Design Canvas.  The only way that I have seen how to do this is through code by using the <strong>ServiceBusNamespaceClient </strong>class.  So I could have written this code but opted for a different option.  The AppFabric Cat team recently released a tool called the <strong>Service Bus Explorer</strong>.  Within this tool, you can provide your credentials and then interrogate your Queues, Topics and Subscriptions.  You can read all about this tool and some more detailed information on their blog <a href="http://appfabriccat.com/2011/07/exploring-topics-and-queues-by-building-a-service-bus-explorer-toolpart-1/">post</a>.</p>
<p>Once I have connected to my namespace using the Service Bus Explorer, I want to navigate to my Redmond subscription and then delete the existing rule.  Basically this rule is saying that any messages should be retrieved using this subscription.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image72.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb72.png?w=1028&#038;h=331" alt="image" width="1028" height="331" border="0" /></a></p>
<p>I then want to right mouse click on the Redmond Subscription and <strong>Add Rule</strong>.  I now need to provide a name for this rule (it can be anything) and a SQL Filter Expression.  In this case I am providing <strong>OutageCity=&#8217;Redmond&#8217;.</strong></p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image73.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb73.png?w=1028&#038;h=329" alt="image" width="1028" height="329" border="0" /></a></p>
<p>With my Subscription rule established for my <strong>Redmond</strong> <strong>Subscription</strong> lets submit another message.  This time we will provide an Address of <strong>1 Microsoft Way</strong> and a City of <strong>Redmond.</strong></p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image74.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb74.png?w=404&#038;h=201" alt="image" width="404" height="201" border="0" /></a></p>
<p>&nbsp;</p>
<p>So notice that both clients received this message.  The reason for this is that this message did match the Subscription rule (filter) for the Redmond Client.  Since we have not configured a Subscription rule (filter) for our Kirkland client it is still configured to receive all messages.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image75.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb75.png?w=904&#038;h=383" alt="image" width="904" height="383" border="0" /></a></p>
<p>To prove that the Redmond Subscription is working, lets send in a message that will not match the Redmond rule.  This time only the Kirkland application should receive it if we make the city equal to Bellevue.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image76.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb76.png?w=404&#038;h=202" alt="image" width="404" height="202" border="0" /></a></p>
<p>&nbsp;</p>
<p>We will discover that the Subscription rule is working.  Our Redmond client did not receive this Bellevue message but our Kirkland client did since its Subscription rule is wide open.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image77.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb77.png?w=904&#038;h=383" alt="image" width="904" height="383" border="0" /></a></p>
<p>So let’s create a Subscription rule for our Kirkland client.  We will head back to the <strong>Service Bus Explorer</strong> tool to do this.</p>
<p>Once again we will delete the Default Rule, this time for the Kirkland Subscription.  We will add a new Rule by right mouse clicking on the <strong>Kirkland</strong> Subscription and selecting <strong>Add Rule.  </strong>We will provide this rule with a Name of <strong>Kirkland</strong> and a SQL Filter Expression of <strong>OutageCity=&#8217;Kirkland&#8217;</strong>.</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image78.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb78.png?w=904&#038;h=285" alt="image" width="904" height="285" border="0" /></a></p>
<p>With our Subscription rule now in place, lets send in a message that only our Kirkland client will receive. </p>
<p>&nbsp;</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image79.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb79.png?w=404&#038;h=212" alt="image" width="404" height="212" border="0" /></a></p>
<p>Sure enough, our Redmond client did not receive a copy of this message since its Subscription rule didn’t match.  Our Kirkland client did receive this message since it did match our Subscription rule</p>
<p><a href="http://middlewareinthecloud.files.wordpress.com/2011/07/image80.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb80.png?w=904&#038;h=405" alt="image" width="904" height="405" border="0" /></a></p>
<p>&nbsp;</p>
<p><strong>Closing Notes</strong>:</p>
<ul>
<li>You will lose any of these Subscription rules between deployments.  When you shutdown the Dev Fabric emulator, your Topic and Subscriptions will be removed.  When you deploy your application to the Local Dev fabric your Topic and Subscriptions will be deployed but your rules/filters will not return unless you configure them again.</li>
<li>Topics will push messages to Subscriptions no matter the Rule that you have in place.  But, clients will only retrieve messages that match the Subscription rule(s).</li>
<li>You can have multiple Subscription rules per Subscription.</li>
<li>It would be nice if we can provide our Subscription rules in our AppFabric Design view canvas.  This way they could be deployed with our Topic and Subscription(s).</li>
<li>Publishers instantiate TopicClient instances, Consumers instantiate Subscription Client instances.</li>
<li>Overall the technology is pretty cool.  Having true pub/sub in the cloud should open up many opportunities for organizations.</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/middlewareinthecloud.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/middlewareinthecloud.wordpress.com/182/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=middlewareinthecloud.com&#038;blog=24632708&#038;post=182&#038;subd=middlewareinthecloud&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://middlewareinthecloud.com/2011/07/31/appfabric-apps-june-2011-ctp-simple-service-bus-topicspart-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/568970e0114bc0052f7b362b2077b444?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wearsyinc</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb57.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb58.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb59.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb60.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb61.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image11_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb62.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb63.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb64.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb65.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb66.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb67.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb68.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb69.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb70.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb71.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb72.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb73.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb74.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb75.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb76.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb77.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb78.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb79.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://middlewareinthecloud.files.wordpress.com/2011/07/image_thumb80.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	</channel>
</rss>
