當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。