当前位置: 首页>>代码示例>>C#>>正文


C# CloudStorageAccount.CreateCloudQueueClient方法代码示例

本文整理汇总了C#中Microsoft.WindowsAzure.CloudStorageAccount.CreateCloudQueueClient方法的典型用法代码示例。如果您正苦于以下问题:C# CloudStorageAccount.CreateCloudQueueClient方法的具体用法?C# CloudStorageAccount.CreateCloudQueueClient怎么用?C# CloudStorageAccount.CreateCloudQueueClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.WindowsAzure.CloudStorageAccount的用法示例。


在下文中一共展示了CloudStorageAccount.CreateCloudQueueClient方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnStart

        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 100;

            //Initialize Indexer
            storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("CrawlerStorage"));

            //Initialize URL Queue
            urlQueueClient = storageAccount.CreateCloudQueueClient();
            urlQueue = urlQueueClient.GetQueueReference("urlqueue");
            if (urlQueue.CreateIfNotExist())
            {
                //Add first URL to the queue
                CloudQueueMessage firstURL = new CloudQueueMessage(startURL);
                urlQueue.AddMessage(firstURL);
            }

            //Initialize Index Queue
            indexQueueClient = storageAccount.CreateCloudQueueClient();
            indexQueue = indexQueueClient.GetQueueReference("indexqueue");
            indexQueue.CreateIfNotExist();

            //Initialize Database Blob
            databaseClient = storageAccount.CreateCloudBlobClient();
            databaseContainer = databaseClient.GetContainerReference("wordfrequencies");
            databaseContainer.CreateIfNotExist();
            var permission = databaseContainer.GetPermissions();
            permission.PublicAccess = BlobContainerPublicAccessType.Container;
            databaseContainer.SetPermissions(permission);

            return base.OnStart();
        }
开发者ID:nicolas3470,项目名称:Distributed-Web-Crawler,代码行数:33,代码来源:WorkerRole.cs

示例2: QueueHelper

        // Constructor - get settings from a hosted service configuration or .NET configuration file.
        public QueueHelper(string configurationSettingName, bool hostedService)
        {
            if (hostedService)
            {
                CloudStorageAccount.SetConfigurationSettingPublisher(
                    (configName, configSettingPublisher) =>
                    {
                        var connectionString = RoleEnvironment.GetConfigurationSettingValue(configName);
                        configSettingPublisher(connectionString);
                    }
                );
            }
            else
            {
                CloudStorageAccount.SetConfigurationSettingPublisher(
                    (configName, configSettingPublisher) =>
                    {
                        var connectionString = ConfigurationManager.ConnectionStrings[configName].ConnectionString;
                        configSettingPublisher(connectionString);
                    }
                );
            }

            Account = CloudStorageAccount.FromConfigurationSetting(configurationSettingName);

            QueueClient = Account.CreateCloudQueueClient();
            QueueClient.RetryPolicy = RetryPolicies.Retry(4, TimeSpan.Zero);
        }
开发者ID:nanovazquez,项目名称:azure-query-sample,代码行数:29,代码来源:QueueHelper.cs

示例3: QueueHelper

 // Constructor - get settings from a hosted service configuration
 /// <summary>
 /// Initializes a new instance of the <see cref="QueueHelper"/> class.
 /// </summary>
 /// <param name="configurationSettingName">Name of the configuration setting.</param>
 /// <remarks></remarks>
 public QueueHelper(string configurationSettingName)
 {
     var connectString = CloudConfigurationManager.GetSetting(configurationSettingName);
     _storageAccount = CloudStorageAccount.Parse(connectString);
     _queueClient = _storageAccount.CreateCloudQueueClient();
     _queueClient.RetryPolicy = RetryPolicies.Retry(4, TimeSpan.FromSeconds(1));
 }
开发者ID:dineshsharmain,项目名称:eZeeFlow,代码行数:13,代码来源:QueueHelper.cs

示例4: OnStart

        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 12;
            #if DEBUG
            account = CloudStorageAccount.DevelopmentStorageAccount;
            #else
            account = new CloudStorageAccount(accountAndKey, true);
            #endif

            tableContext = new TableServiceContext(account.TableEndpoint.ToString(), account.Credentials);

            //client = new CloudQueueClient(account.BlobEndpoint.ToString(), account.Credentials);
            qclient = account.CreateCloudQueueClient();
            q = qclient.GetQueueReference("icd9mapplotrequests");
            rows = new List<ICD9MapPlotResultEntry>();
            bclient = account.CreateCloudBlobClient();
            container = bclient.GetContainerReference("results");
            container.CreateIfNotExist();
            client = account.CreateCloudTableClient();
            client.CreateTableIfNotExist("ICD9MapPlotResult");
            client.CreateTableIfNotExist("DoctorDetails");
            client.CreateTableIfNotExist("PatientDetails");
            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

            return base.OnStart();
        }
