Azure Service Bus http://rickgaribay.net/category/44.aspx Azure Service Bus en-US Rick G. Garibay rickgaribay@hotmail.com Subtext Version 1.9.5.176 Service Assisted Communications on Microsoft Azure http://rickgaribay.net/archive/2014/11/11/service-assisted-communications-on-microsoft-azure.aspx <p>I had the privilege of presenting at Azure Conf in Channel9 studios a couple of weeks ago. This is the second time I’ve had the pleasure to present at AzureConf (see my 2012 talk on <a href="http://channel9.msdn.com/events/windowsazure/AzureConf2012/A01">WebSockets</a> here:<a title="http://channel9.msdn.com/events/windowsazure/AzureConf2012/A01" href="http://channel9.msdn.com/events/windowsazure/AzureConf2012/A01">http://channel9.msdn.com/events/windowsazure/AzureConf2012/A01</a>)</p> <p>I covered a ton of content in just over 60 minutes including a command demo with a Fez Spider board and Azure Service Bus and a sneak peak of Azure Device Gateway (code-name Reykjavik) deployment on my Azure subscription to demonstrate deployment, telemetry, inquires and commands with a software emulator. </p> <center> <br /><iframe height="288" src="//channel9.msdn.com/Events/Microsoft-Azure/AzureConf-2014/Service-Assisted-Device-Communications-on-Microsoft-Azure/player" frameborder="0" width="512" allowfullscreen="allowfullscreen"></iframe> <br /></center><center><a href="http://bit.ly/1DBVLxk" target="_blank">Direct Link to Channel9 http://bit.ly/1DBVLxk</a> <br /> <br /><iframe height="400" marginheight="0" src="//www.slideshare.net/slideshow/embed_code/41430245" frameborder="0" width="476" marginwidth="0" scrolling="no"></iframe></center><center></center><img src="http://rickgaribay.net/aggbug/372.aspx" width="1" height="1" /> Rick G. Garibay http://rickgaribay.net/archive/2014/11/11/service-assisted-communications-on-microsoft-azure.aspx Tue, 11 Nov 2014 23:20:51 GMT http://rickgaribay.net/archive/2014/11/11/service-assisted-communications-on-microsoft-azure.aspx#feedback http://rickgaribay.net/comments/commentRss/372.aspx http://rickgaribay.net/services/trackbacks/372.aspx Visual Studio Live Redmond &ndash; 8/18 to 8/21 http://rickgaribay.net/archive/2014/08/11/visual-studio-live-redmond-ndash-818-to-821.aspx <div align="center"> <h1>The Goods... </h1> <br /> Thank you Redmond, 1105 Media, Microsoft, fellow speakers and all attendees for a great show. I had a blast! <br /> <table><tbody> <tr> <td><iframe height="400" marginheight="0" src="//www.slideshare.net/slideshow/embed_code/38229557" frameborder="0" width="476" marginwidth="0" scrolling="no"></iframe> <br />Code: <a href="https://github.com/rickggaribay/neurl">https://github.com/rickggaribay/IoT</a> </td> <td> </td> <td><iframe height="400" marginheight="0" src="//www.slideshare.net/slideshow/embed_code/38229551" frameborder="0" width="476" marginwidth="0" scrolling="no"></iframe> <br />Code: <a href="https://github.com/rickggaribay/neurl">https://github.com/rickggaribay/neurl</a> </td> </tr> </tbody></table> </div> +++ <p> </p> <p>I’m thrilled to be speaking at VS Live Redmond next week. The show starts on Monday August 18th and goes through Thursday the 21st on Microsoft campus in Redmond, WA. </p> <p>Events in Redmond a<a href="http://bit.ly/RDSPK10"><img title="RDSPK10 (1)" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; margin: 15px 10px; display: inline; border-top-width: 0px" border="0" alt="RDSPK10 (1)" align="left" src="http://rickgaribay.net/images/rickgaribay_net/WindowsLiveWriter/VisualStudioLiveRedmond818to821_E9B6/RDSPK10%20(1)_3.jpg" width="184" height="154" /></a>re always a special treat as it gives everyone a chance to see the campus, interact with product team members and as always, meet and hang out with some of the best, most recognized speakers in the industry like Ted Neward, Michael Collier, Brian Noyes, Eric Boyd, Rachel Appel, Miguel Castro, Rocky Lhotka, Andrew Brust- the list goes on.</p> <p>I’ll be delivering two Azure focused presentations on the Internet of Things and API development with NodeJS.</p> <p>Since there is only so much space available for the abstracts themselves, I thought I’d elaborate a bit on what you can expect from each session in this short post. You can find more details about both talks on the VS Live Redmond <a href="http://bit.ly/RDSPK10" target="_blank">website</a> or go directly to the abstracts by following the links below.</p> <p><strong>From the Internet of Things to Intelligent Systems: A Developer's Primer</strong></p> <p>In this talk, I lay the foundation for IoT and why you, as a developer should care. I’ll show off a handful of devices ranging from Arduino, Netduino and Fez Spider and demonstrate a number of common patterns currently in the wild including default communication, brokered and service assisted. We’ll explore the challenges that exist today in supporting commands, notifications, inquiries and telemetry. I’ll then spend some time giving you an in-depth tour of Reykjavik, Microsoft’s code name for its reference architecture focused on delivering highly scalable messaging fabrics for modern IoT solutions. </p> <p>We’ll take a look at the reference architecture and how it maps to components on Microsoft Azure. I’ll then demonstrate what a first-class Reykjavik device looks like and demonstrate live telemetry and commands for an end-to-end tour of Reykjavik. I’ve been spending a lot of time with Clemens and team over the last several weeks so this promises to be an inside look at the reference architecture and general shape of things you're unlikely to find publically anywhere else.</p> <p>Learn more about this talk here: <a title="http://bit.ly/VSLRIOT" href="http://bit.ly/VSLRIOT">http://bit.ly/VSLRIOT</a> or follow the conversation on Twitter #VSLTH04</p> <p><strong>Building APIs with NodeJS on Microsoft Azure Websites</strong></p> <p>This is a talk that I’ve been working on for several months now and continues to evolve. As I discuss in my <a href="http://bit.ly/1nT4K6h" target="_blank">latest article in CODE Magazine</a>, it started off as a spike for teaching myself basic NodeJS and kind of evolved into a little project for work that needed a hosting environment. After exploring various options, Azure Websites made the most sense and this talk focuses on the key features and functionality of a little URL shortening API along with key ALM considerations like IDE, unit testing, continuous integration and deployment. </p> <p>I’ll walk you through each step I took in building this API from scratch and deploy it live to Azure Websites as well as show you some really cool things you can do with the Kudu console when things go awry (as they almost always do in a live demo :-)) </p> <p>More about this talk here: <a title="http://bit.ly/VSLRAPI" href="http://bit.ly/VSLRAPI">http://bit.ly/VSLRAPI</a> or follow the conversation on Twitter  #VSLW09</p> <p>If you plan on attending either of my sessions please stop by and say hi or after the talk. I hope to see you there!</p><img src="http://rickgaribay.net/aggbug/371.aspx" width="1" height="1" /> Rick G. Garibay http://rickgaribay.net/archive/2014/08/11/visual-studio-live-redmond-ndash-818-to-821.aspx Mon, 11 Aug 2014 23:38:01 GMT http://rickgaribay.net/archive/2014/08/11/visual-studio-live-redmond-ndash-818-to-821.aspx#feedback http://rickgaribay.net/comments/commentRss/371.aspx http://rickgaribay.net/services/trackbacks/371.aspx IoT, Mobility, Hybrid Cloud, ESB Oh My! A Closer Look at the Neudesic Gartner AADI Demo http://rickgaribay.net/archive/2013/12/21/iot-mobility-hybrid-cloud-esb-oh-my-a-closer-look.aspx <p>Earlier this week, my colleague <a href="http://twitter.com/simonguest" target="_blank">@simonguest</a> <a href="http://simonguest.com/2013/12/12/ibeacon-demo-at-gartner-aadi/" target="_blank">posted a great summary</a> of the demo he and I built together for the <a href="http://www.gartner.com/technology/summits/na/applications/" target="_blank">Gartner AADI Summit</a> in Las Vegas week before last.<a href="http://rickgaribay.net/Images/CustomContent/ModernMobilityatGartnerAADI_D46E/image_8.png"><img style="border-bottom: 0px; border-left: 0px; margin: 5px 5px 5px 30px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" align="right" src="http://rickgaribay.net/Images/CustomContent/ModernMobilityatGartnerAADI_D46E/image_thumb_8.png" width="389" height="480" /></a> </p> <p>As Simon illustrates, the demo combined two areas we are thinking a lot about these days at Neudesic- enterprise mobility and Internet of Things. </p> <p>When we talk about enterprise mobility, we're not talking about mobile device management, governance or provisioning. Our focus is on unlocking the assets that live on premises, behind the firewall so that they are safely and securely exposed, composed and consumed by a variety of devices and composite business applications on the web.</p> <p>In this post, I’ll talk a little bit more about these two areas and dive into the back-end of the demo from a messaging and services perspective to give you a glimpse into the internals of the demo app.   </p> <p><strong><u>Exposing On-Premise Assets</u></strong></p> <p>The key unlocking event for enterprise mobility is enabling the ability to expose assets that live within an organization’s traditional datacenter. These assets include things like other apps, LOB systems, ERPs and databases. In the most traditional sense, the way this problem has been solved is by determining what assets need to be made available, standing up hardware on a DMZ and specifying which inbound ports allow which kind of traffic. Unfortunately, there’s really nothing too innovative about this approach as it is the way we’ve been solving this problem for nearly 20 years. </p> <p>Today, there are many enterprise mobility vendors out there offering an appliance based offering which extends this approach to address things like security, hardware compression, etc., but the agility of these solutions is questionable as they still required CapEx spend, time and resources to provision and manage. </p> <p>Another kind of on-premise asset you will be hearing more and more about involves sensors and devices that communicate with software and other devices. This Machine to Machine (M2M) communication will be revolutionary in domain<a href="http://rickgaribay.net/Images/CustomContent/ModernMobilityatGartnerAADI_D46E/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" align="left" src="http://rickgaribay.net/Images/CustomContent/ModernMobilityatGartnerAADI_D46E/image_thumb.png" width="191" height="93" /></a>s such as transportation, retail, logistics, oil and gas, manufacturing, etc. as they will enable the ability to yield new insights that will at first transform business and then become key to survival. One such device is known as iBeacon.</p> <p>These devices, about the width and half the length of a stick of gum run on Bluetooth Low Energy (BLE) and thus require very little power. These beacons transmit a unique identifier along with signal strength which can then be used to calculate proximity. </p> <p>You can easily imagine a scenario where a retailer provides a free app that interacts with you in the store as you approach these iBeacons. As you might imagine, the back end of the app would learn your behaviors and preferences and target you with interesting offers to influence your browsing and buying habits as well as crowd sourcing what ideal retail layouts look like based on the tons of data that could be collected and modeled. Another scenario might involve tracking shipping containers on trucks. Today, 5.9 RFID technology dominates this space but the amount of infrastructure required to read the tags compared to what can be accomplished with a handful of iBeacons and a handheld device is disruptive indeed. To illustrate this in our demo, our iBeacons communicated directly with iOS and Android handsets, with literally no set up or tear down, allowing us to enumerate, update and “check into” the beacons that were placed throughout the conference floor. </p> <p>For the check in scenario, as you approached an iBeacon, the app would raise an event allowing you to check in to that location. The app then sent a message over the Gartner guest conference WIFI network to a server hosted in our datacenter in Irvine, CA running <a href="http://products.neudesic.com/features" target="_blank">Neuron ESB</a>. The server sits behind our firewall and no inbound ports are open because our IT policy rightfully prohibits it. Instead, a single outbound port is opened by Neuron over an Azure Service Bus Relay which allows for secure, bi-directional messaging for a number of APIs that we implemented which I’ll cover in more detail next.</p> <p><strong><u>Composing and Consuming</u></strong></p> <p>As you can see in the demo sample architecture, we exposed a REST head over Azure Service Bus which provided the external messaging fabric for communicating with the apps running on iOS and Android in the Gartner exhibition hall. Using Neuron’s messaging and processing capabilities, we implemented the following 4 APIs:</p> <p> </p> <table border="0" cellspacing="0" cellpadding="2" width="882"><tbody> <tr> <td valign="top" width="424"> <p><strong></strong></p> <ul> <li><strong>REGISTER BEACON</strong> <br />PUT /beacons <br />{ id: "&lt;&lt;GUID&gt;&gt;", name: "Neudesic Booth, Expo Hall"} </li> </ul> <p> </p> <p> <br /></p> <ul> <li><strong>LOOK UP BEACON</strong> <br />GET /beacons <br />[{ id: "&lt;&lt;GUID&gt;&gt;", name: "Beacon name"}, {id: "&lt;&lt;GUID&gt;&gt;", name: "Beacon name"}] (Array) </li> </ul> <p> </p> <p> <br /></p> <ul> <li><strong>GET ALL BEACONS</strong> <br />GET /beacons/:id <br />{ id: "&lt;&lt;GUID&gt;&gt;", name: "Beacon name"} </li> </ul> <p> </p> <p> <br /></p> <ul> <li><strong>CHECK IN TO BEACON</strong> <br />PUT /beacons/:id/checkin <br />{ userid: "&lt;&lt;facebookid&gt;&gt;" } </li> </ul> <p></p> </td> <td valign="top" width="456"><a href="http://rickgaribay.net/Images/CustomContent/ModernMobilityatGartnerAADI_D46E/image_3.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://rickgaribay.net/Images/CustomContent/ModernMobilityatGartnerAADI_D46E/image_thumb_3.png" width="251" height="480" /></a> <br /><font size="1">The Android version of the app the weekend before the conference. We used Xamarin to build a consistent UX for iOS as well. The iBeacons were re-registered with the actual locations of the booths on the conference floor within a few seconds. </font></td> </tr> </tbody></table> <p> </p> <p>To create a connection to Azure Service Bus, we simply created a Client Connector within a Service Endpoint in Neuron as shown below:</p> <p><a href="http://rickgaribay.net/Images/CustomContent/ModernMobilityatGartnerAADI_D46E/image_4.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://rickgaribay.net/Images/CustomContent/ModernMobilityatGartnerAADI_D46E/image_thumb_4.png" width="617" height="414" /></a> </p> <p>Neuron hosts an instance of the WCF NetMessagingBinding and creates a virtual service endpoint using the URI shown above. </p> <p>In order to route the requests from the app to the right logic, we implemented a simple controller called “Beacon Router” using a Neuron Process. Using a Decision step, we added 4 branches for each API:</p> <p><a href="http://rickgaribay.net/Images/CustomContent/ModernMobilityatGartnerAADI_D46E/image_5.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://rickgaribay.net/Images/CustomContent/ModernMobilityatGartnerAADI_D46E/image_thumb_5.png" width="441" height="480" /></a> </p> <p>Each Decision Step has a condition which returns true or false. If the condition returns true, the steps within the branch are executed. If not, the Process evaluates each branch until a match is found our returns a 404, Resource not Found. </p> <p>Here is a look at the the Check In Condition:</p> <p><a href="http://rickgaribay.net/Images/CustomContent/ModernMobilityatGartnerAADI_D46E/image_6.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://rickgaribay.net/Images/CustomContent/ModernMobilityatGartnerAADI_D46E/image_thumb_6.png" width="640" height="422" /></a> </p> <p>As you can see, we used a simple UriTemplate to define the template for the Check In API. The URI is stored in the ESB message context within the MessageHeader.To property. If the template matches the actual URI, we return true and the steps within the branch execute in sequence. </p> <p>The next step that fires is the Publish step. We included this step for testing purposes to serve as Wire Tap on the messages that reach the branch. In this case, this was useful for inspecting the message off the wire by configuring a subscribing party and using our Neuron Test Client to inspect the message:</p> <p><a href="http://rickgaribay.net/Images/CustomContent/ModernMobilityatGartnerAADI_D46E/image_7.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://rickgaribay.net/Images/CustomContent/ModernMobilityatGartnerAADI_D46E/image_thumb_7.png" width="568" height="480" /></a> </p> <p>This little trick aside, the Publish step is very powerful in that it allows you to asynchronously publish a message on a topic for other subscribers to pick up. Think of Scatter Gather as a good example. </p> <p>The next step you’ll notice is a Call Process step. This step simply allows you to call a nested Process which is helpful in factoring your Process (note that we could have chosen to asynchronously execute a nested process by wrapping it inside a Parallel step).</p> <p>The Check In process starts with a Push step. This step stores the current message for later use. </p> <p>This was required because we needed to first determine if the iBeacon location was valid before allowing a check in. The way Neuron Processes work is that the message is modified by each step allowing for very powerful enrichment and transformation of the message. However, since there can only be one message in context at any time, the current message is overwritten by the message we crafted up for the ODBC step which follows. </p> <p>In this case, we used the ODBC step to query SQL Server for the iBeacon guid. The ODBC step expects a message that conforms to it’s interface, a simple XML syntax for defining the query:</p> <div class="csharpcode"> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 1: </span><span class="kwrd">string</span> sql = String.Empty; </pre> <pre><span class="lnum"> 2: </span> <a href="http://rickgaribay.net/Images/CustomContent/ModernMobilityatGartnerAADI_D46E/SNAGHTMLd1870c0.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="SNAGHTMLd1870c0" border="0" alt="SNAGHTMLd1870c0" align="right" src="http://rickgaribay.net/Images/CustomContent/ModernMobilityatGartnerAADI_D46E/SNAGHTMLd1870c0_thumb.png" width="352" height="1234" /></a></pre> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 3: </span>sql += <span class="str">"&lt;Statement type=\"Text\" sql=\"SELECT * FROM [dbo].[Beacon] WHERE BeaconGuid =?\"&gt;"</span>; </pre> <pre><span class="lnum"> 4: </span>sql += <span class="str">"&lt;Parameters&gt;"</span>; </pre> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 5: </span>sql += <span class="str">"&lt;Parameter type=\"varchar\" name=\"@BeaconGuid\" value=\""</span> + beaconId + <span class="str">"\"/&gt;"</span>; </pre> <pre><span class="lnum"> 6: </span>sql += <span class="str">"&lt;/Parameters&gt;"</span>; </pre> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 7: </span>sql += <span class="str">"&lt;/Statement&gt;"</span>; </pre> <pre><span class="lnum"> 8: </span> </pre> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 9: </span>context.Data.FromXml(sql);</pre> </div> <style type="text/css"><![CDATA[ .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }]]></style> <p> </p> <p>Note line 9 above replaces the message in the context with this new message. The ODBC step executes the query based on the latest context and returns the result:</p> <pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">QueryResults</span><span class="kwrd">&gt;</span> <span class="kwrd">&lt;</span><span class="html">QueryResult</span><span class="kwrd">&gt;</span> <span class="kwrd">&lt;</span><span class="html">Id</span><span class="kwrd">&gt;</span>2<span class="kwrd">&lt;/</span><span class="html">Id</span><span class="kwrd">&gt;</span> <span class="kwrd">&lt;</span><span class="html">BeaconGuid</span><span class="kwrd">&gt;</span>1.1<span class="kwrd">&lt;/</span><span class="html">BeaconGuid</span><span class="kwrd">&gt;</span> <span class="kwrd">&lt;</span><span class="html">BeaconName</span><span class="kwrd">&gt;</span>Neudesic Booth<span class="kwrd">&lt;/</span><span class="html">BeaconName</span><span class="kwrd">&gt;</span> <span class="kwrd">&lt;</span><span class="html">QueryResults</span><span class="kwrd">&gt;</span> <span class="kwrd">&lt;</span><span class="html">QueryResult</span><span class="kwrd">&gt;</span></pre> <style type="text/css"><![CDATA[ .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }]]></style> <p></p> <p>Next, we used a Decision step to check to see if the ODBC step yielded the iBeacon we looked up:</p> <div class="csharpcode"> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 1: </span>var xml = context.Data.ToXmlDocument(); </pre> <pre><span class="lnum"> 2: </span>var node = xml.GetElementsByTagName(<span class="str">"QueryResult"</span>); </pre> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 3: </span><span class="kwrd">return</span> node.Count &gt; 0;</pre> </div> <style type="text/css"><![CDATA[ .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }]]></style> <p>If the node count is not zero, we know we have a match. Otherwise, we issue a 404 since the resource could not be found. </p> <p>Recall that at the beginning of the process execution, the first thing we did was push the message into temporary storage so that we could retrieve it later. Once we determined that the iBeacon exists, we pop the message back into context so that we can grab the iBeacon id from the URI and the user id of the user (in this case, a facebook email address) from the original HTTP message body.</p> <p>To perform the chec kin, we simply did an INSERT into a SQL Server table called CheckIn. The Code step includes the following code, which as before, the ODBC step will consume and perform the unit of work. </p> <p>Since the iBeacon ID is part of the URI, we use UriTemplate again to determine a match and then extract the {id} parameter from the URI:</p> <div class="csharpcode"> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 1: </span>System.UriTemplate template = <span class="kwrd">new</span> System.UriTemplate(<span class="str">"/beacons/{id}/checkin"</span>);</pre> <pre><span class="lnum"> 2: </span>Uri uri = <span class="kwrd">new</span> Uri(context.Data.GetProperty(<span class="str">"MessageHeader"</span>,<span class="str">"To"</span>));</pre> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 3: </span>Uri baseUri = <span class="kwrd">new</span> Uri(<span class="str">"https://"</span> + uri.Host);</pre> <pre><span class="lnum"> 4: </span>var match = template.Match(baseUri, uri);</pre> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 5: </span> </pre> <pre><span class="lnum"> 6: </span>var beaconId = match.RelativePathSegments[1];</pre> </div> <style type="text/css"><![CDATA[ .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }]]></style> <p>From there, we do some formatting and grab the user id from the JSON message payload that was provided in the HTTP body: </p> <div class="csharpcode"> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 1: </span>System.Web.Script.Serialization.JavaScriptSerializer serializer = <span class="kwrd">new</span> System.Web.Script.Serialization.JavaScriptSerializer();</pre> <pre><span class="lnum"> 2: </span> </pre> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 3: </span>Neudesic.TPG.GartnerAADI.Model.CheckIn checkIn = <span class="kwrd">new</span> </pre> <pre><span class="lnum"> 4: </span>System.Web.Script.Serialization.JavaScriptSerializer().Deserialize&lt;Neudesic.TPG.GartnerAADI.Model.CheckIn&gt;(jsonString);</pre> </div> <style type="text/css"><![CDATA[ .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }]]></style> <p>Finally, we build the INSERT statement and load the new message context: </p> <div class="csharpcode"> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 1: </span><span class="kwrd">string</span> sql = String.Empty;</pre> <pre><span class="lnum"> 2: </span> </pre> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 3: </span>sql += <span class="str">"&lt;Statement type=\"Text\" sql=\"INSERT INTO [dbo].[CheckIn]([UserId],[BeaconGuid],[Date]) VALUES(?,?,?)\"&gt;"</span>;</pre> <pre><span class="lnum"> 4: </span>sql += <span class="str">"&lt;Parameters&gt;"</span>;</pre> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 5: </span>sql += <span class="str">"&lt;Parameter type=\"varchar\" name=\"@UserId\" value=\""</span> + checkIn.UserId + <span class="str">"\"/&gt;"</span>;</pre> <pre><span class="lnum"> 6: </span>sql += <span class="str">"&lt;Parameter type=\"varchar\" name=\"@BeaconGuid\" value=\""</span> + beaconId + <span class="str">"\"/&gt;"</span>;</pre> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 7: </span>sql += <span class="str">"&lt;Parameter type=\"varchar\" name=\"@Date\" value=\""</span> + DateTime.Now.ToString() + <span class="str">"\"/&gt;"</span>;</pre> <pre><span class="lnum"> 8: </span>sql += <span class="str">"&lt;/Parameters&gt;"</span>;</pre> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 9: </span>sql += <span class="str">"&lt;/Statement&gt;"</span>;</pre> <pre><span class="lnum"> 10: </span> </pre> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 11: </span>context.Data.FromXml(sql);</pre> </div> <style type="text/css"><![CDATA[ .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }]]></style> <p>If all goes well, we issue an HTTP 200 back to the client: </p> <div class="csharpcode"> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 1: </span>context.Data.Http = <span class="kwrd">new</span> HttpMessage();</pre> <pre><span class="lnum"> 2: </span>context.Data.Http.StatusCode = System.Net.HttpStatusCode.OK;</pre> <pre style="width: 73%; height: 20px" class="alt"><span class="lnum"> 3: </span>context.Data.FromString(<span class="str">""</span>);</pre> </div> <style type="text/css"><![CDATA[ .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }]]></style> <p>Otherwise we own up to the problem being on our end and return a 500 (with some internal logging of course). </p> <p>The Register API is implemented in much the same way. We check to see if the iBeacon exists and if so, do an update, otherwise insert a new record. Thus, this API supports initial standing up of the beacons as well as managing the names as the beacons moved from development to the expo floor. </p> <p>For the GET APIs, we again used ODBC steps to query for a single or all beacons and returned a single or an array of beacons respectively as you can see in the BeaconRouter screenshot at the beginning of this walkthrough. </p> <p><u><strong>Summary</strong></u></p> <p>As you can probably guess, Simon and I had a lot of fun building this demo and the folks at the conference seemed to find it interesting too :-) </p> <p>There are unlimited possibilities once you unlock the ability to safely and securely transcend network, security and business boundaries behind the firewall. And if agility isn’t enough to compel you to think differently about how you expose and compose your enterprise assets for external consumption by mobile devices today, the proliferation of devices- and I’m not talking about tablets or phones- expected to reach in the excess of 250 billion by 2025, will challenge every industry to think differently about their enterprise messaging and mobility strategy. </p><img src="http://rickgaribay.net/aggbug/362.aspx" width="1" height="1" /> Rick G. Garibay http://rickgaribay.net/archive/2013/12/21/iot-mobility-hybrid-cloud-esb-oh-my-a-closer-look.aspx Sat, 21 Dec 2013 15:49:41 GMT http://rickgaribay.net/archive/2013/12/21/iot-mobility-hybrid-cloud-esb-oh-my-a-closer-look.aspx#feedback http://rickgaribay.net/comments/commentRss/362.aspx http://rickgaribay.net/services/trackbacks/362.aspx Introducing the Neuron Azure Service Bus Adapter for Neuron 3.0 http://rickgaribay.net/archive/2013/02/26/introducing-the-neuron-azure-service-bus-adapter-for-neuron-3.0.aspx <p>Anyone who knows me knows that I’m a messaging nerd. I love messaging so much, that I all but gave up web development years ago to focus exclusively in the completely unglamorous spa<a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/Neuron_Logo_3_Gray_and_Blue_PNG_6.png"><img style="background-image: none; border-right-width: 0px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Neuron_Logo_3_Gray_and_Blue_PNG" border="0" alt="Neuron_Logo_3_Gray_and_Blue_PNG" align="right" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/Neuron_Logo_3_Gray_and_Blue_PNG_thumb_2.png" width="240" height="60" /></a>ce of messaging, integration and middleware. What drives me to this space? Why not spend my time and focus my career on building sexy Web or device apps that are much more fashionable and that will allow people to actually see something tangible, that they can see, touch and feel?</p> <p>These are questions I ponder often, but every time I do, an opportunity presents itself to apply my passion for messaging and integration in new and interesting ways that have a pretty major impact for my clients and the industry as a whole. Some recent examples of projects I led and coded on include the Intelligent Transportation and Gaming space including developing <a href="http://www.prepass.com/services/PrePassGates/Pages/WhatIsPrePassGates.aspx" target="_blank">an automated gate management solution</a> to better secure commercial vehicles for major carriers when they’re off the road; integrating slot machines for a major casino on the Vegas strip with other amenities on property to create an ambient customer experience and <a href="http://www.microsoft.com/casestudies/Case_Study_Detail.aspx?CaseStudyID=710000000945" target="_blank">increasing the safety of our highways by reading license plates and pushing messages to and from the cloud</a>. These are just a few recent examples of the ways in which messaging plays an integral role in building highly compelling and interesting solutions that otherwise wouldn’t be possible. Every day, my amazing team at Neudesic is involved in designing and developing solutions on the Microsoft integration platform that have truly game changing business impacts for our clients.</p> <p>As hybrid cloud continues to prove itself as the most pragmatic approach for taking advantage of the scale and performance of cloud computing, the need for messaging and integration becomes only more important. Two technologies that fit particularly well in this space are Neuron and Azure Service Bus. I won’t take too much time providing an overview of each here as there are plenty of good write ups out there that do a fine job, but I do want to share some exciting news that I hope you will find interesting if you are building hybrid solutions today and/or working with Azure Service Bus or Neuron.</p> <p>Over the last year, the Neuron team at Neudesic has been hard at work cranking out what I think is the most significant release since version 1.0 which I started working with back in 2007 and <a href="http://products.neudesic.com/latest" target="_blank">I’m thrilled to share that as of today, Neuron 3.0 is live!</a></p> <p>Building on top of an already super solid WCF 4.0 foundation, <a href="http://products.neudesic.com/Help3/Neuron.htm" target="_blank">Neuron 3.0</a> is a huge release for both Neudesic and our clients, introducing a ton of new features including:</p> <table border="0" cellspacing="0" cellpadding="2" width="1550"><tbody> <tr> <td valign="top" width="469"> <p> </p> <ul> <li><font size="3">Full Platform support for Microsoft .NET 4/LINQ, Visual Studio 2010/2012 </font></li> <li><font size="3">New features in <strong>Management and Administration</strong> including </font> <ul> <li><font size="3">New User Interface Experience </font></li> <li><font size="3">Queue Management </font></li> <li><font size="3">Server and Instance Management </font></li> <li><font size="3">Dependency Viewers </font></li> </ul> </li> <li><font size="3">New features in <strong>Deployment and Configuration</strong> <strong>Management</strong> including </font> <ul> <li><font size="3">New Neuron ESB Configuration storage </font></li> <li><font size="3">Multi Developer support </font></li> <li><font size="3">Incremental Deployment </font></li> <li><font size="3">Command line Deployment </font></li> </ul> </li> <li><font size="3">New features in <strong>Business Process Designer</strong> including </font></li> <ul> <li><font size="3">Referencing External Assemblies </font></li> <li><font size="3">Zoom, Cut, Copy and Paste </font></li> <li><font size="3">New Process Steps </font></li> <ul> <li><font size="3">Duplicate Message Detection </font></li> <li><font size="3">For Each loop </font></li> <li><font size="3">ODBC</font></li> </ul> </ul> <li><font size="3">New <strong>Custom Process Steps</strong> including </font></li> <ul> <li><font size="3">Interface for Controlling UI Properties </font></li> <li><font size="3">Folder hierarchy for UI display </font></li> </ul> <!--EndFragment--></ul> </td> <td valign="top" width="383"> <p><font size="3"></font></p> <ul> <li><font size="3">New features in <strong>Neuron Auditing</strong> including </font> <ul> <li><font size="3">Microsoft SQL Azure </font></li> <li><font size="3">Excluding Body and Custom Properties </font></li> <li><font size="3">Failed Message Monitoring </font></li> </ul> </li> <li><font size="3">New <strong>Messaging features</strong> including </font> <ul> <li><font size="3">AMQP Powered Topics with Rabbit MQ </font></li> <li><font size="3">Improved MSMQ Topic Support </font></li> <li><font size="3">Adapters </font> <ul> <li><font size="3">POP3 and Microsoft Exchange Adapters </font></li> <li><font size="3">ODBC Adapter enhancements </font></li> <li><font size="3"><strong>Azure Service Bus Adapter</strong> </font></li> </ul> </li> </ul> </li> <li><font size="3">New in <strong>Service Broker</strong> including </font></li> <ul> <li><font size="3">REST enhancements </font></li> <li><font size="3">REST support for Service Policies </font></li> <li><font size="3">WSDL support for hosted SOAP services </font></li> </ul> <li><font size="3">Many enhancements to UI, bug fixes and improvements to overall user experience.</font></li> </ul> </td> <td width="696" align="center"><a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/image_20.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/image_thumb_6.png" width="547" height="464" /></a></td> </tr> </tbody></table> <p>In version 2.6, I worked with the team to bring Azure Service Bus Relay Messaging in as a first-class capability. Since Neuron is built on .NET and WCF, and the relay service is exposed very nicely using the WCF programming model, adding the relay bindings to Neuron’s Service Endpoint feature was a no-brainer. This immediately provided the ability to bridge or extend the on-premise pub-sub messaging, transformation, mediation, enrichment and security capabilities with Azure Service Bus Relay, enabling new, highly innovative hybrid solutions <a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/image_5.png"><img style="background-image: none; border-right-width: 0px; margin: 10px 5px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/image_thumb_1.png" width="538" height="354" /></a>for my team and our customers.</p> <p>Between then and this new release, Microsoft released support for queues and topics also known as <a href="http://msdn.microsoft.com/en-us/library/ee732537.aspx" target="_blank">Brokered Messaging</a>. These capabilities introduced the ability to model durable, pull-based pub-sub messaging in scenarios where such a brokered mechanism makes sense. To be clear, Brokered Messaging is not a replacement for Relay- in fact we’ve worked on a number of solutions where both the firewall friendly push messaging capabilities of relay fit  and even compliment certain scenarios (notification first pull-based pub-sub is a very handy dandy messaging pattern where both are used and perhaps I’ll write that up some day). Think of each being tools in your hybrid cloud messaging tool box. </p> <p>It didn’t take long to see the potential of these additions to Azure Service Bus and I started having discussions with the Neuron team at Neudesic and the Azure Service Bus team at Microsoft about building an adapter that like Relay, would bring Brokered Messaging capabilities to Neuron, enabling a complete, rich spectrum of hybrid messaging capabilities.</p> <p>Luckily, both teams agreed it was a good idea and Neudesic was nice enough to let me write the adapter. </p> <p>Obviously, as a messaging nerd, this was an incredibly fun project to work on and after just a couple of hours, I had my first spike up and running on a very early build of Neuron 3.0 which demonstrated pushing a message that was published to Neuron and re-published on an Azure Service Bus topic. 7 major milestones later, a number of internal demos, walkthroughs with the Service Bus Team and a ton of load and performance testing I completed what is now the initial release of the Neuron Azure Service Bus Adapter which ships with Neuron 3.0!</p> <p>What follows is a lap around the core functionality of the adapter largely taken from the product documentation that ships with Neuron 3.0. I hope you will find the adapter interesting enough to take a closer look and even if hybrid cloud is not on your mind, there are literally hundreds of reasons to consider Neuron ESB for your messaging needs. </p> <h2><a name="_Toc347777630"><font color="#000000">Overview</font></a></h2> <p>Windows Azure Service Bus is a Platform as a Service (PaaS) capability provided by Microsoft that provides a highly robust messaging fabric hosted by Microsoft Windows Azure. </p> <p>Azure Service Bus extends on-premise messaging fabrics such as Neuron ESB by providing pub-sub messaging capable of traversing firewalls, a taxonomy for projecting entities and very simple orchestration capabilities via rules and actions.</p> <p>As shown below, Azure Service Bus bridges on-premise messaging capabilities enabling the ability to develop hybrid cloud applications that integrate with external services and service providers that are located behind the firewall allowing a new, modern breed of compositions to transcend traditional network, security and business boundaries.</p> <p><a href="http://www.code-magazine.com/ShowLargeArticleImage.aspx?QuickID=1112041&amp;Image=Garibay%20Figure%201.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image002_8b14d496-1968-495a-9002-9e285eb97cec.jpg" width="575" height="350" /></a></p> <p><b><i>Bridging ESBs in Hybrid Clouds </i></b><i>– Azure Service Bus extends on-premise messaging fabrics such as Neuron ESB enabling a next generation of hybrid cloud applications that transcend traditional network, security and business boundaries.</i></p> <p>There are two services supported by Azure Service Bus: </p> <ul> <li><b>Azure Service Bus Relay:</b> Serves as a push-based relay between two (or more) endpoints. A client and service (or services) establish an outbound, bi-directional socket connection over either TCP or HTTP on the relay and thus, messages from the client tunnel their way through the relay to the service. In this way, both the client and service are really peers on the same messaging fabric. </li> </ul> <p> </p> <ul> <li><b>Azure Service Bus Brokered Messaging: </b>Provides a pull-based durable message broker that supports queues, topics and subscriptions. A party wishing to send messages to Azure Service Bus establishes a TCP or HTTP connection to a queue or topic and pushes messages to the entity. A party wishing to receive messages from Azure Service Bus establishes a TCP or HTP connection and pulls messages from a queue or subscription. </li> </ul> <p>Neuron ESB 3.0 supports both Azure Service Bus services and this topic focuses on support of <a href="http://msdn.microsoft.com/en-us/library/windowsazure/ee732537.aspx">Azure Service Bus Brokered Messaging</a> via the Neuron Azure Service Bus Adapter.</p> <p>For more information on support for Azure Service Bus Relay support, please see “Azure Service Bus Integration” in the “Service Endpoints” topic in the Neuron ESB 3.0 product documentation.</p> <h2><a name="_Toc347777631"><font color="#000000">About the Neuron Azure Service Bus Adapter</font></a></h2> <p>The Neuron Azure Service Bus Adapter provides full support for the latest capabilities provided by the Windows Azure SDK version 1.7. </p> <p>Once the Neuron Azure Service Bus adapter is registered and an Adapter Endpoint is created, all configuration is managed through the property grid of the Adapter located on the properties tab of the Adapter Endpoint’s Details Pane:</p> <p><a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image004_2.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image004_thumb.jpg" width="781" height="285" /></a></p> <p><b><i>Neuron Azure Service Bus Adapter – Property Grid </i></b><i>– All configurations for adapter is managed through the property grid. Properties are divided into 3 sections, General, Publish Mode Properties, and Subscribe Mode Properties.</i></p> <p>Please note that in order to connect to an Azure Service Bus entity with the Neuron Azure Service Bus adapter, you need to sign up for an Azure account and create an Azure Service Bus namespace with the required entities and ACS configuration. For more information, visit <a href="http://azure.com">http://azure.com</a></p> <h4><a name="_Toc347777632"><font color="#000000">Features</font></a></h4> <p>The Neuron Azure Service Bus adapter supports the following Azure Service Bus Brokered Messaging features:</p> <ul> <li>Send to Azure Service Bus Queue </li> <li>Send to Azure Service Bus Topic </li> <li>Receive from Azure Service Bus Queue </li> <li>Receive from Azure Service Bus Subscription </li> </ul> <p>In addition, the Neuron Azure Service Bus adapter simplifies the development experience by providing additional capabilities typical in production scenarios without the need to write custom code including:</p> <ul> <li>Smart Polling </li> <li>Eventual Consistency </li> <li>Transient Error Detection and Retry </li> </ul> <p>The Neuron Azure Service Bus adapter is installed as part of the core Neuron ESB installation. The adapter is packaged into a single assembly located within the <b>\Adapters</b> folder under the root of the default Neuron ESB installation directory:</p> <p>· Neuron.Esb.Adapters.AzureServiceBusAdapter.dll </p> <p>In addition, the following assembly is required and automatically installed in the root of the folder created for the service instance name:</p> <p>· Microsoft.ServiceBus.dll (Azure SDK version 1.7)</p> <p>To use the adapter, it must first be registered within the <i>Neuron ESB Explorer Adapter Registration Window</i>. Within the Adapter Registration Window, the adapter will appear with the name “<b>Azure Service Bus Adapter</b>”. Once registered, a new Adapter Endpoint can be created and configured with an instance name of your choice:</p> <p><a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image006_2.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image006" border="0" alt="clip_image006" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image006_thumb.jpg" width="780" height="509" /></a></p> <p><b><i>Neuron ESB Explorer Adapter Registration Window</i> -<i> Property Grid </i></b><i>– Before configuring the adapter instance for Publish or Subscribe mode, the adapter must first be registered.</i></p> <h4><a name="_Toc347777633"><font color="#000000">Supported Modes</font></a></h4> <p><font color="#000000">Once the initial registration is complete, the Neuron Azure Service Bus adapter can be configured in one of 2 modes: Publish and Subscribe. </font></p> <h4><a name="_Toc347777634"><font color="#000000">Publish</font></a></h4> <p>Publish mode allows Neuron ESB to monitor an Azure Service Bus Queue or Subscription by regularly polling, de-queuing all the messages, and publishing those messages to a Neuron ESB Topic. Messages are read synchronously via a one-way MEP.</p> <p><a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image008_2.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image008" border="0" alt="clip_image008" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image008_thumb.jpg" width="779" height="85" /></a></p> <p><b><i>Receiving Messages from Azure Service Bus </i></b><i>– When in Publish mode, the adapter supports receiving messages from an Azure Service Bus entity and publishing the messages on Neuron ESB.</i></p> <h6><font size="2">Configuration</font></h6> <p>Configuring the Publish mode of the Neuron Azure Service Bus adapter requires that minimally, the following properties are set:</p> <h6><font color="#000000" size="2">General Properties</font></h6> <ul> <li>Azure Service Bus Namespace Name - A registered namespace on Azure Service Bus. For example 'neudesic' would be the namespace for: sb://neudesic.servicebus.windows.net (for information on how to provision, configure and manage Azure Service Bus namespaces, please see the Azure Service Bus topic on <a href="http://azure.com">http://azure.com</a>). </li> <li>Azure ACS Issuer Name – The account/claim name for authenticating to the Windows Azure Access Control Service (ACS - For information on how to provision, configure and manage Azure Access Control namespaces, please see the Azure Access Control topic on <a href="http://azure.com">http://azure.com</a>). </li> <li>Azure ACS Key – The shared key used in conjunction with Azure ACS Issuer Name. </li> <li>Azure Entity Type - Queue or Subscription </li> <li>Azure Channel Type – Default, if outbound TCP port 9354 is open or HTTP to force communication over HTTP port 80/443 (In Default mode, the Neuron Azure Service Bus Adapter will try to connect via TCP. If outbound TCP port 9354 is not open, choose HTTP). </li> <li>Retry Count - The number of Service Bus operations retries to attempt in the event of a transient error (for more information on this setting, see the “Understanding Transient Error Detection and Retry” topic). </li> <li>Minimum Back-Off - The minimum number of seconds to wait before automatically retrying a Service Bus operation in the event that a transient error is encountered (for more information on this setting, see the “Understanding Transient Error Detection and Retry” topic). </li> <li>Maximum Back-Off - The maximum number of seconds to wait before automatically retrying a Service Bus operation in the event that a transient error is encountered (for more information on this setting, see the “Understanding Transient Error Detection and Retry” topic). </li> </ul> <h6><font size="2">Publish Properties</font></h6> <ul> <li>Azure Queue Name- The name of the queue that you want to receive messages from (this option appears when you choose “Queue” as the Azure Entity Type in General Properties). </li> <li>Azure Topic Name – The name of the topic that the subscription you want to receive messages from is associated with (this option appears when you choose “Topic” as the Azure Entity Type in General Properties). </li> <li>Azure Subscription Name - The name of the subscription you want to receive messages from (this option appears when you choose “Topic” as the Azure Entity Type in General Properties). </li> <li>Delete After Receive – False by default. If set to True, deletes the message from the queue or topic after it is received regardless of whether it is published to Neuron successfully (for more information on this setting, see the “Understanding Eventual Consistency” topic). </li> <li>Wait Duration - Duration (in seconds) to wait for a message on the queue or subscription to arrive before completing the poll request (for more information on this setting, see the “Understanding Smart Polling” topic). </li> <li>Neuron Publish Topic - The Neuron topic that messages will be published to. Required for Publish mode. </li> <li>Error Reporting – Determines how all errors are reported in the Windows Event Log and Neuron Logs. Either as Errors, Warnings or Information. </li> <li>Error on Polling – Register failed message and exception with Neuron Audit database. Please note that a valid SQL Server database must be configured and enabled. </li> <li>Audit Message on Failure - Determines if polling of data source continues on error and if consecutive errors are reported. </li> </ul> <p>The following shows the General configuration for an instance of the Neuron Azure Service Bus adapter called “Azure - Receive” in Publish mode:</p> <p><a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image010_2.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image010" border="0" alt="clip_image010" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image010_thumb.jpg" width="780" height="178" /></a></p> <p><b><i>Publish Mode General Configuration</i></b><i>– When in Publish mode, the adapter supports receiving messages from an Azure Service Bus entity and publishing the messages on Neuron ESB.</i></p> <p>The following shows the Properties configuration for a fully configured instance of the Neuron Azure Service Bus adapter in Publish mode:</p> <p><a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image012_2.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image012" border="0" alt="clip_image012" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image012_thumb.jpg" width="780" height="201" /></a></p> <p><b><i>Publish Mode Properties Configuration</i></b><i>– When in Publish mode, the adapter supports receiving messages from an Azure Service Bus entity and publishing the messages on Neuron ESB.</i></p> <h4><a name="_Toc347777635"><font color="#000000">Subscribe</font></a></h4> <p>Subscribe mode allows Neuron ESB to write messages that are published to Neuron ESB to an Azure Service Bus queue or topic. In this manner, Neuron ESB supports the ability to bridge an Azure Service Bus entity, allowing for on-premise parties to seamlessly communicate with Azure Service Bus. Once Neuron ESB receives a message, it sends the message to an Azure Service Bus Queue or Topic.</p> <p><a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image014_2.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image014" border="0" alt="clip_image014" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image014_thumb.jpg" width="779" height="85" /></a></p> <p><b><i>Sending Messages to Azure Service Bus </i></b><i>– When in Subscribe mode, the adapter supports sending messages published on Neuron ESB to an Azure Service Bus entity.</i></p> <h6><font size="2">Configuration</font></h6> <p>In addition to the General Properties covered under the Publish mode documentation, configuring the Subscribe mode of the Neuron Azure Service Bus adapter requires that minimally, the following properties are set:</p> <h6><font size="2">Subscribe Properties</font></h6> <ul> <li>Adapter Send Mode - Choose Asynchronous for maximum throughput or Synchronous for maximum reliability (for more information on this setting, see the “Choosing Synchronous vs. Asynchronous” topic). </li> <li>Adapter Queue Name - The name of the queue you want to send messages to (this option appears when you choose “Queue” as the Azure Entity Type in General Properties). </li> <li>Adapter Topic Name - The name of the topic you want to send messages to (this option appears when you choose “Topic” as the Azure Entity Type in General Properties). </li> </ul> <p>The following shows the General configuration for an instance of the Neuron Azure Service Bus adapter called “Azure - Send” in Subscribe mode:</p> <p><a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image016_2.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image016" border="0" alt="clip_image016" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image016_thumb.jpg" width="780" height="170" /></a></p> <p><b>S<em>ubscribe Mode General Configuration</em></b><em>– When in Subscribe mode, the adapter supports sending messages from Neuron ESB to an Azure Service Bus entity.</em></p> <p>The following shows the Properties configuration for a fully configured instance of the Neuron Azure Service Bus adapter in Subscribe mode:</p> <p><a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image018_2.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image018" border="0" alt="clip_image018" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image018_thumb.jpg" width="780" height="158" /></a></p> <p><b><i>Subscribe Mode General Configuration</i></b><i>– When in Subscribe mode, the adapter supports sending messages from Neuron ESB to an Azure Service Bus entity.</i></p> <h2><a name="_Toc347777636"><font color="#000000">Understanding Transient Error Detection and Retry</font></a></h2> <p><font color="#000000">When working with services in general and multi-tenant PaaS services in particular, it is important to understand that in order to scale to virtually hundreds of thousands of users/applications, most services like Azure Service Bus, SQL Azure,</font> etc. implement a throttling mechanism to ensure that the service remains available.</p> <p>This is particularly important when you have a process or application that is sending or receiving a high volume of messages because in these cases, there is a high likelihood that Azure Service Bus will throttle one or several requests. When this happens, a fault/HTTP error code is returned and it is important for your application to be able to detect this fault and attempt to remediate accordingly.</p> <p>Unfortunately, throttle faults are not the only errors that can occur. As with any service, security, connection and other unforeseen errors (exceptions) can and will occur, so the challenge becomes not only being able to identify the type of fault, but in addition, know what steps should be attempted to remediate. </p> <p>Per the guidance provided by the Azure Customer Advisory Team (<a href="http://windowsazurecat.com/2010/10/best-practices-for-handling-transient-conditions-in-sql-azure-client-applications/">http://windowsazurecat.com/2010/10/best-practices-for-handling-transient-conditions-in-sql-azure-client-applications/</a>), the Neuron Azure Service Bus adapter uses an exponential back-off based on the values provided for the Retry Count, Minimum Back-Off and Maximum Back-Off properties within the Properties tab for both Publish and Subscribe mode.</p> <p>Given a value of 3 retries, two seconds and ten seconds respectively, the adapter will automatically determine a value between two and ten and back off exponentially one time for each retry configured:</p> <p><a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image020_2.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image020" border="0" alt="clip_image020" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image020_thumb.jpg" width="780" height="158" /></a></p> <p><b><i>Exponential Back-Off Configuration</i></b><i>– The adapter will automatically detect transient exceptions/faults and retry by implementing an exponential back-off algorithm given a retry count, initial a<a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image022_4.jpg"><img style="background-image: none; border-right-width: 0px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image022" border="0" alt="clip_image022" align="right" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image022_thumb_1.jpg" width="111" height="293" /></a>nd max back-off configuration.</i></p> <p>Taking this example, as shown in the figure on the right, if the adapter chose an initial back-off of two seconds, in the event of a transient fault being detected (i.e. throttle, timeout, etc.) the adapter would wait two seconds before trying the operation again (i.e. sending or receiving a message) and exponentially increment the starting value until either the transient error disappears or the retry count is exceeded.</p> <p>In the event that the retry count is exceeded, the Neuron Azure Service Bus adapter will automatically persist a copy of the message in the audit database to ensure that no messages are lost (provided a SQL Server database has been configured).</p> <h2><a name="_Toc347777637"><font color="#000000">Understanding Smart Polling</font></a></h2> <p><font color="#000000">When <a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/image_7.png"><img style="background-image: none; border-right-width: 0px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="left" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/image_thumb.png" width="161" height="240" /></a>configuring the Neuron Azure Service Bus Adapter in Publish mode, the adapter can take advantage of a Neuron ESB feature known as Smart Polling. </font></p> <p><font color="#000000">With Smart Polling, the adapter will connect to an Azure Service Bus queue or subscription and check for messages. If one or message is available, all messages will be immediately delivered (see “Understanding Eventual Consistency” for more information on supported read behaviors). </font></p> <p><font color="#000000">However, if no messages are available, the adapter will open a connection to the Azure Service Bus entity and wait for a specified timeout before attempting to initiate another poll request (essentially resulting in a long-polling behavior). In this manner, Azure Service Bus quotas are honored while ensuring that the adapter issues a receive request only when the configured timeout occurs as opposed to repeatedly polling the Azure Service Bus entity.</font></p> <h2><a name="_Toc347777638"><font color="#000000">Understanding Eventual Consistency</font></a></h2> <p><font color="#000000">When working with Azure Service Bus, it is important to note that the model for achieving consistency is different than traditional distributed transaction models. For example, when working with modern relational databases or spanning multiple services that are</font> composed into a logical unit of work (using WS-Atomic Transactions for example), it is a common expectation that work will either be performed completely or not at all. These types of transactions have the characteristics of being atomic, consistent, independent and durable (ACID). However, to achieve this level of consistency, a resource manager is required to coordinate the work being carried out by each service/database that participates in a logical transaction.</p> <p>Unfortunately, given the virtually unlimited scale of the web and cloud computing, it is impossible to deploy enough resource managers to account for the hundreds of thousands if not millions of resources required to achieve this level of consistency. Even if this were possible, the implications on achieving the scale and performance demanded by modern cloud-scale applications would be physically impossible.</p> <p>Of course, consistency is still as important for applications that participate in logical transactions across or consume cloud services. An alternative approach is to leverage an eventually consistent, or basically available, soft state, eventually consistent (BASE) approach to transactions. </p> <h6><font size="2">Ensuring Eventual Consistency in Publish Mode<a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/image_10.png"><img style="background-image: none; border-right-width: 0px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/image_thumb_2.png" width="240" height="104" /></a></font></h6> <p>Azure Service Bus supports this model for scenarios that require consistency and the Neuron Azure Serviced Bus adapter makes taking advantage of this capability simply a matter of setting the “Delete After Receive” property (available in the Publish Mode Settings) to False, which is the default. </p> <p>When set to False, when receiving a message, the adapter will ensure that the message is not discarded from the Azure Service Bus entity until the message has been successfully published to Neuron ESB. In the event that an error occurs when attempting to publish a message, the message will be restored on the Azure Service Bus entity ensuring that it remains available for a subsequent attempt to receive the message (Please note that lock durations configured on the entity will affect the behavior of this feature. For more information, please refer to the Azure Service Bus documentation on MSDN: <a href="http://msdn.microsoft.com/en-us/library/ee732537.aspx">http://msdn.microsoft.com/en-us/library/ee732537.aspx</a>).</p> <h2><a name="_Toc347777639"><font color="#000000">Choosing Synchronous versus Asynchronous Receive</font></a></h2> <p><font color="#000000">When the Neuron Azure Service Bus adapter is configured in Subscribe mode, you can choose to send messages to an Azure Service Bus queue or topic in either synchronous or asynchronous mode by setting the <b><i>Adapter Send Mode </i></b>property to either “Asynchronous” or “Synchronous</font>” in the Subscribe Mode Property group. </p> <p>If reliability is a top priority such that the possibility of message loss cannot be tolerated, it is recommended that you choose Synchronous. In this mode, the adapter will transmit messages to an Azure Service Bus queue or topic at rate of about 4 or 5 per second. While it is possible to increase this throughput by adding additional adapters in subscribe mode, as a general rule, use this mode when choosing reliability at the expense of performance/throughput.</p> <p>To contrast, if performance/low-latency/throughput is a top priority, configuring the adapter to send asynchronously will result in significantly higher throughput (by several orders of magnitude). While the send performance in this mode is much higher, in the event of a catastrophic failure (server crash, out of memory exception) it is possible for messages that have left the Neuron ESB process but have not yet been transmitted to the Azure Service Bus (i.e. are in memory) the possibility for message loss is much higher than when in synchronous mode because of the significantly higher density of messages being transmitted. </p> <p><b></b></p> <h2><a name="_Toc347777640"><font color="#000000">Other Scenarios</font></a></h2> <h4><a name="_Toc347777641"><font color="#000000">Temporal Decoupling</font></a></h4> <p><font color="#000000"><a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image024_2.jpg"><img style="background-image: none; border-right-width: 0px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image024" border="0" alt="clip_image024" align="left" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image024_thumb.jpg" width="133" height="157" /></a>One of the benefits of any queue-based messaging pattern is that the publisher/producer is decoupled from the subscribers/consumers. As a result, parties interested in a given message can be added and removed without any knowledge of the publisher/producer.</font></p> <p><font color="#000000">By persisting the message until</font> an interested party receives the message, the sending party is further decoupled from the receiving party because the receiving party need not be available at the time the message was written to persistence store. Azure Service Bus supports temporal decoupling with both queues and topics because they are durable entities.<a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image026_2.jpg"><img style="background-image: none; border-right-width: 0px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image026" border="0" alt="clip_image026" align="right" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image026_thumb.jpg" width="117" height="240" /></a></p> <p>As a result, a party that writes new order messages to an Azure Service Bus queue can do so uninhibitedly as shown below: </p> <p>When you configure an instance of the Neuron Azure Service Bus adapter in Publish mode, you can disable the adapter by unchecking the “Enabled” box. Any new messages written to the Azure Service Bus queue or subscription will persist until the adapter is enabled once again. </p> <p><b></b></p> <h4><a name="_Toc347777642"><font color="#000000">Competing Consumers</font></a></h4> <p><font color="#000000">Another messaging pattern that allows you to take advantage of the benefits of pull-based pub-sub model from a performance and scalability perspective is to adjust the number of consumers supported by the resources available to you</font> and keep adding consumers until throughput requirements are met.</p> <p>To take advantage of this pattern with the Neuron Azure Service Bus adapter and Azure Service Bus, simply add additional instances of the Publishing adapter as needed:</p> <p><a href="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image028_2.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image028" border="0" alt="clip_image028" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/848795df03a9_13251/clip_image028_thumb.jpg" width="568" height="277" /></a></p> <p><b><i>Competing Consumers </i></b><i>–Adding additional consumers with Neuron Azure Service Bus is simply a matter of adding additional instances of the Publishing adapter. </i></p> <h2><a name="_Toc347777643"><font color="#000000">Property Table</font></a></h2> <p> </p> <p>The following table provides details for each property exposed through the Neuron Explorer UI:</p> <table border="1" cellspacing="0" cellpadding="0"><tbody> <tr> <td valign="top" width="18%"> <p><b>Section Name</b></p> </td> <td valign="top" width="19%"> <p><b>Property Name</b></p> </td> <td valign="top" width="10%"> <p><b>Required</b></p> </td> <td valign="top" width="50%"> <p><b>Description</b></p> </td> </tr> <tr> <td valign="top" width="18%"> <p><i>General</i></p> </td> <td valign="top" width="19%"> </td> <td valign="top" width="10%"> </td> <td valign="top" width="50%"> <p><i>These properties are used for all modes of the adapter</i></p> </td> </tr> <tr> <td valign="top" width="18%"> </td> <td valign="top" width="19%"> <p>Azure Service Bus Namespace Name </p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="top" width="50%"> <p>A registered namespace on Azure Service Bus. For example 'neudesic' would be the namespace for: sb://neudesic.servicebus.windows.net </p> </td> </tr> <tr> <td valign="top" width="18%"> </td> <td valign="top" width="19%"> <p>Azure ACS Issuer Name </p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="top" width="50%"> <p>The account/claim name for authenticating to the Windows Azure Access Control Service (ACS) </p> </td> </tr> <tr> <td valign="top" width="18%"> </td> <td valign="top" width="19%"> <p>Azure ACS Key</p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="top" width="50%"> <p>The shared key used in conjunction with Azure ACS Issuer Name.</p> </td> </tr> <tr> <td valign="top" width="18%"> </td> <td valign="top" width="19%"> <p>Azure Entity Type </p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="top" width="50%"> <p><b>Default Queue. </b>Queue or Topic</p> </td> </tr> <tr> <td valign="top" width="18%"> </td> <td valign="top" width="19%"> <p>Azure Channel Type</p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="top" width="50%"> <p><b>Default is Default.</b> Default, if outbound TCP port 9354 is open or HTTP to force communication over HTTP port 80/443 </p> </td> </tr> <tr> <td valign="top" width="18%"> </td> <td valign="top" width="19%"> <p>Retry Count </p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="top" width="50%"> <p><b>Default 5. </b>The number of Service Bus operations retries to attempt in the event of a transient error (for more information on this setting, see the “Understanding Transient Error Detection and Retry” topic). </p> </td> </tr> <tr> <td valign="top" width="18%"> </td> <td valign="top" width="19%"> <p>Minimum Back Off</p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="top" width="50%"> <p><b>Default 3. </b>The minimum number of seconds to wait before automatically retrying a Service Bus operation in the event that a transient error is encountered (for more information on this setting, see the “Understanding Transient Error Detection and Retry” topic).</p> </td> </tr> <tr> <td valign="top" width="18%"> </td> <td valign="top" width="19%"> <p>Maximum Back Off</p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="top" width="50%"> <p><b>Default 3.</b> The maximum number of seconds to wait before automatically retrying a Service Bus operation in the event that a transient error is encountered (for more information on this setting, see the “Understanding Transient Error Detection and Retry” topic).</p> </td> </tr> <tr> <td valign="top" width="18%"> <p><i>Publish Properties</i></p> </td> <td valign="top" width="19%"> </td> <td valign="top" width="10%"> </td> <td valign="top" width="50%"> <p><i>These properties are only used when the adapter is in either Request/Response or Publish mode.</i></p> </td> </tr> <tr> <td valign="top" width="18%"> <p><i></i></p> </td> <td valign="bottom" width="19%"> <p>Azure Queue Name</p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="bottom" width="50%"> <p>The name of the queue that you want to receive messages from (this option appears when you choose “Queue” as the Azure Entity Type in General Properties).</p> </td> </tr> <tr> <td valign="top" width="18%"> <p><i></i></p> </td> <td valign="bottom" width="19%"> <p>Azure Topic Name </p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="bottom" width="50%"> <p>The name of the topic that the subscription you want to receive messages from is associated with (this option appears when you choose “Topic” as the Azure Entity Type in General Properties).</p> </td> </tr> <tr> <td valign="top" width="18%"> <p><i></i></p> </td> <td valign="bottom" width="19%"> <p>Azure Subscription Name </p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="bottom" width="50%"> <p>The name of the subscription you want to receive messages from (this option appears when you choose “Topic” as the Azure Entity Type in General Properties).</p> </td> </tr> <tr> <td valign="top" width="18%"> <p><i></i></p> </td> <td valign="bottom" width="19%"> <p>Delete After Receive</p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="bottom" width="50%"> <p><b>Default False</b>. If set to True, deletes the message from the queue or topic after it is received regardless of whether it is published to Neuron successfully (for more information on this setting, see the “Understanding Eventual </p> </td> </tr> <tr> <td valign="top" width="18%"> <p><i></i></p> </td> <td valign="bottom" width="19%"> <p>Wait Duration </p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="bottom" width="50%"> <p><b>Default 5.</b> Duration (in seconds) to wait for a message on the queue or subscription to arrive before completing the poll request (for more information on this setting, see the “Understanding Smart Polling” topic).</p> </td> </tr> <tr> <td valign="top" width="18%"> <p><i></i></p> </td> <td valign="bottom" width="19%"> <p>Neuron Publish Topic </p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="bottom" width="50%"> <p>The Neuron topic that messages will be published to. Required for Publish mode.</p> </td> </tr> <tr> <td valign="top" width="18%"> <p><i></i></p> </td> <td valign="bottom" width="19%"> <p>Error Reporting </p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="bottom" width="50%"> <p><b>Default Error. </b>Determines how all errors are reported in the Windows Event Log and Neuron Logs. Either as Errors, Warnings or Information.</p> </td> </tr> <tr> <td valign="top" width="18%"> <p><i></i></p> </td> <td valign="bottom" width="19%"> <p>Error on Polling</p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="bottom" width="50%"> <p><b>Default Stop Polling On Error. </b>Register failed message and exception with Neuron Audit database. Please note that a valid SQL Server database must be configured and enabled.</p> </td> </tr> <tr> <td valign="top" width="18%"> <p><i></i></p> </td> <td valign="bottom" width="19%"> <p>Audit Message on Failure </p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="bottom" width="50%"> <p><b>Default False. </b>Determines if polling of data source continues on error and if consecutive errors are reported.</p> </td> </tr> <tr> <td valign="top" width="18%"> <p><i>Subscribe Properties</i></p> </td> <td valign="top" width="19%"> </td> <td valign="top" width="10%"> </td> <td valign="top" width="50%"> <p><i>These properties are only used when the adapter is in either Solicit/Response or Request/Response mode.</i></p> </td> </tr> <tr> <td valign="top" width="18%"> <p><i></i></p> </td> <td valign="top" width="19%"> <p>Adapter Send Mode</p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="top" width="50%"> <p><b>Default Asynchronous. </b>Choose Asynchronous for maximum throughput or Synchronous for maximum reliability (for more information on this setting, see the “Choosing Synchronous vs. Asynchronous” topic).</p> </td> </tr> <tr> <td valign="top" width="18%"> <p><i></i></p> </td> <td valign="top" width="19%"> <p>Adapter Queue Name</p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="top" width="50%"> <p>The name of the queue you want to send messages to (this option appears when you choose “Queue” as the Azure Entity Type in General Properties).</p> </td> </tr> <tr> <td valign="top" width="18%"> <p><i></i></p> </td> <td valign="top" width="19%"> <p>Adapter Topic Name</p> </td> <td valign="top" width="10%"> <p>Yes</p> </td> <td valign="top" width="50%"> <p>The name of the topic you want to send messages to (this option appears when you choose “Topic” as the Azure Entity Type in General Properties).</p> </td> </tr> </tbody></table> <h2><a name="_Toc347777644"><font color="#000000">Message Format</font></a></h2> <p><font color="#000000">Azure Service Bus uses a proprietary message envelope called a </font><a href="http://msdn.microsoft.com/en-us/library/windowsazure/microsoft.servicebus.messaging.brokeredmessage.aspx"><font color="#000000">Brokered Message</font></a><font color="#000000"> as the unit of communication between all messaging entities including queues, topics and subscriptions.</font></p> <h4><a name="_Toc347777645"><font color="#000000">Publish Mode</font></a></h4> <p><font color="#000000">In Publish mode, the</font> Neuron Azure Service Bus Adapter will automatically map the body of the incoming Brokered Message to the Body property of the Neuron ESBMessage serializing the payload based on the detected encoding type as follows: </p> <p> </p> <p> </p><table border="1" cellspacing="0" cellpadding="0"><tbody> <tr> <td valign="top" width="282"> <p><b>BrokeredMessage.ContentType</b></p> </td> <td valign="top" width="254"> <p><b>ESBMessage.Header.BodyType</b></p> </td> </tr> <tr> <td valign="top" width="282"> <p>text/plain</p> </td> <td valign="top" width="254"> <p>text/plain</p> </td> </tr> <tr> <td valign="top" width="282"> <p>text/xml</p> </td> <td valign="top" width="254"> <p>text/xml</p> </td> </tr> <tr> <td valign="top" width="282"> <p>application/msbin-1</p> </td> <td valign="top" width="254"> <p>application/msbin-1</p> </td> </tr> <tr> <td valign="top" width="282"> <p>binary/bytes</p> </td> <td valign="top" width="254"> <p>binary/bytes</p> </td> </tr> <tr> <td valign="top" width="282"> <p>Other</p> </td> <td valign="top" width="254"> <p>text/xml</p> </td> </tr> </tbody></table> <p>Note per the table above that unless otherwise specified, the Neuron Azure Service Bus adapter will assume that the incoming message payload is text/xml. </p> <p>In addition, any properties stored in the Property property bag of the BrokeredMessage will be automatically mapped to the ESBMessage property bag provided the “Include Metadata” option is checked on the General tab in the Adapter Endpoints configuration. An exception to this rule is that the adapter will always map the BrokeredMessage.LockToken to the ESBMessage property bag with the same name regardless of whether “Include Metadata” is checked. </p> <h4><a name="_Toc347777646"><font color="#000000">Subscribe Mode</font></a></h4> <p>In Subscribe mode, the Neuron Azure Service Bus Adapter will automatically create a new Brokered Message for each transmission and map the body of an outgoing ESBMessage to the new message body as follows: </p> <p> </p> <p> </p><table border="1" cellspacing="0" cellpadding="0"><tbody> <tr> <td valign="top" width="282"> <p><b>ESBMessage.Header.BodyType</b></p> </td> <td valign="top" width="258"> <p><b>BrokeredMessage.ContentType</b></p> </td> </tr> <tr> <td valign="top" width="282"> <p>text/plain</p> </td> <td valign="top" width="258"> <p>text/plain</p> </td> </tr> <tr> <td valign="top" width="282"> <p>text/xml</p> </td> <td valign="top" width="258"> <p>text/xml</p> </td> </tr> <tr> <td valign="top" width="282"> <p>application/msbin-1</p> </td> <td valign="top" width="258"> <p>application/msbin-1</p> </td> </tr> <tr> <td valign="top" width="282"> <p>binary/bytes</p> </td> <td valign="top" width="258"> <p>binary/bytes</p> </td> </tr> <tr> <td valign="top" width="282"> <p>Other</p> </td> <td valign="top" width="258"> <p>text/xml</p> </td> </tr> </tbody></table> <p>In addition, any properties stored in the Property property bag of the ESBMessage will be automatically mapped to the BrokeredMessage property bag provided the “Include Metadata” option is checked on the General tab in the Adapter Endpoints configuration. </p> <h2><a name="_Toc347777647"><font color="#000000">Brokered Message Limitations</font></a></h2> <p>Note that the total payload size for Azure Service Bus messages is 256KB. The Neuron Azure Service Bus adapter will throw a runtime exception if a message greater than or equal to 256KB is sent and will save the message to the failed audit table. </p> <h2>Wrapping Up</h2> <p>Thanks for your interest and please don’t hesitate to hit me with questions, comments and feedback. If you see something missing, I’d love to hear from you as we are already starting to think about features for v.Next.</p> <p>I had a ton of fun writing this adapter and would like to that the Neuron product team for allowing me to make this small contribution to this incredible release.</p> <p>This adapter is just a small part of this major release and I hope this post has peeked your interest in <a href="http://products.neudesic.com/latest" target="_blank">checking out Neuron ESB</a>. Getting up and running is super simple and you can download the trial bits here: <a title="http://products.neudesic.com/" href="http://products.neudesic.com/">http://products.neudesic.com/</a></p><img src="http://rickgaribay.net/aggbug/355.aspx" width="1" height="1" /> Rick G. Garibay http://rickgaribay.net/archive/2013/02/26/introducing-the-neuron-azure-service-bus-adapter-for-neuron-3.0.aspx Tue, 26 Feb 2013 17:47:44 GMT http://rickgaribay.net/archive/2013/02/26/introducing-the-neuron-azure-service-bus-adapter-for-neuron-3.0.aspx#feedback 1 http://rickgaribay.net/comments/commentRss/355.aspx http://rickgaribay.net/services/trackbacks/355.aspx Interview on Magnanimous Software Net Cast http://rickgaribay.net/archive/2012/12/10/interview-on-magnanimous-software-net-cast.aspx <a href="http://msnetcast.com/" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/Interview-on-Magnanimous-Software-Webcas_A3EE/image_3.png" width="244" height="208" /></a> <p>I had the honor of being interviewed by fellow MVP Magnus Mastersson (<a href="http://twitter.com/noopman" target="_blank">@noopman</a>) for his Magnanimous Software Podcast (love that name).</p> <p>Other than the dubious task of following really smart guys like Glenn Block and Mads Torgersen in this new series, we had a good chat about Neuron ESB, Azure Service Bus, BizTalk Server 2013, my book and other topics. In addition, Magnus managed to uncover some little known tidbits about my past <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://rickgaribay.net/images/rickgaribay_net/Windows-Live-Writer/Interview-on-Magnanimous-Software-Webcas_A3EE/wlEmoticon-smile_2.png" /></p> <p>The interview was a lot of fun and is now available here for your listening pleasure: <a href="http://msnetcast.com/0003/rick-garibay-wcf-biztalk-servicebus-book">http://msnetcast.com/0003/rick-garibay-wcf-biztalk-servicebus-book</a></p> <p>Links from the show:</p> <ul> <li>The podcast:<a href="http://msnetcast.com/0003/rick-garibay-wcf-biztalk-servicebus-book">http://msnetcast.com/0003/rick-garibay-wcf-biztalk-servicebus-book</a></li> <li>Neuron ESB:<a title="http://products.neudesic.com/" href="http://products.neudesic.com/">http://products.neudesic.com/</a> </li> <li>Windows Server AppFabric Cookbook:<a title="http://www.amazon.com/Microsoft-Windows-Server-AppFabric-Cookbook/dp/1849684189/" href="http://www.amazon.com/Microsoft-Windows-Server-AppFabric-Cookbook/dp/1849684189/">http://www.amazon.com/Microsoft-Windows-Server-AppFabric-Cookbook/dp/1849684189/</a> </li> <li>BizTalk Server: <a title="http://www.microsoft.com/biztalk/en/us/default.aspx" href="http://www.microsoft.com/biztalk/en/us/default.aspx">http://www.microsoft.com/biztalk/en/us/default.aspx</a>  </li> <li>Azure Service Bus Integration Services: <a title="http://msdn.microsoft.com/en-us/library/windowsazure/hh689864.aspx" href="http://msdn.microsoft.com/en-us/library/windowsazure/hh689864.aspx">http://msdn.microsoft.com/en-us/library/windowsazure/hh689864.aspx</a> </li> <li>Microsoft Case Study on Xerox Azure Hybrid Cloud Solution: <a title="http://www.microsoft.com/casestudies/Windows-Azure/Xerox-Corporation/Transportation-Solution-Provider-Screens-Commercial-Vehicles-with-Cloud-Service/710000000945" href="http://www.microsoft.com/casestudies/Windows-Azure/Xerox-Corporation/Transportation-Solution-Provider-Screens-Commercial-Vehicles-with-Cloud-Service/710000000945">http://www.microsoft.com/casestudies/Windows-Azure/Xerox-Corporation/Transportation-Solution-Provider-Screens-Commercial-Vehicles-with-Cloud-Service/710000000945</a> </li> </ul> <p>Thanks Magnus!</p><img src="http://rickgaribay.net/aggbug/352.aspx" width="1" height="1" /> Rick G. Garibay http://rickgaribay.net/archive/2012/12/10/interview-on-magnanimous-software-net-cast.aspx Mon, 10 Dec 2012 18:52:47 GMT http://rickgaribay.net/archive/2012/12/10/interview-on-magnanimous-software-net-cast.aspx#feedback http://rickgaribay.net/comments/commentRss/352.aspx http://rickgaribay.net/services/trackbacks/352.aspx Windows Server AppFabric Cookbook is Out! http://rickgaribay.net/archive/2012/07/26/windows-server-appfabric-cookbook-is-out.aspx <p>I'm very pleased to announce the release of my new book "Windows Server AppFabric Cookbook" which hit distribution today, July 26, 2012. <a href="http://www.packtpub.com/microsoft-windows-server-appfabric-cookbook/book"><img style="margin: 5px; display: inline; float: right" alt="Microsoft Windows Server AppFabric Cookbook" align="right" src="http://www.packtpub.com/sites/default/files/4187EN_Microsoft%20Windows%20Server%20AppFabric%20Cookbook.jpg" width="357" height="454" /></a></p> <p>Before I get into the details of the book, I want to start by thanking my co-author and friend <a href="http://twitter.com/HammadRajjoub">Hammad Rajjoub</a> for inviting me to participate in this project and trusting me to help carry out his vision for this book. Hammad and I both share a labor of love as it applies to the Microsoft distributed technology stack affectionately (and somewhat nostalgically) known as "Connected Systems" and this project represents nearly a year of work in bringing our collective experience to bear in this book. </p> <p>I would also like to express my appreciation to Adnan Masood and Zubair Ahmed who volunteered their time despite extremely busy schedules reviewing the book as it progressed and providing very valuable technical feedback along the way. Their time and dedication has contributed immensely to the quality of the book and any errors or things we've overlooked are our fault alone. </p> <p>Last but not least, I'd like to thank Ron Jacobs at Microsoft for writing the foreword to the book and providing his support and encouragement along the way.</p> <p><strong><font size="3">Why this book and why now?</font></strong></p> <p>It's hard to believe that Dublin has been in the wild for just over 2 years. The first release of <a href="http://www.microsoft.com/en-us/server-cloud/windows-server/appfabric.aspx">Windows Server AppFabric</a> went to GA in June, 2010 at TechEd in New Orleans (I remember how much fun I had demoing the features at the Microsoft booth during my shifts that seemed to fly by) and signaled an exciting shift in Microsoft's middleware strategy that continues today. Late last year, Microsoft added new caching features and made some branding changes to "<a href="http://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx">AppFabric 1.1 for Windows Server</a>" to align with the the next wave of on-premise capabilities which further extend and build upon the Windows Server platform. Just last week, two new capabilities have shipped in beta which compliment AppFabric on premise: <a href="http://www.microsoft.com/en-us/download/details.aspx?id=30376">Service Bus 1.0 Beta for Windows Server</a> and <a href="http://www.microsoft.com/en-us/download/details.aspx?id=30369">Workflow 1.0 Beta for Windows Server</a>.</p> <p>Hammad and I are fortunate to have both worked very closely with Microsoft during the development of "Dublin", participating in software design reviews and early incubation initiatives. Since its release just over two years ago, we've advised customers of all shapes and sizes and fielded these capabilities in countless projects across various verticals. And herein lies the mission of this book: </p> <blockquote> <p><em><strong>To provide practical, real-world guidance for making the most of the capabilities offered by Windows Server AppFabric and AppFabric 1.1 for Windows Server based on our collective experiences in the field over the last two years since it's release. </strong></em></p> </blockquote> <p>The result (we hope) is not just a book, but a field manual chock-full of practical step-by-step, real-world guidance, tips and techniques that will help you build more maintainable, scalable, reliable, and secure service-oriented applications on the Windows Server Platform today. </p> <p><strong><font size="3">What is Windows Server AppFabric/AppFabric 1.1 for Windows Server?</font></strong></p> <p>Windows Server AppFabric is an extension of the Application Server Role on the Windows Server Platform. In a nutshell, Windows Server AppFabric frees Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Service developers from common infrastructure plumbing by providing a robust, secure, composable, and reliable platform which provides caching, hosting, and monitoring capabilities, including support for long running workflow services, all on the Windows Platform. As such, Windows Server AppFabric is an evolution of the Windows Server platform, providing essential building blocks for first-classing WCF (for code-based services) and WF (for declarative workflow services) that are built using the .NET Framework 4 and Visual Studio 2010. <br />As an extension to IIS and WAS, Windows Server AppFabric relies on IIS's proven capabilities for hosting and lifecycle management, adding additional useful capabilities for working with WCF and WF services. In addition, Windows Server AppFabric takes advantage of Windows Server's robust event tracing mechanism (also known as ETW). ETW provides optimized <br />and high-performing kernel-level instrumentation which greatly minimizes impact on the performance of WCF and WF services hosted in IIS with Windows Server AppFabric.</p> <p>Best of all, this key extension to the Windows Server Platform remains available <a href="http://www.microsoft.com/en-us/download/details.aspx?id=27115">free of charge</a>.</p> <p>Below are some helpful resources if you are interested in learning more:</p> <ul> <li><a href="http://msdn.microsoft.com/en-us/windowsserver/gg675185"><font color="#ffc000">Developer Introduction to Windows Server AppFabric (Part 1): Hosting Services</font></a> </li> <li><a href="http://msdn.microsoft.com/en-us/windowsserver/gg675186"><font color="#ffc000">Developer Introduction to Windows Server AppFabric (Part 2): Caching Services</font></a> </li> <li><a href="http://msdn.microsoft.com/en-us/library/hh351389.aspx"><font color="#ffc000">Product Documentation</font></a> </li> <li><a href="http://go.microsoft.com/fwlink/?LinkID=168906"><font color="#ffc000">Architectural Overview</font></a> </li> <li><a href="http://go.microsoft.com/fwlink/?LinkID=168903"><font color="#ffc000">Tutorials</font></a> </li> <li><a href="http://social.technet.microsoft.com/wiki/contents/articles/windows-server-appfabric-portal.aspx"><font color="#ffc000">AppFabric on the TechNet Wiki</font></a> </li> </ul> <p><strong><font size="3">Is this book for you?</font></strong></p> <p>If you are a developer who wants to avoid the same repetitive tasks when preparing your WCF and/or WF services for deployment, or an IT Pro who wants to avoid complex XML for configuring hosting and monitoring options for the services you manage, you will instantly benefit from Windows Server AppFabric.</p> <p>The book is over 400 pages long and includes over 60 recipes within 9 cohesive chapters:</p> <ul> <li><strong>Chapter 1</strong>, Installing Windows Server AppFabric, covers setting up your development environment to use Windows Server AppFabric. You'll learn how to install hosting, persistence and monitoring capabilities, including provisioning repositories, choosing the appropriate storage options, making changes to configuration after installation, and troubleshooting common (and not so common) installation issues you might encounter along the way. <br /></li> <li><strong>Chapter 2</strong>, Getting Started with AppFabric Caching, introduces Caching in Windows Server AppFabric, covering everything you need to get started with introducing this important capability to your composite applications and services. You will learn how to set up and use Caching using code and configuration options, as well as working with Caching within your applications. In addition, you'll learn how easily an existing application that relies on ASP.NET session state can immediately benefit from Windows Server AppFabric Cache, handling common error conditions, using PowerShell commandlets, and building a custom provider model. <br /></li> <li><strong>Chapter 3</strong>, Windows Server AppFabric Caching – Advanced Use Cases, builds on the concepts in the previous chapter, covering the use of Regions and Tags as well as choosing the right concurrency mode and establishing expiration, eviction, and notification policies. You will also learn advanced monitoring concepts including the use of performance counters, configuring high availability, and common troubleshooting techniques for getting the most out of Windows Server AppFabric Cache. <br /></li> <li><strong>Chapter 4</strong>, Windows Server AppFabric Hosting Fundamentals, introduces Windows Server AppFabric's hosting capabilities, covering common deployment, management, and hosting scenarios. You'll learn how to host WCF SOAP and REST services as well as simple WF services along with a number of tips and tricks for moving beyond the service template defaults. <br /></li> <li><strong>Chapter 5</strong>, More Windows Server AppFabric Hosting Features, covers additional hosting topics, including supporting long-running WF services, how your services can benefit from the Auto-Start feature, properly hosting WCF services that take advantage of Windows Azure Service Bus Relay bindings for enabling modern, hybrid scenarios as well as common PowerShell commandlets for scripting many of the tasks covered in this and the previous chapter. <br /></li> <li><strong>Chapter 6</strong>, Utilizing AppFabric Persistence, provides ample coverage of Windows Server AppFabric persistence capabilities, including configuring persistence for WF services, working with multiple persistence stores, and developing instance store, control, and query providers. This chapter also provides an in-depth walkthrough of development and configuration of custom instance, control, and query providers. <br /></li> <li><strong>Chapter 7</strong>, Monitoring Windows Server AppFabric Deployment, provides an introduction to <br />the monitoring capabilities provided by Windows Server AppFabric. Topics include collecting and viewing events from WCF and WF services, enabling tracing and configuring tracking profiles, and leveraging PowerShell cmdlets for monitoring WCF and WF services as well as the Caching service. In addition, you'll learn how to surface monitoring information to any user experience by following the sample recipe for building a custom monitoring dashboard using ASP.NET MVC and OData. <br /></li> <li><strong>Chapter 8</strong>, Scaling AppFabric Hosting, Monitoring, and Persistence, covers a common scenario for scaling Windows Server AppFabric across multiple IIS hosts. You will learn how to prepare two hosts for clustering using Microsoft NLB as well as understand deployment, management, and administration of a multi-host Windows Server AppFabric deployment that shares a common, centralized persistence store. <br /></li> <li><strong>Chapter 9</strong>, Configuring Windows Server AppFabric Security, covers what you need to know about planning and implementing a security model with Windows Server AppFabric. You will learn how to secure the caching, persistence, monitoring, and eventing (via ETW) subsystems of Windows Server AppFabric. </li> </ul> <p>If you've gotten this far, I sincerely appreciate your interest and hope you’ll consider purchasing our book ;-)</p> <p>The book is available in print and across most digital formats including Kindle, Nook, etc.:</p> <p>Packt is running some specials on the book which you can learn more about here: <a title="http://www.packtpub.com/microsoft-windows-server-appfabric-cookbook/book" href="http://www.packtpub.com/microsoft-windows-server-appfabric-cookbook/book">http://www.packtpub.com/microsoft-windows-server-appfabric-cookbook/book</a></p> <p>The book is also available on <a href="http://www.amazon.com/Microsoft-Windows-Server-AppFabric-Cookbook/dp/1849684189/ref=sr_1_sc_1?ie=UTF8&amp;qid=1343337928&amp;sr=8-1-spell&amp;keywords=windows+server+appfabic+cookbook">Amazon.com</a>, <a href="http://www.amazon.co.uk/Microsoft-Windows-Server-AppFabric-Cookbook/dp/1849684189/ref=sr_1_1?ie=UTF8&amp;qid=1343337985&amp;sr=8-1">Amazon.co.uk</a> and <a href="http://www.barnesandnoble.com/s/windows-server-appfabric-cookbook?store=allproducts&amp;keyword=windows+server+appfabric+cookbook">Barnes and Noble</a> (if the book is not immediately available, I’m told by the publisher that all shipments are en-route so any shipping delays should be minimal).</p> <p>If you purchase the book, I'd love to hear from you. Please <a href="http://rickgaribay.net/contact.aspx">drop me a line</a> or connect with me <a href="http://twitter.com/rickggaribay">@rickggaribay</a> and let me know what you think. </p> <ul></ul> <p>References:</p> <ul> <li><a href="http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&amp;id=15848">Windows Server AppFabric 1.0</a></li> <li><a href="http://www.microsoft.com/en-us/download/details.aspx?id=27115">AppFabric 1.0 for Windows Server</a></li> <li><a href="http://www.microsoft.com/en-us/download/details.aspx?id=30376">Service Bus 1.0 Beta for Windows Server</a></li> <li><a href="http://www.microsoft.com/en-us/download/details.aspx?id=30369">Workflow 1.0 Beta for Windows Server</a></li> <li><a href="http://hammadrajjoub.net/2012/03/03/have-you-booked-your-copy-of-windows-server-appfabric-cookbook-yet/">Hammad Rajjoub’s Blog</a></li> <li><a href="http://blog.adnanmasood.com/2012/01/03/microsoft-windows-server-appfabric-cookbook-available-for-pre-order/">Adnan Masood’s Blog</a></li> <li><a href="http://soa-thoughts.blogspot.com/2012/04/more-cookbooks-microsoft-windows-server.html">Steef-Jan Wiggers’ Blog</a></li> <li><a href="http://jeremiedevillard.wordpress.com/2012/04/07/windows-server-appfabric-and-biztalk-cookbook/">Jeremie Devillad’s Blog</a></li> <li><a href="http://paulsomers.blogspot.com/2012/03/windows-server-appfabric-cookbook.html">Paul Somer’s Blog</a> </li> </ul><img src="http://rickgaribay.net/aggbug/340.aspx" width="1" height="1" /> Rick G. Garibay http://rickgaribay.net/archive/2012/07/26/windows-server-appfabric-cookbook-is-out.aspx Thu, 26 Jul 2012 22:12:56 GMT http://rickgaribay.net/archive/2012/07/26/windows-server-appfabric-cookbook-is-out.aspx#feedback 3 http://rickgaribay.net/comments/commentRss/340.aspx http://rickgaribay.net/services/trackbacks/340.aspx Common Service Bus Queue Operations with the REST API http://rickgaribay.net/archive/2012/01/19/common-service-bus-queue-operations-with-the-rest-api.aspx <p>Azure Service Bus Brokered Messaging provides durable pull-based pub-sub, complimenting it’s older sibling Relay Messaging which uses a push messaging model. While both enable hybrid composition across traditional business, trust and network boundaries, they provide unique capabilities in and of themselves. </p> <p>As with Relay Messaging, Brokered Messaging provides first class support for WCF with the NetMessagingBinding, but expands the developer surface to general .NET and cross-platform/mobility scenarios by offering the .NET Client and REST API respectively.</p> <p>Of the 3 APIs, the .NET Client API is the most robust and seems to be the most documented.</p> <p>The simplicity of the WCF programming model (the illusion that messages are being pushed to your endpoint) is balanced with some restrictions that naturally fall out of the scope of one-way messaging including queue/topic/subscription/rule creation and support for peek lock.</p> <p>In this regard, while not as robust as the .NET Client API, the REST API offers a more comprehensive feature set and when working on solutions that must be interoperable across client platforms or due to other restrictions, the REST API is a great choice.</p> <p>Microsoft has documented the REST API in the <a href="http://msdn.microsoft.com/en-us/library/windowsazure/hh367521.aspx#BKMK_REST5prod" target="_blank">Service Bus REST API Reference</a>, but there are not a ton of imperative examples out there that show WebClient or HttpWebRequest, so the purpose of this post is to share some nitty gritty examples of how to get some of the most common operations done in C#.</p> <p>Please note that my goal is not to be elegant or use the tersest or most fluid syntax possible in this samples, but rather to get some quick and dirty examples out there, well, quickly. </p> <p>As such, the unit tests should be self explanatory, but if you have any questions, please don’t hesitate to ask. </p> <p>Feedback, comments related to the API or WebClient techniques welcome <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://rickgaribay.net/Images/customcontent/Common-Service-Bus-Patterns-with-the-RES_795D/wlEmoticon-smile.png" /></p> <div class="csharpcode"> <pre class="alt"><span class="lnum"> 1: </span><span class="kwrd">using</span> System;</pre> <pre><span class="lnum"> 2: </span><span class="kwrd">using</span> System.Text;</pre> <pre class="alt"><span class="lnum"> 3: </span><span class="kwrd">using</span> System.Collections.Generic;</pre> <pre><span class="lnum"> 4: </span><span class="kwrd">using</span> System.Linq;</pre> <pre class="alt"><span class="lnum"> 5: </span><span class="kwrd">using</span> Microsoft.VisualStudio.TestTools.UnitTesting;</pre> <pre><span class="lnum"> 6: </span><span class="kwrd">using</span> System.Collections.Specialized;</pre> <pre class="alt"><span class="lnum"> 7: </span><span class="kwrd">using</span> System.Net;</pre> <pre><span class="lnum"> 8: </span><span class="kwrd">using</span> System.Runtime.Serialization.Json;</pre> <pre class="alt"><span class="lnum"> 9: </span><span class="kwrd">using</span> System.Runtime.Serialization;</pre> <pre><span class="lnum"> 10: </span><span class="kwrd">using</span> System.IO;</pre> <pre class="alt"><span class="lnum"> 11: </span> </pre> <pre><span class="lnum"> 12: </span><span class="kwrd">namespace</span> RESTAPITests</pre> <pre class="alt"><span class="lnum"> 13: </span>{</pre> <pre><span class="lnum"> 14: </span> [TestClass]</pre> <pre class="alt"><span class="lnum"> 15: </span> <span class="kwrd">public</span> <span class="kwrd">class</span> RESTAPITests</pre> <pre><span class="lnum"> 16: </span> {</pre> <pre class="alt"><span class="lnum"> 17: </span> </pre> <pre><span class="lnum"> 18: </span> <span class="kwrd">static</span> <span class="kwrd">string</span> serviceNamespace = <span class="str">"[NAMESPACE]"</span>;</pre> <pre class="alt"><span class="lnum"> 19: </span> <span class="kwrd">static</span> <span class="kwrd">string</span> issuerName = <span class="str">"owner"</span>;</pre> <pre><span class="lnum"> 20: </span> <span class="kwrd">static</span> <span class="kwrd">string</span> issuerSecret = <span class="str">"[KEY]"</span>;</pre> <pre class="alt"><span class="lnum"> 21: </span> <span class="kwrd">const</span> <span class="kwrd">string</span> sbHostName = <span class="str">"servicebus.windows.net"</span>;</pre> <pre><span class="lnum"> 22: </span> <span class="kwrd">const</span> <span class="kwrd">string</span> acsHostName = <span class="str">"accesscontrol.windows.net"</span>;</pre> <pre class="alt"><span class="lnum"> 23: </span> <span class="kwrd">static</span> <span class="kwrd">string</span> relativeAddress = <span class="str">"[Queue]"</span>;</pre> <pre><span class="lnum"> 24: </span> <span class="kwrd">static</span> <span class="kwrd">string</span> baseAddress;</pre> <pre class="alt"><span class="lnum"> 25: </span> </pre> <pre><span class="lnum"> 26: </span> </pre> <pre class="alt"><span class="lnum"> 27: </span> [TestMethod]</pre> <pre><span class="lnum"> 28: </span> <span class="kwrd">public</span> <span class="kwrd">void</span> SendMessageShouldSucceedWithoutError()</pre> <pre class="alt"><span class="lnum"> 29: </span> {</pre> <pre><span class="lnum"> 30: </span> <span class="kwrd">string</span> body = <span class="str">"foo"</span>;</pre> <pre class="alt"><span class="lnum"> 31: </span> </pre> <pre><span class="lnum"> 32: </span> var token = GetToken(issuerName, issuerSecret);</pre> <pre class="alt"><span class="lnum"> 33: </span> </pre> <pre><span class="lnum"> 34: </span> baseAddress = GetBaseAddress();</pre> <pre class="alt"><span class="lnum"> 35: </span> <span class="kwrd">string</span> fullAddress = baseAddress + relativeAddress + <span class="str">"/messages"</span>;</pre> <pre><span class="lnum"> 36: </span> </pre> <pre class="alt"><span class="lnum"> 37: </span> WebClient webClient = <span class="kwrd">new</span> WebClient();</pre> <pre><span class="lnum"> 38: </span> webClient.Headers[HttpRequestHeader.Authorization] = token;</pre> <pre class="alt"><span class="lnum"> 39: </span> webClient.UploadData(fullAddress, <span class="str">"POST"</span>, Encoding.UTF8.GetBytes(body)); </pre> <pre><span class="lnum"> 40: </span> </pre> <pre class="alt"><span class="lnum"> 41: </span> }</pre> <pre><span class="lnum"> 42: </span> </pre> <pre class="alt"><span class="lnum"> 43: </span> [TestMethod]</pre> <pre><span class="lnum"> 44: </span> <span class="kwrd">public</span> <span class="kwrd">void</span> PeekLockMessageShouldReturnLockId()</pre> <pre class="alt"><span class="lnum"> 45: </span> {</pre> <pre><span class="lnum"> 46: </span> var token = GetToken(issuerName, issuerSecret);</pre> <pre class="alt"><span class="lnum"> 47: </span> </pre> <pre><span class="lnum"> 48: </span> baseAddress = GetBaseAddress();</pre> <pre class="alt"><span class="lnum"> 49: </span> </pre> <pre><span class="lnum"> 50: </span> <span class="rem">// Read and lock the message. Unless released, the lock will expire within the configured lock duration (on the queue)</span></pre> <pre class="alt"><span class="lnum"> 51: </span> <span class="kwrd">string</span> fullAddress = baseAddress + relativeAddress + <span class="str">"/messages/head"</span>;</pre> <pre><span class="lnum"> 52: </span> </pre> <pre class="alt"><span class="lnum"> 53: </span> WebClient webClient = <span class="kwrd">new</span> WebClient();</pre> <pre><span class="lnum"> 54: </span> webClient.Headers[HttpRequestHeader.Authorization] = token;</pre> <pre class="alt"><span class="lnum"> 55: </span> webClient.UploadData(fullAddress, <span class="str">"POST"</span>, <span class="kwrd">new</span> <span class="kwrd">byte</span>[0]{});</pre> <pre><span class="lnum"> 56: </span> </pre> <pre class="alt"><span class="lnum"> 57: </span> var props = webClient.ResponseHeaders[<span class="str">"BrokerProperties"</span>];</pre> <pre><span class="lnum"> 58: </span> </pre> <pre class="alt"><span class="lnum"> 59: </span> <span class="rem">// Deserialize the JSON header to a simple class</span></pre> <pre><span class="lnum"> 60: </span> DataContractJsonSerializer serializer = <span class="kwrd">new</span> DataContractJsonSerializer(<span class="kwrd">typeof</span>(BrokerProperty));</pre> <pre class="alt"><span class="lnum"> 61: </span> <span class="kwrd">using</span> (MemoryStream stream = <span class="kwrd">new</span> MemoryStream(Encoding.Unicode.GetBytes(props)))</pre> <pre><span class="lnum"> 62: </span> {</pre> <pre class="alt"><span class="lnum"> 63: </span> var result = (BrokerProperty)serializer.ReadObject(stream);</pre> <pre><span class="lnum"> 64: </span> </pre> <pre class="alt"><span class="lnum"> 65: </span> Assert.IsNotNull(result.LockToken); </pre> <pre><span class="lnum"> 66: </span> }</pre> <pre class="alt"><span class="lnum"> 67: </span> </pre> <pre><span class="lnum"> 68: </span> }</pre> <pre class="alt"><span class="lnum"> 69: </span> </pre> <pre><span class="lnum"> 70: </span> [TestMethod]</pre> <pre class="alt"><span class="lnum"> 71: </span> <span class="kwrd">public</span> <span class="kwrd">void</span> PeekLockMessageAndAbandonShouldSucceed()</pre> <pre><span class="lnum"> 72: </span> {</pre> <pre class="alt"><span class="lnum"> 73: </span> var token = GetToken(issuerName, issuerSecret);</pre> <pre><span class="lnum"> 74: </span> </pre> <pre class="alt"><span class="lnum"> 75: </span> baseAddress = GetBaseAddress();</pre> <pre><span class="lnum"> 76: </span> </pre> <pre class="alt"><span class="lnum"> 77: </span> <span class="rem">// Read and lock the message. Unless released, the lock will expire within the configured lock duration (on the queue)</span></pre> <pre><span class="lnum"> 78: </span> <span class="kwrd">string</span> fullAddress = baseAddress + relativeAddress + <span class="str">"/messages/head"</span>;</pre> <pre class="alt"><span class="lnum"> 79: </span> </pre> <pre><span class="lnum"> 80: </span> WebClient webClient = <span class="kwrd">new</span> WebClient();</pre> <pre class="alt"><span class="lnum"> 81: </span> webClient.Headers[HttpRequestHeader.Authorization] = token;</pre> <pre><span class="lnum"> 82: </span> webClient.UploadData(fullAddress, <span class="str">"POST"</span>, <span class="kwrd">new</span> <span class="kwrd">byte</span>[0] { });</pre> <pre class="alt"><span class="lnum"> 83: </span> </pre> <pre><span class="lnum"> 84: </span> var props = webClient.ResponseHeaders[<span class="str">"BrokerProperties"</span>];</pre> <pre class="alt"><span class="lnum"> 85: </span> </pre> <pre><span class="lnum"> 86: </span> <span class="rem">// Deserialize the JSON header to a simple class</span></pre> <pre class="alt"><span class="lnum"> 87: </span> DataContractJsonSerializer serializer = <span class="kwrd">new</span> DataContractJsonSerializer(<span class="kwrd">typeof</span>(BrokerProperty));</pre> <pre><span class="lnum"> 88: </span> </pre> <pre class="alt"><span class="lnum"> 89: </span> <span class="kwrd">using</span> (MemoryStream stream = <span class="kwrd">new</span> MemoryStream(Encoding.Unicode.GetBytes(props)))</pre> <pre><span class="lnum"> 90: </span> {</pre> <pre class="alt"><span class="lnum"> 91: </span> var result = (BrokerProperty)serializer.ReadObject(stream);</pre> <pre><span class="lnum"> 92: </span> </pre> <pre class="alt"><span class="lnum"> 93: </span> <span class="rem">// Bail on the message, release the lock so it is available for another consumer</span></pre> <pre><span class="lnum"> 94: </span> fullAddress = baseAddress + relativeAddress + String.Format(<span class="str">"/messages/{0}/{1}"</span>, result.MessageId, result.LockToken);</pre> <pre class="alt"><span class="lnum"> 95: </span> }</pre> <pre><span class="lnum"> 96: </span> </pre> <pre class="alt"><span class="lnum"> 97: </span> webClient = <span class="kwrd">new</span> WebClient();</pre> <pre><span class="lnum"> 98: </span> webClient.Headers[HttpRequestHeader.Authorization] = token;</pre> <pre class="alt"><span class="lnum"> 99: </span> webClient.UploadData(fullAddress, <span class="str">"PUT"</span>, <span class="kwrd">new</span> <span class="kwrd">byte</span>[0] { });</pre> <pre><span class="lnum"> 100: </span> </pre> <pre class="alt"><span class="lnum"> 101: </span> }</pre> <pre><span class="lnum"> 102: </span> </pre> <pre class="alt"><span class="lnum"> 103: </span> [TestMethod]</pre> <pre><span class="lnum"> 104: </span> <span class="kwrd">public</span> <span class="kwrd">void</span> PeekLockMessageAndCompleteShouldSucceed()</pre> <pre class="alt"><span class="lnum"> 105: </span> {</pre> <pre><span class="lnum"> 106: </span> var token = GetToken(issuerName, issuerSecret);</pre> <pre class="alt"><span class="lnum"> 107: </span> </pre> <pre><span class="lnum"> 108: </span> baseAddress = GetBaseAddress();</pre> <pre class="alt"><span class="lnum"> 109: </span> </pre> <pre><span class="lnum"> 110: </span> <span class="rem">// Peek lock the message</span></pre> <pre class="alt"><span class="lnum"> 111: </span> <span class="kwrd">string</span> fullAddress = baseAddress + relativeAddress + <span class="str">"/messages/head"</span>;</pre> <pre><span class="lnum"> 112: </span> </pre> <pre class="alt"><span class="lnum"> 113: </span> WebClient webClient = <span class="kwrd">new</span> WebClient();</pre> <pre><span class="lnum"> 114: </span> webClient.Headers[HttpRequestHeader.Authorization] = token;</pre> <pre class="alt"><span class="lnum"> 115: </span> webClient.UploadData(fullAddress, <span class="str">"POST"</span>, <span class="kwrd">new</span> <span class="kwrd">byte</span>[0] { });</pre> <pre><span class="lnum"> 116: </span> </pre> <pre class="alt"><span class="lnum"> 117: </span> var props = webClient.ResponseHeaders[<span class="str">"BrokerProperties"</span>];</pre> <pre><span class="lnum"> 118: </span> </pre> <pre class="alt"><span class="lnum"> 119: </span> DataContractJsonSerializer serializer = <span class="kwrd">new</span> DataContractJsonSerializer(<span class="kwrd">typeof</span>(BrokerProperty));</pre> <pre><span class="lnum"> 120: </span> </pre> <pre class="alt"><span class="lnum"> 121: </span> <span class="kwrd">using</span> (MemoryStream stream = <span class="kwrd">new</span> MemoryStream(Encoding.Unicode.GetBytes(props)))</pre> <pre><span class="lnum"> 122: </span> {</pre> <pre class="alt"><span class="lnum"> 123: </span> var result = (BrokerProperty)serializer.ReadObject(stream);</pre> <pre><span class="lnum"> 124: </span> </pre> <pre class="alt"><span class="lnum"> 125: </span> <span class="rem">// Complete the read operation, releasing the lock and deleting the message from the queue</span></pre> <pre><span class="lnum"> 126: </span> fullAddress = baseAddress + relativeAddress + String.Format(<span class="str">"/messages/{0}/{1}"</span>, result.MessageId, result.LockToken);</pre> <pre class="alt"><span class="lnum"> 127: </span> }</pre> <pre><span class="lnum"> 128: </span> webClient = <span class="kwrd">new</span> WebClient();</pre> <pre class="alt"><span class="lnum"> 129: </span> webClient.Headers[HttpRequestHeader.Authorization] = token;</pre> <pre><span class="lnum"> 130: </span> webClient.UploadData(fullAddress, <span class="str">"DELETE"</span>, <span class="kwrd">new</span> <span class="kwrd">byte</span>[0] { });</pre> <pre class="alt"><span class="lnum"> 131: </span> }</pre> <pre><span class="lnum"> 132: </span> </pre> <pre class="alt"><span class="lnum"> 133: </span> [TestMethod]</pre> <pre><span class="lnum"> 134: </span> <span class="kwrd">public</span> <span class="kwrd">void</span> DecodeJsonToTypeShouldAllowEasyExtractionOfProps()</pre> <pre class="alt"><span class="lnum"> 135: </span> {</pre> <pre><span class="lnum"> 136: </span> </pre> <pre class="alt"><p><span class="lnum"> 137: </span> <span class="kwrd">string</span> payload = <span class="str">@"{"</span><span class="str">"DeliveryCount"</span><span class="str">":3,"</span><span class="str">"LockToken"</span><span class="str">":"</span><span class="str">"4a1d4c96-9837-42a9-ad91-3ecf704eec40"</span><span class="str">","</span><span class="str">"LockedUntilUtc"</span><span class="str">":"</span><span class="str">"Thu, 19 Jan 2012 01:22:44 GMT"</span><span class="str">",</span></p><p><span class="str"> </span><span class="str">"</span><span class="str">"MessageId"</span><span class="str">":"</span><span class="str">"4a4fa2c7d87a40a7b799625b9de69e42"</span><span class="str">","</span><span class="str">"SequenceNumber"</span><span class="str">":2,"</span><span class="str">"TimeToLive"</span><span class="str">":922337203685}"</span>;</p></pre> <pre><span class="lnum"> 138: </span> </pre> <pre class="alt"><span class="lnum"> 139: </span> DataContractJsonSerializer serializer = <span class="kwrd">new</span> DataContractJsonSerializer(<span class="kwrd">typeof</span>(BrokerProperty));</pre> <pre><span class="lnum"> 140: </span> </pre> <pre class="alt"><span class="lnum"> 141: </span> <span class="kwrd">using</span> (MemoryStream stream = <span class="kwrd">new</span> MemoryStream(Encoding.Unicode.GetBytes(payload)))</pre> <pre><span class="lnum"> 142: </span> {</pre> <pre class="alt"><span class="lnum"> 143: </span> var result = (BrokerProperty)serializer.ReadObject(stream);</pre> <pre><span class="lnum"> 144: </span> </pre> <pre class="alt"><span class="lnum"> 145: </span> Assert.IsNotNull(result.MessageId);</pre> <pre><span class="lnum"> 146: </span> }</pre> <pre class="alt"><span class="lnum"> 147: </span> </pre> <pre><span class="lnum"> 148: </span> }</pre> <pre class="alt"><span class="lnum"> 149: </span> </pre> <pre><span class="lnum"> 150: </span> [DataContract]</pre> <pre class="alt"><span class="lnum"> 151: </span> <span class="kwrd">public</span> <span class="kwrd">class</span> BrokerProperty</pre> <pre><span class="lnum"> 152: </span> {</pre> <pre class="alt"><span class="lnum"> 153: </span> [DataMember]</pre> <pre><span class="lnum"> 154: </span> <span class="kwrd">public</span> <span class="kwrd">string</span> DeliveryCount { get; set; }</pre> <pre class="alt"><span class="lnum"> 155: </span> [DataMember]</pre> <pre><span class="lnum"> 156: </span> <span class="kwrd">public</span> <span class="kwrd">string</span> LockToken { get; set; }</pre> <pre class="alt"><span class="lnum"> 157: </span> [DataMember]</pre> <pre><span class="lnum"> 158: </span> <span class="kwrd">public</span> <span class="kwrd">string</span> LockedUntilUtc { get; set; }</pre> <pre class="alt"><span class="lnum"> 159: </span> [DataMember]</pre> <pre><span class="lnum"> 160: </span> <span class="kwrd">public</span> <span class="kwrd">string</span> MessageId { get; set; }</pre> <pre class="alt"><span class="lnum"> 161: </span> [DataMember]</pre> <pre><span class="lnum"> 162: </span> <span class="kwrd">public</span> <span class="kwrd">string</span> SequenceNumber { get; set; }</pre> <pre class="alt"><span class="lnum"> 163: </span> [DataMember]</pre> <pre><span class="lnum"> 164: </span> <span class="kwrd">public</span> <span class="kwrd">string</span> TimeToLive { get; set; }</pre> <pre class="alt"><span class="lnum"> 165: </span> }</pre> <pre><span class="lnum"> 166: </span> </pre> <pre class="alt"><span class="lnum"> 167: </span> </pre> <pre><span class="lnum"> 168: </span> <span class="rem">// Helper</span></pre> <pre class="alt"><span class="lnum"> 169: </span> <span class="kwrd">private</span> <span class="kwrd">static</span> <span class="kwrd">string</span> GetBaseAddress()</pre> <pre><span class="lnum"> 170: </span> {</pre> <pre class="alt"><span class="lnum"> 171: </span> <span class="kwrd">return</span> baseAddress = <span class="str">"https://"</span> + serviceNamespace + <span class="str">"."</span> + sbHostName + <span class="str">"/"</span>;</pre> <pre><span class="lnum"> 172: </span> }</pre> <pre class="alt"><span class="lnum"> 173: </span> </pre> <pre><span class="lnum"> 174: </span> <span class="rem">// Helper, warmly borrowed from Service Bus Management Sample :-)</span></pre> <pre class="alt"><span class="lnum"> 175: </span> <span class="kwrd">private</span> <span class="kwrd">static</span> <span class="kwrd">string</span> GetToken(<span class="kwrd">string</span> issuerName, <span class="kwrd">string</span> issuerSecret)</pre> <pre><span class="lnum"> 176: </span> {</pre> <pre class="alt"><span class="lnum"> 177: </span> var acsEndpoint = <span class="str">"https://"</span> + serviceNamespace + <span class="str">"-sb."</span> + acsHostName + <span class="str">"/WRAPv0.9/"</span>;</pre> <pre><span class="lnum"> 178: </span> </pre> <pre class="alt"><span class="lnum"> 179: </span> <span class="rem">// Note that the realm used when requesting a token uses the HTTP scheme, even though</span></pre> <pre><span class="lnum"> 180: </span> <span class="rem">// calls to the service are always issued over HTTPS</span></pre> <pre class="alt"><span class="lnum"> 181: </span> var realm = <span class="str">"http://"</span> + serviceNamespace + <span class="str">"."</span> + sbHostName + <span class="str">"/"</span>;</pre> <pre><span class="lnum"> 182: </span> </pre> <pre class="alt"><span class="lnum"> 183: </span> NameValueCollection values = <span class="kwrd">new</span> NameValueCollection();</pre> <pre><span class="lnum"> 184: </span> values.Add(<span class="str">"wrap_name"</span>, issuerName);</pre> <pre class="alt"><span class="lnum"> 185: </span> values.Add(<span class="str">"wrap_password"</span>, issuerSecret);</pre> <pre><span class="lnum"> 186: </span> values.Add(<span class="str">"wrap_scope"</span>, realm);</pre> <pre class="alt"><span class="lnum"> 187: </span> </pre> <pre><span class="lnum"> 188: </span> WebClient webClient = <span class="kwrd">new</span> WebClient();</pre> <pre class="alt"><span class="lnum"> 189: </span> <span class="kwrd">byte</span>[] response = webClient.UploadValues(acsEndpoint, values);</pre> <pre><span class="lnum"> 190: </span> </pre> <pre class="alt"><span class="lnum"> 191: </span> <span class="kwrd">string</span> responseString = Encoding.UTF8.GetString(response);</pre> <pre><span class="lnum"> 192: </span> </pre> <pre class="alt"><span class="lnum"> 193: </span> var responseProperties = responseString.Split(<span class="str">'&amp;'</span>);</pre> <pre><span class="lnum"> 194: </span> var tokenProperty = responseProperties[0].Split(<span class="str">'='</span>);</pre> <pre class="alt"><span class="lnum"> 195: </span> var token = Uri.UnescapeDataString(tokenProperty[1]);</pre> <pre><span class="lnum"> 196: </span> </pre> <pre class="alt"><span class="lnum"> 197: </span> <span class="kwrd">return</span> <span class="str">"WRAP access_token=\""</span> + token + <span class="str">"\""</span>;</pre> <pre><span class="lnum"> 198: </span> }</pre> <pre class="alt"><span class="lnum"> 199: </span> </pre> <pre><span class="lnum"> 200: </span> }</pre> <pre class="alt"><span class="lnum"> 201: </span> </pre> <pre><span class="lnum"> 202: </span>}</pre> </div> <style type="text/css"><![CDATA[ .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }]]></style><img src="http://rickgaribay.net/aggbug/326.aspx" width="1" height="1" /> Rick G. Garibay http://rickgaribay.net/archive/2012/01/19/common-service-bus-queue-operations-with-the-rest-api.aspx Thu, 19 Jan 2012 16:23:08 GMT http://rickgaribay.net/archive/2012/01/19/common-service-bus-queue-operations-with-the-rest-api.aspx#feedback http://rickgaribay.net/comments/commentRss/326.aspx http://rickgaribay.net/services/trackbacks/326.aspx NuCon 2012&ndash;Feb 16th, Irvine, CA http://rickgaribay.net/archive/2012/01/16/nucon-2012ndashfeb-16th-irvine-ca.aspx <p>I’d like to pass on some details regarding an event I will be speaking on in Irvine, CA on February 16th.</p> <p><a href="http://www.neudesic.com/nucon/" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top: 0px; border-right: 0px; padding-top: 0px" title="NU_logo" border="0" alt="NU_logo" align="left" src="http://rickgaribay.net/Images/customcontent/Announcing-NuCon-2012_A361/NU_logo.png" width="158" height="105" /></a>NuCon is a one day conference put on by my employer, <a href="http://neudesic.com" target="_blank">Neudesic</a> that features talks and content from fellow Neudesic colleagues like <a href="https://twitter.com/#!/davidpallmann" target="_blank">David Pallmann</a>, <a href="https://twitter.com/#!/tedneward" target="_blank">Ted Neward</a> and <a href="https://twitter.com/#!/simonguest" target="_blank">Simon Guest</a>, <a href="http://www.neudesic.com/nucon/speakers.html" target="_blank">just to name a few</a>. <a href="http://www.neudesic.com/nucon/" target="_blank"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://rickgaribay.net/Images/customcontent/Announcing-NuCon-2012_A361/image.png" width="485" height="1043" /></a></p> <p>As Irvine is Neudesic’s headquarters, the event provides a great opportunity to gain insight into the future of technology as seen by my fellow colleagues as well as providing pragmatic guidance that you can put to use the following day while networking with other Neudesic customers,  executive management, partners and thought leaders to help guide your strategy on making the most of the tremendous opportunities that the Microsoft platform and Neudesic products have to offer.</p> <p>In my talk, <a href="http://www.neudesic.com/nucon/schedule.html" target="_blank">Hybrid Composition on the Microsoft Application Integration platform</a>, I’ll share how organizations of all shapes and sizes can benefit from the improvement, automation and streamlining of their business operations through hybrid composition.</p> <p><strong><em>Abstract</em></strong> <a href="http://rickgaribay.net/Images/customcontent/Announcing-NuCon-2012_A361/image_3.png"><img style="background-image: none; border-right-width: 0px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://rickgaribay.net/Images/customcontent/Announcing-NuCon-2012_A361/image_thumb.png" width="207" height="344" /></a></p> <p>In today’s technology landscape, exposing key functional areas as traditional services or other means has become the norm for achieving agility and is a requirement for taking advantage of the dramatic improvements that modern middleware capabilities both on-premise and in the cloud provide. </p> <p>As organizations adapt to this new hybrid model, a shift from a homogenous, single product, big iron approach to heterogeneous, best in class, capability-driven model is necessary for realizing the benefits of service-orientation and enabling the composition of these services on-premise, in the cloud and behind the firewall without making big spending commitments on a product that may only meet some of these needs.</p> <p>The Microsoft platform offers a number of capabilities for achieving these goals across common Hosting, Workflow, Rules, EAI and Messaging workloads that allow you to choose the right capabilities for delivering your intended business outcomes.</p> <p>BizTalk Server 2010 and Windows Server AppFabric 1.1 provide a comprehensive middleware platform for developing, deploying, and managing composite enterprise capabilities on-premise and Windows Azure Service Bus and Access Control Service allow you to extend your investments beyond traditional trust and network boundaries making the cloud and other partner/vendor endpoints merely an extension of your enterprise. </p> <p>Come learn how Windows Server AppFabric, WCF, WF Services, BizTalk Server and Windows Azure can benefit your approach to building and supporting application services at enterprise scale while transcending traditional trust boundaries and enabling the hybrid enterprise.</p> <p><em></em></p> <p><em></em></p> <p><em></em></p> <p><em></em></p> <p><em></em></p> <p><em></em></p> <p><em></em></p> <p><em></em></p> <p><em></em></p> <p><em></em></p> <p><em>To give you an idea of the breadth and depth of the sessions, in my talk, I’ll be talking about and showing live demos of the latest capabilities that enable you to build hybrid composite solutions to drive differentiation and innovation within your organization:</em></p> <p><strong>Windows Server AppFabric 1.1 Caching (On-Prem) Featuring:</strong></p> <ul> <li>AppFabric distributed caching including implementing the Cache-Aside caching pattern and Read-Through caching, new in AppFabric 1.1  </li> </ul> <p><strong>WF 4 Workflow Services (On-Prem) Featuring:</strong></p> <ul> <li>State Machine Activity, new in .NET 4.1 and .NET 4.5  </li> <li>AppFabric Connect BizTalk Mapper for WF 4 in AppFabric Connect </li> <li>Long-running workflows </li> <li>Workflow Correlation </li> <li>Composition with WCF services in Windows Azure <br /></li> </ul> <p><strong>Windows Server AppFabric Deployment (On-Prem) Featuring:</strong></p> <ul> <li>Easy deployment with Microsoft Web Deploy </li> <li>Windows Server AppFabric Configuration Experience </li> </ul> <p><strong>WCF hosting in Windows Azure Web Roles (Cloud) Featuring:</strong></p> <ul> <li>Azure Web Role hosting </li> <li>Azure Service Bus Topic client </li> </ul> <p><strong>Azure Service Bus Brokered Messaging (Hybrid) Featuring:</strong></p> <ul> <li>Brokered messaging from Azure to on-premise custom applications behind the firewall </li> <li>Topics and Subscriptions </li> </ul> <p><strong>BizTalk Server 2010 Orchestration &amp; Messaging (On-Prem) Featuring:</strong></p> <ul> <li>Custom WCF Adapter for consuming messages off an Azure Service Bus Topic </li> <li>Support for custom WCF behaviors </li> <li>Support for hybrid ERP integration such as Dynamics CRM or SAP </li> </ul> <p>So, if you are interested in attending, please consider yourself invited! Click on the links in the invitation below to register (save $100 if you register before Feb 1) and I look forward to seeing you at NuCon 12!</p><img src="http://rickgaribay.net/aggbug/325.aspx" width="1" height="1" /> Rick G. Garibay http://rickgaribay.net/archive/2012/01/16/nucon-2012ndashfeb-16th-irvine-ca.aspx Mon, 16 Jan 2012 19:44:34 GMT http://rickgaribay.net/archive/2012/01/16/nucon-2012ndashfeb-16th-irvine-ca.aspx#feedback http://rickgaribay.net/comments/commentRss/325.aspx http://rickgaribay.net/services/trackbacks/325.aspx Azure Service Bus Connect EAI and EDI &ldquo;Integration Services&rdquo; CTP http://rickgaribay.net/archive/2011/12/16/azure-service-bus-connect-eai-and-edi-ldquointegration-servicesrdquo-ctp.aspx <p>I am thrilled to share in the <a href="http://blogs.msdn.com/b/windowsazure/archive/2011/12/16/announcing-the-service-bus-eai-amp-edi-labs-release.aspx" target="_blank">announcement</a> that the first public CTP of Azure Service Bus Integration Services<strong> is now LIVE</strong> at <a href="http://portal.appfabriclabs.com">http://portal.appfabriclabs.com</a>. </p> <p>The focus of this release is to enable you to build hybrid composite solutions that span on-premise investments such as Microsoft SQL Server, Oracle Database, SAP, Siebel eBusiness Applications, Oracle E-Business Suite, allowing you to compose these mission critical systems with applications, assets and workloads that you have deployed to Windows Azure, enabling first-class hybrid integration across traditional network and trust boundaries. </p> <p>In a web to web world, many of the frictions addressed in these capabilities still exist, albeit to a smaller degree. The reality is that as the web and cloud computing continue to gain momentum, investments on-premise are, and will continue to be critical to realizing the full spectrum of benefits that cloud computing provides both in the short and long term. </p> <p>So, what’s in this CTP?</p> <p><a href="http://msdn.microsoft.com/en-us/library/windowsazure/hh689889.aspx" target="_blank">Azure Service Bus Connect</a> provides a new server explorer experience for LOB integration exposing a management head that can be accessed on-prem via Server Explorer or PowerShell to create, update, delete or retrieve information from LOB targets. This provides a robust extension of the Azure Service Bus relay endpoint concept, which acts a LOB conduit (LobTarget, LobRelay) for bridging these assets by extending the WCF LOB Adapters that ship with BizTalk Server 2010. The beauty of this approach is that you can leverage the LOB Adapters using BizTalk as a host, or, for a lighter weight way approach, use IIS/Windows Server AppFabric to compose business operations on-premise and beyond. </p> <p>In addition, support for messaging between trading partners across traditional trust boundaries in business-to-business (B2B) scenarios using is EDI is also provided in this preview, including AS2 protocol support with X12 chaining for send and receive pipelines, FTP as transport for X12, agreement templates, partners view with profiles per partner, resources view, and an intuitive, metro style <a href="http://i.msdn.microsoft.com/dynimg/IC553343.gif">EDI Portal<img style="display: inline; float: right" title="Transforms Project Design Surface" alt="Transforms Project Design Surface" align="right" src="http://i.msdn.microsoft.com/dynimg/IC553343.gif" width="240" height="165" /></a>.</p> <p>Just as with on-premise integration, friction always exists when integrating different assets which may exist on different platforms, implement different standards and at a minimum have different representations of common entities that are part of your composite solution’s domain. What is needed is a mediation broker that can be leveraged at internet-scale, and apply message and protocol transformations across disparate parties and this is exactly what the <a href="http://msdn.microsoft.com/en-us/library/windowsazure/hh689905.aspx" target="_blank">Transforms</a> capability provides. Taking an approach that will be immediately familiar to the BizTalk developer, a familiar mapper-like experience is provided within Visual Studio for interactively mapping message elements and applying additional processing logic via operations (functoids).</p> <p>In addition, <a href="http://msdn.microsoft.com/en-us/library/windowsazure/hh689768.aspx" target="_blank">XML Bridges</a> which include the XML One-Way Bridge and XML Request-Reply Bridge are an extension to the Azure Service Bus which supports critical patterns such as protocol bridging, routing actions, external data lookup for message enrichment and support for both WS-I and REST endpoints and any combination thereof.</p> <p>As shown below in the MSDN documentation, “bridges are composed of stages and activities where each stage is a message processing unit in itself. Each stage of a bridge is atomic, which means either a message completes a stage or not. A stage can be turned <em>on</em> or <em>off</em>, indicating whether to process a message or simply let it <em>pass through”</em>.</p> <p><img style="margin: 0px 10px 0px 0px; display: inline; float: left" title="Stages of a bridge" alt="Stages of a bridge" align="left" src="http://i.msdn.microsoft.com/dynimg/IC551928.gif" /></p> <p>Taking a familiar VETR approach to validate, extract, transform and route messages from one party to another, along with the ability to enrich messages by composing other endpoint in-flight (supported protocols include HTTP, WS-HTTP and Basic HTTP, HTTP Relay Endpoint, Service Bus Queues/Topics and any other XML bridge) the Bridge is a very important capability and brings very robust capabilities for extending Azure Service Bus as a key messaging broker across integration disciplines. </p> <p>In reality, these patterns have no more to do with EAI than with traditional, contemporary service composition and become necessary once you move from a point-to-point approach and need to elegantly manage integration and composition across assets. As such, this capability acts as a bridge to Azure Service Bus that is very powerful in and of itself, even in non-EAI/EDI scenarios where endpoints can be virtualized increasing decoupling between parties (clients/services). In addition, this capability further enriches what is possible when using the BrokeredMessage property construct as a potential poor-man’s routing mechanism. <br /></p> <p>In closing, the need to address the impedance mismatch that exists between disparate applications that must communicate with each other is a friction that will continue to exist for many years to come, and while traditionally, many of these problems have been solved by expensive, big iron middleware servers, this is changing. </p> <p>As with most technologies, often new possibilities are unlocked that are residual side-effects of something bigger, and this is certainly the case with how both <a href="http://www.code-magazine.com/Article.aspx?quickid=1112041" target="_blank">innovative</a> <a href="http://www.code-magazine.com/Article.aspx?quickid=1112041" target="_blank">and strategic Azure Service Bus is to Microsoft’s PaaS strategy</a>. Azure Service Bus continues to serve as a great example of a welcomed shift to a lightweight capability-based, platform-oriented approach to solving tough distributed messaging/integration problems while honoring the existing investments that organizations have made and benefiting from a common platform approach which is extremely unique in the market. And while this shift will take some time, in the long-run enterprises of all shapes and sizes only stand to benefit.</p> <p>To get started, download the SDK &amp; samples from <a href="http://go.microsoft.com/fwlink/?LinkID=184288">http://go.microsoft.com/fwlink/?LinkID=184288</a> and the tutorial &amp; documentation from <a href="http://go.microsoft.com/fwlink/?LinkID=235197">http://go.microsoft.com/fwlink/?LinkID=235197</a> and watch this and the <a href="http://blogs.msdn.com/b/windowsazure/" target="_blank">Windows Azure</a> blog for more details coming soon.</p> <p>Happy Messaging!</p><img src="http://rickgaribay.net/aggbug/324.aspx" width="1" height="1" /> Rick G. Garibay http://rickgaribay.net/archive/2011/12/16/azure-service-bus-connect-eai-and-edi-ldquointegration-servicesrdquo-ctp.aspx Fri, 16 Dec 2011 18:46:51 GMT http://rickgaribay.net/archive/2011/12/16/azure-service-bus-connect-eai-and-edi-ldquointegration-servicesrdquo-ctp.aspx#feedback 2 http://rickgaribay.net/comments/commentRss/324.aspx http://rickgaribay.net/services/trackbacks/324.aspx DCC 2011.2 Lap Around Azure Service Bus: The Goods http://rickgaribay.net/archive/2011/11/05/dcc-2011.2-lap-around-azure-service-bus-the-goods.aspx <p>Thanks to all that came out to my “<a href="http://nov2011.desertcodecamp.com/session/430" target="_blank">Lap Around Azure Service Bus Brokered Messaging</a>” talk at Desert Code Camp today. </p> <p>We covered a ton of content including things a few folks didn’t know about relay messaging capabilities in Azure Service Bus and demonstrated how simple it is to expose a REST or SOAP endpoint from behind the firewall. I also demonstrated the brand new load balancing capabilities that were just released last week. </p> <p>From there, we dove deep into the .NET API to walk through how to provision queues and topics from code and start messaging within minutes by simply grabbing the Azure Service Bus NuGet package and writing a few lines of code.<iframe height="327" src="http://r.office.microsoft.com/r/rlidPowerPointEmbed?p1=1&amp;p2=1&amp;p3=SDDF930EE6F91132FD!422&amp;p4=&amp;kip=1" frameborder="0" width="402" scrolling="no" align="right"></iframe></p> <p>Next, we explored the REST API, and how simple it is for any HTTP client, regardless of platform to take advantage of the robust messaging capabilities that Azure Service Bus queues and topics have to offer.</p> <p>Last but not least, we wrapped up with a quick walkthrough of the NeMessagingBinding and how simple it is to send and receive messages over a queue using the familiar WCF programming model.</p> <p>I hope that each of you will unlock new possibilities with the power that these hybrid messaging capabilities have to offer. </p> <p>I’d also like to thank <a href="http://www.pluralsight-training.net/microsoft/" target="_blank">Pluralsight</a> for sponsoring my session. The <a href="http://twitter.com/#!/search/realtime/%23dcc11%20%23Azure%20%23ServiceBus%20%23Q1" target="_blank">quiz is now up</a> for the first 5 smartest attendees. </p> <p>Search for hashtags <a href="http://twitter.com/#!/search/realtime/%23dcc11%20%23Azure%20%23ServiceBus%20%23Q2" target="_blank">#dcc11 #Azure #ServiceBus #Q1 to #Q5.</a></p> <p>Good Luck! </p> <p> </p> <table border="0" cellspacing="0" cellpadding="2" width="229"><tbody> <tr> <td valign="middle" width="91"><strong>Code Demos</strong></td> <td valign="middle" width="136"><iframe style="padding-bottom: 0px; background-color: #fcfcfc; padding-left: 0px; width: 98px; padding-right: 0px; height: 115px; padding-top: 0px" title="Preview" marginheight="0" src="https://skydrive.live.com/embedicon.aspx/Public/Talks/DCC%202011.2?cid=df930ee6f91132fd&amp;sc=documents" frameborder="0" marginwidth="0" scrolling="no" align="right"></iframe></td> </tr> </tbody></table> <p> </p> <p>Happy Messaging!</p><img src="http://rickgaribay.net/aggbug/323.aspx" width="1" height="1" /> Rick G. Garibay http://rickgaribay.net/archive/2011/11/05/dcc-2011.2-lap-around-azure-service-bus-the-goods.aspx Sat, 05 Nov 2011 21:33:25 GMT http://rickgaribay.net/archive/2011/11/05/dcc-2011.2-lap-around-azure-service-bus-the-goods.aspx#feedback http://rickgaribay.net/comments/commentRss/323.aspx http://rickgaribay.net/services/trackbacks/323.aspx