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


C# Queue.CloudQueueClient类代码示例

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


CloudQueueClient类属于Microsoft.WindowsAzure.Storage.Queue命名空间,在下文中一共展示了CloudQueueClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        public static void Run(string connectionString, bool disableLogging)
        {
            _connectionString = connectionString;
            _storageAccount = CloudStorageAccount.Parse(connectionString);
            _queueClient = _storageAccount.CreateCloudQueueClient();

            try
            {
                TimeSpan azureSDKTime = RunAzureSDKTest();
                TimeSpan webJobsSDKTime = RunWebJobsSDKTest(disableLogging);

                // Convert to ulong because the measurment block does not support other data type
                ulong perfRatio = (ulong)((webJobsSDKTime.TotalMilliseconds / azureSDKTime.TotalMilliseconds) * 100);

                Console.WriteLine("--- Results ---");
                Console.WriteLine("Azure SDK:   {0} ms: ", azureSDKTime.TotalMilliseconds);
                Console.WriteLine("WebJobs SDK: {0} ms: ", webJobsSDKTime.TotalMilliseconds);

                Console.WriteLine("Perf ratio (x100, long): {0}", perfRatio);

                MeasurementBlock.Mark(
                    perfRatio,
                    (disableLogging ? QueueNoLoggingOverheadMetric : QueueLoggingOverheadMetric) + ";Ratio;Percent");
            }
            finally
            {
                Cleanup();
            }
        }
开发者ID:rafaelmtz,项目名称:azure-webjobs-sdk,代码行数:29,代码来源:QueueOverheadPerfTest.cs

示例2: BlobManager

 public BlobManager(string conStr)
 {
     //RoleEnvironment.GetConfigurationSettingValue("UploadCon")
     Storage = CloudStorageAccount.Parse(conStr);
     BlobClient = Storage.CreateCloudBlobClient();
     QueueClient = Storage.CreateCloudQueueClient();
 }
开发者ID:peacecwz,项目名称:AAYazOkuluCloudService,代码行数:7,代码来源:BlobManager.cs

示例3: Run

        public override void Run()
        {
            Trace.TraceInformation("QueueProcessor_WorkerRole entry point called", "Information");
            var queueClient = new CloudQueueClient(this.uri, new StorageCredentials(this.GetQueueSas()));

            var queue = queueClient.GetQueueReference("messagequeue");

            while (true)
            {
                Thread.Sleep(10000);
                Trace.TraceInformation("Working", "Information");

                if (DateTime.UtcNow.AddMinutes(1) >= this.serviceQueueSasExpiryTime)
                {
                    queueClient = new CloudQueueClient(this.uri, new StorageCredentials(this.GetQueueSas()));
                    queue = queueClient.GetQueueReference("messagequeue");
                }

                var msg = queue.GetMessage();

                if (msg != null)
                {
                    Trace.TraceInformation(string.Format("Message '{0}' processed.", msg.AsString));
                    queue.DeleteMessage(msg);
                }
            }
        }
开发者ID:joergjo,项目名称:HOL-GettingStartedWindowsAzureStorage,代码行数:27,代码来源:WorkerRole.cs

示例4: EndToEndTestFixture

        protected EndToEndTestFixture(string rootPath)
        {
            string connectionString = AmbientConnectionStringProvider.Instance.GetConnectionString(ConnectionStringNames.Storage);
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
            _queueClient = storageAccount.CreateCloudQueueClient();
            _blobClient = storageAccount.CreateCloudBlobClient();

            CreateTestStorageEntities();
            TraceWriter = new TestTraceWriter(TraceLevel.Verbose);

            ScriptHostConfiguration config = new ScriptHostConfiguration()
            {
                RootScriptPath = rootPath,
                TraceWriter = TraceWriter,
                FileLoggingEnabled = true
            };

            HostManager = new ScriptHostManager(config);

            Thread t = new Thread(_ =>
            {
                HostManager.RunAndBlock();
            });
            t.Start();

            TestHelpers.Await(() => HostManager.IsRunning).Wait();
        }
开发者ID:isaacabraham,项目名称:azure-webjobs-sdk-script,代码行数:27,代码来源:EndToEndTestFixture.cs

示例5: 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

示例6: GenerateCloudQueueClient

 public static CloudQueueClient GenerateCloudQueueClient()
 {
     Uri baseAddressUri = new Uri(TestBase.TargetTenantConfig.QueueServiceEndpoint);
     CloudQueueClient client = new CloudQueueClient(baseAddressUri, TestBase.StorageCredentials);
     client.AuthenticationScheme = DefaultAuthenticationScheme;
     return client;
 }
开发者ID:nberardi,项目名称:azure-sdk-for-net,代码行数:7,代码来源:TestBase.cs

示例7: configureQueue

        protected virtual void configureQueue(CloudStorageAccount storageAccount)
        {
            // Create the queue client
            this.queueClient = storageAccount.CreateCloudQueueClient();

            this.queue = createQueue(this.queueClient, this.queueName);
        }