开发者ID:cloudscrubs,项目名称:azureprototype,代码行数:28,代码来源:WorkerRole.cs

示例5: InitializeCloudStorage

        public static void InitializeCloudStorage(CloudStorageAccount account)
        {
            CloudTableClient cloudTableClient = account.CreateCloudTableClient();
            CloudQueueClient cloudQueueClient = account.CreateCloudQueueClient();

            CreateUserPrivilegeTable(cloudTableClient);
        }
开发者ID:kirpasingh,项目名称:MicrosoftAzureTrainingKit,代码行数:7,代码来源:CloudStorageInitializer.cs

示例6: ProcessingQueue

        public ProcessingQueue()
        {
            _formatter = new BinaryFormatter();

            storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
            queueClient = storageAccount.CreateCloudQueueClient();
            queue = queueClient.GetQueueReference(TableName);
            queue.CreateIfNotExist();
        }
开发者ID:mchambers,项目名称:howmuchto-service,代码行数:9,代码来源:ProcessingQueue.cs

示例7: ProcessingQueue

        public ProcessingQueue()
        {
            _formatter = new BinaryFormatter();

            storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
            queueClient = storageAccount.CreateCloudQueueClient();
            queue = queueClient.GetQueueReference(TableName);
            queue.CreateIfNotExist();
        }
开发者ID:mchambers,项目名称:Daremeto,代码行数:9,代码来源:ProcessingQueue.cs

示例8: SingleDeliveryQueueClient

        public SingleDeliveryQueueClient(CloudStorageAccount account, string queueName)
        {
            var queueClient = account.CreateCloudQueueClient();
            queue = queueClient.GetQueueReference(queueName);
            queue.CreateIfNotExist();

            tableClient = account.CreateCloudTableClient();
            tableClient.CreateTableIfNotExist(TableName);
        }
开发者ID:Amichai,项目名称:Prax,代码行数:9,代码来源:SingleDeliveryQueueClient.cs

示例9: Initialize

        public static void Initialize(string account, string key)
        {
            Uri blobUri = new Uri(string.Format("http://{0}.blob.core.windows.net", account));
            Uri queueUri = new Uri(string.Format("http://{0}.queue.core.windows.net", account));
            Uri tableUri = new Uri(string.Format("http://{0}.table.core.windows.net", account));

            s_credentials = new StorageCredentialsAccountAndKey(account, key);
            s_storageAccount = new CloudStorageAccount(s_credentials, blobUri, queueUri, tableUri);

            s_blobClient = s_storageAccount.CreateCloudBlobClient();
            s_tableClient = s_storageAccount.CreateCloudTableClient();
            s_queueClient = s_storageAccount.CreateCloudQueueClient();
        }
开发者ID:nagyistoce,项目名称:azurestorageexplorer,代码行数:13,代码来源:Client.cs

示例10: AzureQueueProvider

        public AzureQueueProvider()
        {
            //var accountAndKey = new StorageCredentialsAccountAndKey("cloudmorph", "Q7Vco66yV3hncM/piawqSHyiXZZ8meZdRMAMElOorgE/EHv4t8B18Nn7zUF/7nLu6WSMaZzmjaUo4LUHlWCfyw==");
            //var _storageAccount = new CloudStorageAccount(accountAndKey, true);

            // Retrieve storage account from connection-string
            //_storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
            //_storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=http;AccountName=bmaigorcloudmorphstorage;AccountKey=Q7Vco66yV3hncM/piawqSHyiXZZ8meZdRMAMElOorgE/EHv4t8B18Nn7zUF/7nLu6WSMaZzmjaUo4LUHlWCfyw==");
            _storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));

            // Create the queue client
            _client = _storageAccount.CreateCloudQueueClient();
        }
开发者ID:CloudMorph,项目名称:CloudMorph,代码行数:13,代码来源:AzureQueueProvider.cs

示例11: AzureMessageQueue

        public AzureMessageQueue(CloudStorageAccount cloudStorageAccount, string inputQueueName, string errorQueueName)
        {
            if (inputQueueName == null) throw new ArgumentNullException("inputQueueName");
            if (errorQueueName == null) throw new ArgumentNullException("errorQueueName");

            inputQueueName = inputQueueName.ToLowerInvariant();
            errorQueueName = errorQueueName.ToLowerInvariant();

            cloudQueueClient = cloudStorageAccount.CreateCloudQueueClient();

            inputQueue = cloudQueueClient.GetQueueReference(inputQueueName);
            inputQueue.CreateIfNotExist();

            cloudQueueClient.GetQueueReference(errorQueueName).CreateIfNotExist();

            this.inputQueueName = inputQueueName;
            this.errorQueueName = errorQueueName;
        }
