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