开发者ID:NewMediaCenterMoscow,项目名称:UniSocial3,代码行数:7,代码来源:BaseMessageWorker.cs

示例8: CloudQueueClientConstructor

 public void CloudQueueClientConstructor()
 {
     Uri baseAddressUri = new Uri(TestBase.TargetTenantConfig.QueueServiceEndpoint);
     CloudQueueClient queueClient = new CloudQueueClient(baseAddressUri, TestBase.StorageCredentials);
     Assert.IsTrue(queueClient.BaseUri.ToString().StartsWith(TestBase.TargetTenantConfig.QueueServiceEndpoint));
     Assert.AreEqual(TestBase.StorageCredentials, queueClient.Credentials);
 }
开发者ID:Juliako,项目名称:azure-sdk-for-net,代码行数:7,代码来源:CloudQueueClientTest.cs

示例9: AzureQueueController

		public AzureQueueController()
		{
			var credentials = new StorageCredentials(ConfigurationManager.AppSettings["AzureAccountName"], ConfigurationManager.AppSettings["AzureKeyValue"]);
			var azureTableUri = new Uri("https://" + ConfigurationManager.AppSettings["AzureAccountName"] + ".queue.core.windows.net");
			var client = new CloudQueueClient(azureTableUri, credentials);
			_queue = client.GetQueueReference(QueueName);
		}
开发者ID:Neonsonne,项目名称:dbSpeed,代码行数:7,代码来源:AzureQueueController.cs

示例10: Run

        public override void Run()
        {
            // This is a sample worker implementation. Replace with your logic.
            Trace.TraceInformation("QueueProcessor_WorkerRole entry point called", "Information");

            // Initialize the account information
            var storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));

            // retrieve a reference to the messages queue
            var queueClient = new CloudQueueClient(this.uri, new StorageCredentials(this.GetProcessSasForQueues()));
            var queue = queueClient.GetQueueReference("messagequeue");

            while (true)
            {
                Thread.Sleep(10000);
                Trace.TraceInformation("Working", "Information");
                if (queue.Exists())
                {
                    if (DateTime.UtcNow.AddMinutes(1) >= this.serviceQueueSasExpiryTime)
                    {
                        queueClient = new CloudQueueClient(this.uri, new StorageCredentials(this.GetProcessSasForQueues()));
                        queue = queueClient.GetQueueReference("messagequeue");
                    }

                    var msg = queue.GetMessage();

                    if (msg != null)
                    {
                        Trace.TraceInformation(string.Format("Message '{0}' processed.", msg.AsString));
                        queue.DeleteMessage(msg);
                    }
                }
            }
        }
开发者ID:spederiva,项目名称:AzureOss,代码行数:34,代码来源:WorkerRole.cs

示例11: EmailQueue

        public EmailQueue(CloudQueueClient queueClient)
        {
            Guard.NotNull(queueClient, nameof(queueClient));

            this._queueClient = queueClient;

            this._dequeuedMessages = new ConcurrentDictionary<Email, CloudQueueMessage>();
        }
开发者ID:LeagueLogbook,项目名称:Logbook,代码行数:8,代码来源:EmailQueue.cs

示例12: CreateShipQueue

        private void CreateShipQueue(CloudQueueClient queueClient)
        {
            var shipQueueName = CloudConfigurationManager.GetSetting("ShipQueue.Name");

            var queue = queueClient.GetQueueReference(shipQueueName);

            queue.CreateIfNotExists();
        }
开发者ID:jladuval,项目名称:CQRSTemplate,代码行数:8,代码来源:StorageQueues.cs

示例13: AzureStorageQueuesTransport

        /// <summary>
        /// Constructs the transport
        /// </summary>
        public AzureStorageQueuesTransport(CloudStorageAccount storageAccount, string inputQueueName)
        {
            if (storageAccount == null) throw new ArgumentNullException("storageAccount");
            if (inputQueueName == null) throw new ArgumentNullException("inputQueueName");

            _inputQueueName = inputQueueName.ToLowerInvariant();
            _queueClient = storageAccount.CreateCloudQueueClient();
        }
开发者ID:geffzhang,项目名称:Rebus,代码行数:11,代码来源:AzureStorageQueuesTransport.cs

示例14: 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

示例15: AnalyzeSummonerMatchHistoryQueue

        public AnalyzeSummonerMatchHistoryQueue(CloudQueueClient queueClient)
        {
            Guard.NotNull(queueClient, nameof(queueClient));

            this._queueClient = queueClient;

            this._dequeuedMessages = new ConcurrentDictionary<int, CloudQueueMessage>();
        }
开发者ID:LeagueLogbook,项目名称:Logbook,代码行数:8,代码来源:AnalyzeSummonerMatchHistoryQueue.cs


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