Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

Event-Driven Architecture in the Clouds with Windows Azure

, , 5 Feb 2010
To demonstrate Azure and EDA, this article will show you how to build a flight delay management system for all US airports in clouds with Windows Azure.
FlightUpdatesManager.zip
FlightUpdates.Entities
bin
Debug
FlightUpdates.Entities.csproj.user
Properties
FlightUpdates.MessageProcessor
bin
Debug
FlightUpdates.MessageProcessor.ccproj
FlightUpdates.MessageProcessor.ccproj.user
ServiceConfiguration.cscfg
ServiceDefinition.csdef
FlightUpdates.MessageProcessorService
bin
Debug
Properties
Resource Files
FlightUpdates.Service
bin
Debug
FlightUpdates.Service.csproj.user
Properties
Service References
FlightUpdates.Service.Contracts
bin
Debug
FlightUpdates.Service.Contracts.csproj.user
Properties
FlightUpdates.TraceData
Properties
FlightUpdates.TwitterMonitor
bin
Debug
FlightUpdates.MessageGenerator.ccproj
FlightUpdates.MessageGenerator.ccproj.user
ServiceConfiguration.cscfg
ServiceDefinition.csdef
FlightUpdates.TwitterMonitorService
bin
Debug
Properties
Resource Files
FlightUpdates.Utility
bin
Debug
Constants
FlightUpdates.Utility.csproj.user
Properties
FlightUpdates.WebAzure
bin
Debug
FlightUpdates.AzureWeb.ccproj
FlightUpdates.AzureWeb.ccproj.user
ServiceConfiguration.cscfg
ServiceDefinition.csdef
External Library
Microsoft.Maps.MapControl.Common.dll
Microsoft.Maps.MapControl.dll
Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.EnterpriseLibrary.Data.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll
Microsoft.Practices.ObjectBuilder2.dll
Microsoft.Practices.Unity.dll
TwitterooCore.dll
FlightsUpdate.SilverlightWeb
Bin
Debug
Release
Components
FlightsUpdate.SilverlightWeb.csproj.user
Properties
Service References
AirportDelayService
AirportCodeService1.wsdl
AirportMapDelay1.disco
AirportMapDelays.AirportDelayService.AirportInfo.datasource
AirportMapDelays.AirportDelayService.FlightDelayFeed.datasource
configuration.svcinfo
configuration91.svcinfo
Reference.svcmap
ServiceReferences.ClientConfig
FlightsUpdate.Web
AirportMapDelay.svc
AirportMapDelays.Web.csproj.user
App_Data
bin
ClientBin
AirportMapDelays.xap
FlightsUpdate.Web.csproj.user
Properties
Scripts
FlightUpdates.AzureHost
bin
Debug
FlightUpdates.AzureHost.ccproj
FlightUpdates.AzureHost.ccproj.user
ServiceConfiguration.cscfg
ServiceDefinition.csdef
FlightUpdates.Business
bin
Debug
FlightUpdates.Business.csproj.user
Properties
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;
using Microsoft.WindowsAzure.ServiceRuntime;
using Microsoft.WindowsAzure.Diagnostics;
using FlightUpdates.Utility.Constants;
namespace FlightUpdates.Utility
{
    /// <summary>
    ///  Manages CloudStorageAccounts used in the flightupdates soultion
    /// </summary>
    public static class CloudStorageUtil
    {
        /// <summary>
        /// Returns CloudStorageAccount for the flight update queue
        /// </summary>
        /// <returns>CloudStorageAccount->FlightUpdatesQueue </returns>
        public static CloudStorageAccount GetFlightUpdatesQueue()
        {
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
            {
                // Provide the configSetter with the initial value
                configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));

                RoleEnvironment.Changed += (sender, arg) =>
                {
                    if (arg.Changes.OfType<RoleEnvironmentConfigurationSettingChange>()
                        .Any((change) => (change.ConfigurationSettingName == configName)))
                    {
                        // The corresponding configuration setting has changed, propagate the value
                        if (!configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)))
                        {
                            // In this case, the change to the storage account credentials in the
                            // service configuration is significant enough that the role needs to be
                            // recycled in order to use the latest settings. (for example, the 
                            // endpoint has changed)
                            RoleEnvironment.RequestRecycle();
                        }
                    }
                };
            });

            return (CloudStorageAccount.FromConfigurationSetting(CloudQueues.FlightDelayMessages));

        }

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Authors

John Mokkosian-Kane
Other
United States United States
No Biography provided

Daniel Hsu
Software Developer
United States United States
No Biography provided

| Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 5 Feb 2010
Article Copyright 2010 by John Mokkosian-Kane, Daniel Hsu
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid