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


C# CloudQueue.CreateIfNotExistsAsync方法代码示例

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


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

示例1: Initialize

 private async Task Initialize()
 {
     // Create the queues if they don't exist
     _queue = _cloudQueueClient.GetQueueReference(UploadConfig.NotificationQueueName);
     _poisonQueue = _cloudQueueClient.GetQueueReference(PoisionQueueName);
     await Task.WhenAll(_queue.CreateIfNotExistsAsync(), _poisonQueue.CreateIfNotExistsAsync()).ConfigureAwait(false);
     _initialized = true;
 }
开发者ID:rustyrazorblade,项目名称:killrvideo-csharp,代码行数:8,代码来源:EncodingListenerJob.cs

示例2: AzureQueueExt

        public AzureQueueExt(string conectionString, string queueName, IQueueMessageSerializer serializer = null)
        {
            queueName = queueName.ToLower();
            var storageAccount = CloudStorageAccount.Parse(conectionString);
            var queueClient = storageAccount.CreateCloudQueueClient();

            _queue = queueClient.GetQueueReference(queueName);
            _queue.CreateIfNotExistsAsync().Wait();
            _serializer = serializer ?? new DefaultQueueSerializer();
        }
开发者ID:Arkadiy94,项目名称:CommonLibraries,代码行数:10,代码来源:AzureQueueExt.cs

示例3: InitAsync

        /// <summary>
        /// Initialize the connection to Azure Storage.
        /// If initReader is set to true, a timer will start that polls the queue every readerPollInterval, or by default 250ms.
        /// </summary>
        public async Task InitAsync(bool initReader = false, TimeSpan? readerPollInterval = null) {
            CloudStorageAccount sta = CloudStorageAccount.Parse(connectionString);
            var queueClient = sta.CreateCloudQueueClient();
            queue = queueClient.GetQueueReference(queueName);

            await queue.CreateIfNotExistsAsync();

            if (initReader) {
                await StartReaderAsync(readerPollInterval);
            }
        }
开发者ID:torgeirhansen,项目名称:SimpleWeatherStation,代码行数:15,代码来源:AzureConnector.cs

示例4: AzureQueueProvider

 public AzureQueueProvider(string indexName)
 {
     var account = AzureConnectionHelper.CloudStorageAccount;
     if (account != null)
     {
         var queueClient = account.CreateCloudQueueClient();
         Queue = queueClient.GetQueueReference(indexName);
         var t = Queue.CreateIfNotExistsAsync();
         t.Wait();
     }
 }
开发者ID:sadiqna,项目名称:TicketDesk,代码行数:11,代码来源:AzureQueueProvider.cs

示例5: AddMessageAndCreateIfNotExistsAsync

        private static async Task AddMessageAndCreateIfNotExistsAsync(CloudQueue queue, CloudQueueMessage message, CancellationToken cancellationToken)
        {
            if (queue == null)
            {
                throw new ArgumentNullException("queue");
            }

            bool isQueueNotFoundException = false;
            try
            {
                await queue.AddMessageAsync(message, cancellationToken);
                return;
            }
            catch (StorageException exception)
            {
                if (!exception.IsNotFoundQueueNotFound())
                {
                    throw;
                }

                isQueueNotFoundException = true;
            }

            Debug.Assert(isQueueNotFoundException);
            await queue.CreateIfNotExistsAsync(cancellationToken);
            await queue.AddMessageAsync(message, cancellationToken);
        }
开发者ID:Bjakes1950,项目名称:azure-webjobs-sdk,代码行数:27,代码来源:QueueProcessor.cs


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