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


C# CloudQueue.CreateIfNotExists方法代码示例

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


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

示例1: OnStart

        public override bool OnStart()
        {
            ServicePointManager.DefaultConnectionLimit = Environment.ProcessorCount;

            // Read storage account configuration settings
            ConfigureDiagnostics();
            Trace.TraceInformation("Initializing storage account in worker role B");
            var storageAccount = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));

            // Initialize queue storage
            Trace.TraceInformation("Creating queue client.");
            CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
            sendEmailQueue = queueClient.GetQueueReference("azuremailqueue");
            subscribeQueue = queueClient.GetQueueReference("azuremailsubscribequeue");

            // Initialize blob storage
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
            blobContainer = blobClient.GetContainerReference("azuremailblobcontainer");

            // Initialize table storage
            var tableClient = storageAccount.CreateCloudTableClient();
            mailingListTable = tableClient.GetTableReference("mailinglist");
            messageTable = tableClient.GetTableReference("message");
            messagearchiveTable = tableClient.GetTableReference("messagearchive");

            Trace.TraceInformation("WorkerB: Creating blob container, queue, tables, if they don't exist.");
            blobContainer.CreateIfNotExists();
            sendEmailQueue.CreateIfNotExists();
            subscribeQueue.CreateIfNotExists();
            this.messageTable.CreateIfNotExists();
            this.mailingListTable.CreateIfNotExists();
            this.messagearchiveTable.CreateIfNotExists();

            return base.OnStart();
        }
开发者ID:phongha,项目名称:myprojects,代码行数:35,代码来源:WorkerRoleB.cs

示例2: OnStart

        public override bool OnStart()
        {
            ServicePointManager.DefaultConnectionLimit = Environment.ProcessorCount;

            ConfigureDiagnostics();

            // Read storage account configuration settings
            Trace.TraceInformation("Initializing storage account in WorkerC");
            var storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue(
                "StorageConnectionString"
                ));

            // Initialize queue storage
            Trace.TraceInformation("Creating queue client in WorkerC");
            var queueClient = storageAccount.CreateCloudQueueClient();
            subscribeQueue = queueClient.GetQueueReference("subscribequeue");

            // Initialize table storage
            Trace.TraceInformation("Creating table client in WorkerC");
            var tableClient = storageAccount.CreateCloudTableClient();
            subscribersTable = tableClient.GetTableReference("Subscribers");

            Trace.TraceInformation("WorkerC: Creating blob container, queue, tables, if they don't exist.");
            subscribeQueue.CreateIfNotExists();
            subscribersTable.CreateIfNotExists();

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

示例3: InitQueue

 private void InitQueue()
 {
     CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
     CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
     queue = queueClient.GetQueueReference("jobqueue");
     queue.CreateIfNotExists();
 }
开发者ID:aaronhoffman,项目名称:azure-101,代码行数:7,代码来源:QueueJobController.cs

示例4: Setup

        public void Setup()
        {
            client = CloudStorageAccount.DevelopmentStorageAccount.CreateCloudQueueClient();
            client.ServerTimeout = TimeSpan.FromSeconds(10);
            nativeQueue = client.GetQueueReference(QueueName);

            nativeQueue.CreateIfNotExists();
            nativeQueue.Clear();

            sender = new AzureMessageQueueSender
                        {
                            Client = client,
                            MessageSerializer = new JsonMessageSerializer(new MessageMapper())
                        };

            sender.Init(QueueName, true);

            receiver = new AzureMessageQueueReceiver
            {
                Client = client,
                MessageSerializer = new JsonMessageSerializer(new MessageMapper()),
            };

            receiver.Init(QueueName, true);
        }
开发者ID:afyles,项目名称:NServiceBus,代码行数:25,代码来源:AzureQueueFixture.cs

示例5: Crawler

        public Crawler()
        {
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
            table = tableClient.GetTableReference("crawlertable");
            table.CreateIfNotExists();
            datatable = tableClient.GetTableReference("datatable");
            datatable.CreateIfNotExists();

            CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
            urlQueue = queueClient.GetQueueReference("urlqueue");
            urlQueue.CreateIfNotExists();
            adminQueue = queueClient.GetQueueReference("adminqueue");
            adminQueue.CreateIfNotExists();

            alreadyVisitedUrls = new HashSet<String>();
            disallowedUrls = new HashSet<String>();
            errorUrls = new HashSet<String>();

            tableSize = 0;
            totalUrls = 0;
            counter = 1;

            compareDate = DateTime.ParseExact("2015-04-01", "yyyy-MM-dd", CultureInfo.InvariantCulture);

            //Regex to check for valid html document
            rgx = new Regex(@"^[a-zA-Z0-9\-]+.?(htm|html)?$");
        }
开发者ID:kinderst,项目名称:Web-Service-Like-Google,代码行数:28,代码来源:Crawler.cs

示例6: OnStart

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

            // Read database connection string and open database.
            var dbConnString = CloudConfigurationManager.GetSetting("TCWAdminPortalDbConnectionString");
            _dbContext = new TCWAdminContext(dbConnString);

            // Open storage account using credentials from .cscfg file.
            var storageAccount = CloudStorageAccount.Parse
                (RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));

            Trace.TraceInformation("Creating images blob container");
            var blobClient = storageAccount.CreateCloudBlobClient();
            _imagesBlobContainer = blobClient.GetContainerReference("images");
            if (_imagesBlobContainer.CreateIfNotExists())
            {
                // Enable public access on the newly created "images" container.
                _imagesBlobContainer.SetPermissions(
                    new BlobContainerPermissions
                    {
                        PublicAccess = BlobContainerPublicAccessType.Blob
                    });
            }

            Trace.TraceInformation("Creating images queue");
            CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
            _imagesQueue = queueClient.GetQueueReference("images");
            _imagesQueue.CreateIfNotExists();

            Trace.TraceInformation("Storage initialized");
            return base.OnStart();
        }