开发者ID:nls75,项目名称:Rebus,代码行数:18,代码来源:AzureMessageQueue.cs

示例12: InitializeAzureStorage

        /// <summary>
        /// 
        /// </summary>
        /// <param name="storageAccountName"></param>
        private void InitializeAzureStorage(AzureStorageOptions options)
        {
            Debug.Assert(null != options);

            // TODO: put in the logic to appropriately load configuration
            bool useRoleEnvironment = false;
            string storageConnectionStringValue = null;

            if (useRoleEnvironment)
            {
                storageConnectionStringValue = RoleEnvironment.GetConfigurationSettingValue(options.StorageAccountName);
            }
            else
            {
                storageConnectionStringValue = ConfigurationManager.ConnectionStrings[options.StorageAccountName].ConnectionString;
            }

            Debug.Assert(null != storageConnectionStringValue);

            Account = CloudStorageAccount.Parse(storageConnectionStringValue);

            // This will not work unless run in the DevFabric or in Azure
            // Trace.WriteLine("Azure account credentials:" + Account.Credentials.ToString(), "Information");

            TableClient = Account.CreateCloudTableClient();
            TableClient.RetryPolicy = RetryPolicies.Retry(4, TimeSpan.Zero);
            TableServiceContext = TableClient.GetDataServiceContext();

            BlobClient = Account.CreateCloudBlobClient();
            BlobClient.RetryPolicy = RetryPolicies.Retry(4, TimeSpan.Zero);

            QueueClient = Account.CreateCloudQueueClient();
            QueueClient.RetryPolicy = RetryPolicies.Retry(4, TimeSpan.Zero);

        }
开发者ID:pravse,项目名称:Azure-.NET-Helpers,代码行数:39,代码来源:AzureHelper.cs

示例13: AzureDocumentExecutor

 public AzureDocumentExecutor(CloudStorageAccount account)
 {
     var client = account.CreateCloudQueueClient();
     queue = client.GetQueueReference("documents");
     queue.CreateIfNotExist();
 }
开发者ID:Amichai,项目名称:Prax,代码行数:6,代码来源:AzureDocumentExecutor.cs

示例14: InitializeStorageResources

        private static void InitializeStorageResources(CloudStorageAccount storageAccount)
        {
            var blobStorage = storageAccount.CreateCloudBlobClient();
            LogWorker.LogBlobContainer = blobStorage.GetContainerReference("logitems");
            CommandWorker.CommandBlobContainer = blobStorage.GetContainerReference("commands");

            var queueStorage = storageAccount.CreateCloudQueueClient();
            LogWorker.LogQueue = queueStorage.GetQueueReference("logmessages");
            CommandWorker.CommandQueue = queueStorage.GetQueueReference("commandmessages");

            bool isStorageFinalized = false;
            while (!isStorageFinalized)
            {
                try
                {
                    LogWorker.LogBlobContainer.CreateIfNotExist();
                    LogWorker.LogQueue.CreateIfNotExist();
                    CommandWorker.CommandBlobContainer.CreateIfNotExist();
                    CommandWorker.CommandQueue.CreateIfNotExist();

                    isStorageFinalized = true;
                }
                catch (StorageClientException sce)
                {
                    if (sce.ErrorCode == StorageErrorCode.TransportError)
                    {
                        Trace.TraceError("Storage services initialization failure.  " +
                            "Check your storage account configuration settings.  " +
                            "If running locally, ensure that the Development Storage service is running.  " +
                            "Message: '{0}'", sce.Message);
                    }
                    else
                    {
                        throw sce;
                    }
                }
            }
        }
开发者ID:DavidHoerster,项目名称:BuzzyGo,代码行数:38,代码来源:QueueMonitor.cs

示例15: QueueUtilities

 public QueueUtilities(string connectionString)
 {
     _account = CloudStorageAccount.Parse(connectionString);
     _client = _account.CreateCloudQueueClient();
 }
开发者ID:sandrapatfer,项目名称:PROMPT11-10-CloudComputing.sandrapatfer,代码行数:5,代码来源:QueueUtilities.cs


注:本文中的Microsoft.WindowsAzure.CloudStorageAccount.CreateCloudQueueClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。