Building Distributed Cloud Apps With Azure WebSites, WebJobs And Azure Service Bus Topic

In my previous blog post, Building Distributed Cloud Apps With Azure Cloud Services And Azure Service Bus Topic, I have introduced a reference Azure app for developing multi-tiered distributed apps using Azure Cloud services and Azure Service Bus Topic. In that app, we have used two Azure worker roles for running a background processing system and a Notification Hub. This app is same like the previous one, the only difference here is that we are replacing two Azure worker roles with two WebJobs and running in a Azure  WebSite. In the previous system, we have used a one Azure web role and two Azure worker roles for an ordr processing demo app. Here we replace these three systems with one WebSite, which is also working as the host for two WebJobs. In short, we replace the worker role with WebJobs. The extra functionality which we have added in this version is the distributed caching with Azure Redis cache.

The project repository is available here: https://github.com/AccelNA/azure-guidance and the source code of this drop is available here: https://github.com/AccelNA/azure-guidance/tree/master/WebSite  

Here is the infomration about the sample app:

Technologies:

  • Azure Web Sites
  • Azure WebJobs
  • Azure Service Bus Topic
  • Azure Notification Hub
  • Azure DocumentDB
  • Azure Redis Cache

Solution Architecture

alt tag

Problem Domain

  1. Order processing app in a distributed computing environment.
  2. Application logic should be deployed into multiple components.
  3. An order request from customer, should notify to multiple systems – including order processing system and a Notification Hub.
  4. Cross platform mobile apps should be able to receive real-time push notifications from Cloud powered systems.
  5. A RESTful API for working as backend for mobile apps.
  6. Cost effectiveness is important for this system.

Solution Workflow

  1. End user submits an order through a web app, which is hosted in Azure Web Site. The Web Site is also hosting two WebJobs: a WebJob for performing order processing logic and another WebJob for sending real-time mobile push notifications.
  2. The Azure Web Site publishes a message into Azure Service Bus Topic for the subscribers of the distributed systems environment.
  3. A WebJob running in a Azure Web Site subscribes the message from Azure Service Bus Topic , and then process the order and finally persist the data into a NoSQL Database – Azure DocumentDB.
  4. A notification hub running in a WebJobs, subscribes the message from Azure Service Bus Topic, and then send cross platform, real-time push notifications to mobile apps running in Android, iOS and Windows Phone.
  5. The web app hosted in Azure Web Site shows the status of orders which is processed in the WebJob which performs order processing logic.
  6. Mobile apps are consuming REST API hosted in Azure web site.

Azure Services

  1. Web Site– Used for running web app for receiving orders from customers. The Web Site is also hosting two WebJobs.
  2. WebJob - WebJob - Background worker for receiving messages from Service Bus Topic and then processing the orders.
  3. WebJob - Background worker for receiving messages from Service Bus Topic and then sends real-time push notifications to 2. cross platform mobile apps.
  4. Service Bus – Working as a message broker
  5. Notification Hub – Sending cross platform push notifications.
  6. DocumentDB – NoSQL data store.
  7. Web Site – Used for running RESTful API.
  8. Redis Cache - Distributed caching.

2 Comments

  • Thanks for sharing.. I downloaded the source from GitHub. When trying to build the solution, i am getting Unable to find the package "Microsoft.Data.Services.Client" error from NuGet. And some more error from Nuget for packages.

    Could you tell how to resolve this. I tried to restore the packages but no luck.

    I am using VS 2013 Pro with Azure SDK installed. What are the prerequisites to run this app? & how to resolve the package error?.

  • @Jaganathan - A Visual Studio build should work on the missing Nuget packages.

Add a Comment

As it will appear on the website

Not displayed

Your website