开发者ID:jcflore3,项目名称:TCWAdminPortal,代码行数:34,代码来源:WorkerRole.cs

示例7: QueueHelper

        public QueueHelper(string storageAccountConnectionString)
            : base(storageAccountConnectionString)
        {

            queueClient = base.StorageAccount.CreateCloudQueueClient();
            subscribeQueue = queueClient.GetQueueReference(ConfigurationManager.AppSettings["QueueAzuremailsubscribequeue"]);
            subscribeQueue.CreateIfNotExists();            
        }
开发者ID:prashanthganathe,项目名称:PersonalProjects,代码行数:8,代码来源:QueueHelper.cs

示例8: QueueMessageSource

		public QueueMessageSource()
		{
			var account = MakeAccount();

			queue = MakeQueue(account);

			queue.CreateIfNotExists();    
		}
开发者ID:random-username,项目名称:WindowsAzure.Unity.Demo,代码行数:8,代码来源:QueueMessageSource.cs

示例9: AzureQueue

        public AzureQueue()
        {
            var cloudStorageAccount =
                CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting(Azure.StorageConnectionString));
            var cloudQueueClient= cloudStorageAccount.CreateCloudQueueClient();

            _cloudQueue= cloudQueueClient.GetQueueReference(CloudConfigurationManager.GetSetting(Azure.QueueName));
            _cloudQueue.CreateIfNotExists();
        }
开发者ID:robertogg,项目名称:roreader,代码行数:9,代码来源:AzureQueue.cs

示例10: QueueHelper

 public QueueHelper(string connection, string queueName)
 {
     var account = CloudStorageAccount.Parse(connection);
     var retry = new LinearRetry(TimeSpan.FromSeconds(1), 3);
     queueClient = account.CreateCloudQueueClient();
     queueClient.RetryPolicy = retry;
     queue = queueClient.GetQueueReference(queueName);
     queue.CreateIfNotExists();
 }
开发者ID:udaybhaskar578,项目名称:OpenTok-ServiceKit-DotNet,代码行数:9,代码来源:QueueHelper.cs

示例11: QueueStorageContext

        static QueueStorageContext()
        {
            CloudStorageAccount account = CloudStorageAccount.Parse(
                           System.Configuration.ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);
            CloudQueueClient queueClient = account.CreateCloudQueueClient();

            queue = queueClient.GetQueueReference(DetectionQueueName);
            queue.CreateIfNotExists();
        }
开发者ID:robzenn92,项目名称:pewpew,代码行数:9,代码来源:QueueStorageContext.cs

示例12: QueueInit

        private static void QueueInit()
        {
            const string queueName = "performance-demo";
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["AzureStorageConnectionString"]);

            var cloudQueueClient = storageAccount.CreateCloudQueueClient();
            _Queue = cloudQueueClient.GetQueueReference(queueName);
            _Queue.CreateIfNotExists();

            _Watch = Stopwatch.StartNew();
        }
开发者ID:c0ns0le,项目名称:scripts-4,代码行数:11,代码来源:Program.cs

示例13: QueueStorageAsync

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="queueName">The name of the queue to be managed</param>
		/// <param name="storageConnectionString">The connection string pointing to the storage account (this can be local or hosted in Windows Azure</param>
		public QueueStorageAsync(string queueName, string storageConnectionString)
		{
			Validate.QueueName(queueName, "queueName");
			Validate.String(storageConnectionString, "storageConnectionString");

			var cloudStorageAccount = CloudStorageAccount.Parse(storageConnectionString);

			var cloudQueueClient = cloudStorageAccount.CreateCloudQueueClient();
			cloudQueue = cloudQueueClient.GetQueueReference(queueName);
			cloudQueue.CreateIfNotExists();
		}
开发者ID:VijitJain,项目名称:Azure.Storage,代码行数:16,代码来源:QueueStorageAsync.cs

示例14: PickCreator

        public PickCreator()
        {
            _storageAccount = CloudStorageAccount.Parse(
            CloudConfigurationManager.GetSetting("StorageConnectionString"));

            _queueClient = _storageAccount.CreateCloudQueueClient();

            _queue = _queueClient.GetQueueReference("scaleoutsamplequeue");

            _queue.CreateIfNotExists();
        }
开发者ID:ekepes,项目名称:DemoCode,代码行数:11,代码来源:PickCreator.cs

示例15: AzureQueueExt

        public AzureQueueExt(string conectionString, string queueName, params Type[] types)
        {
            queueName = queueName.ToLower();
            var storageAccount = CloudStorageAccount.Parse(conectionString);
            var queueClient = storageAccount.CreateCloudQueueClient();

            _queue = queueClient.GetQueueReference(queueName);
            _queue.CreateIfNotExists();

            RegisterTypes(types);
        }
开发者ID:amigin,项目名称:Lykee,代码行数:11,代码来源:AzureQueueExt.cs


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