On Friday we released the an update to the Windows Azure Toolkit for Windows 8 Consumer Preview. This version of the toolkit adds a Service Bus sample, Raw Notification sample and Diagnostics to the WnsRecipe NuGet. You can download the self-extracting package on Codeplex from here.
If you are building Windows 8 Metro Style applications with Windows Azure and have not yet downloaded the toolkit I would encourage you to do so. Why?, as a quick demonstration the following video shows how you can use the toolkit to build a Windows 8 Metro Style application that uses Windows Azure and the Windows Push Notification Service (WNS) to send Toast, Tile and Badge notifications to your Windows 8 Consumer Preview apps in under 4 minutes.
Automated Install – Scripted install of all dependencies including Visual Studio 2010 Express and the Windows Azure SDK on Windows 8 Consumer Preview.
Project Templates – Client project templates for Windows 8 Metro Style apps in Dev 11 for both XAML/C# and HTML5/JS with a supporting server-side Windows Azure Project for Visual Studio 2010.
NuGet Packages – Throughout the development of the project templates we have extracted the functionality into NuGet Packages for example the WNSRecipe NuGet provides a simple managed API for authenticating against WNS, constructing notification payloads and posting the notification to WNS. This reduces the effort to send a Toast, Tile, Badge or Raw notification to about three lines of code. You can find a full list of the other packages created support Push Notifications and the sample ACS scenarios here and full source in the toolkit under /Libraries.
Samples – Five sample applications demonstrating different ways Windows 8 Metro Style apps can use Push Notifications, ACS and Service Bus
Documentation – Extensive documentation including install, file new project walkthrough, samples and deployment to Windows Azure.
If you would like to learn more about the Windows Push Notification Service and the Windows Azure Toolkit for Windows 8 check out the following videos.
Building Metro Style apps that use Windows Azure Service Bus
I wanted to showcase a Sample application we recently distributed in the Windows Azure Toolkit for Windows 8. I will post a more detailed code based blog in the near future but for now I wanted to share with you how to get up and running with the Sample application. Special thanks to Will Perry and the Windows Azure Service Bus team for putting the sample together.
The Windows Azure Service Bus Sample browser application demonstrates how to send and receive messages from a Windows 8 Metro style application via Windows Azure Service Bus Queues, Topics and Subscriptions.
Windows Azure Service Bus Messaging provides cloud-based, message-oriented-middleware technologies including a full featured Message Queue with support for arbitrary content types, rich message properties, correlation, reliable binary transfer, and grouping. Service Bus Topics provide a set of new publish-and-subscribe capabilities and are based on the same backend infrastructure as Service Bus Queues. A Topic consists of a sequential message store just like a Queue, but allows for many concurrent and durable Subscriptions that can independently yield copies of the published messages to consumers. Each Subscription can define a set of rules with simple expressions that specify which messages from the published sequence are selected into the Subscription.
This sample consists of a sample library that creates an easy to use abstraction on top of the Windows Azure Service Bus REST APIs and a sample to demonstrate the usage of the Windows Azure Service Bus from a Windows 8 metro style using this sample library.
Important: Setting up the Windows Azure Service Bus Sample
Before running the application, you must first configure a Service Bus namespace and then configure the sample application to use this namespace. You can do this as follows.
Navigate to the Windows Azure portal. You will be prompted for your Windows Live ID credentials if you are not already signed in.
Click Service Bus, Access Control & Caching link in the left pane, and then select the Service Bus item under the Serviceselement.
Add a Service Namespace. A service namespace provides an application boundary for each application exposed through the Service Bus and is used to construct Service Bus endpoints for the application. To add a service namespace, click the New button on the upper ribbon bar.
On the left list, check all the available services. Enter a namefor your service Namespace, select a Region for your service to run in, choose the Subscription and a Cache Size aclick Create Namespace. Make sure to validate the availability of the name first. Service names must be globally unique as they are hosted in the cloud and accessible by whomever you decide to grant access. Record the Value of your ServiceNamespace as you will later use this to configure the sample application.
Once the namespace is active, click its name in the list of available namespaces to display the Service Namespace information page.
In the Properties right pane, locate the Service Bus section and click the Default Key Viewbutton. Record the value shown for Default Issuer a Default Key, and click OK. You will need these values later when configuring your Web Role settings. Now that you have your Service Namespace, Default Issuer and Default Key you are ready toconfigure the application.
Open Visual Studio 11.
Open the Microsoft.Samples.ServiceBus.Metro.sln solution located in the Samples\ServiceBusfolder.
Open App.xaml.cs, in the Microsoft.Samples.ServiceBus.SampleBrowser project and set the valuesfor the Service Namespace, Default Issuer and Default Key where indicated in the following image.
Make sure that the start-up project of the solution is the Metro style app project. To set the startup Project right-click on the Microsoft.Samples.ServiceBus.SampleBrowser projectin Solution Explorer and select Set as StartUp Project.
Press F5to run the application.
Select one of the three options and follow the steps within the application to learn about using Service Bus from within a Windows 8 metro app. The following options are available:
Simple Queues: Explore the basic functionality of a Service Bus Queue, including Create, Delete, Send and Receive operations. Please notice that Queue names must not contain spaces.
Simple Topics: Explore the basic functionality of a Service Bus Topic including Create, Subscribe, Send and Delete.
Peek Lock: Explore alternate receive semantics you can use when reading messages from Service Bus.
If you would like to learn more please see this video on channel 9:
If you are building an app related to any of the content above or if you are presenting this content at a user group or other event I would love to hear about it! Please reach out to me on twitter @cloudnick
Nick Harris is a Senior Technical Evangelist at Microsoft specializing in Windows Azure. Before Microsoft, he founded his own startup AdGAC a mobile advertising company developed utilizing Windows Azure, WP7 and ASP.NET MVC. In the 9 years prior, Nick worked as both a consultant and Senior Software Engineer delivering smart client applications, distributed enterprise applications and airborne software systems. While not working you can find him blogging or on Twitter about Windows Azure along with a diverse range of related technical content.