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


C# CloudQueue.DeleteMessage方法代码示例

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


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

示例1: Run

        public override void Run()
        {
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
            datatable = tableClient.GetTableReference("datatable");
            datatable.CreateIfNotExists();

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

            ramCounter = new System.Diagnostics.PerformanceCounter("Memory", "Available MBytes");
            cpuCounter = new System.Diagnostics.PerformanceCounter();
            cpuCounter.CategoryName = "Processor";
            cpuCounter.CounterName = "% Processor Time";
            cpuCounter.InstanceName = "_Total";

            crawler = new Crawler();

            while (true)
            {
                Thread.Sleep(50);

                //If there is something in the admin queue
                if (adminQueue.PeekMessage() != null)
                {
                    CloudQueueMessage message = adminQueue.GetMessage();
                    crawler.handleAdminMessage(message);
                    adminQueue.DeleteMessage(message);
                }
                if (urlQueue.PeekMessage() != null)
                {
                    crawler.crawlingPhase(urlQueue.GetMessage());
                }
            }
        }
开发者ID:kinderst,项目名称:Web-Service-Like-Google,代码行数:38,代码来源:WorkerRole.cs

示例2: QueueBase64EncodingTestDownloadMessageAndVerify

        private static void QueueBase64EncodingTestDownloadMessageAndVerify(CloudQueue queue, CloudQueue queueRefWithoutBase64Encoding, byte[] originalData)
        {
            // Assumption: 2 of the same messages have been added
            // If the message was uploaded with Base64Encoding, this function will also retrieve the message without Base64 encoding.
            CloudQueueMessage readBack = queue.GetMessage();
            if (!CompareByteArray(originalData, readBack.AsBytes))
            {
                string orignalData = PrintByteArray(originalData, "OriginalData");
                string returnedData = PrintByteArray(readBack.AsBytes, "ReturnedData");
                Assert.Fail("Data read back from server doesn't match the original data. \r\n{0}\r\n{1}", orignalData, returnedData);
            }

            queue.DeleteMessage(readBack);
            if (queue.EncodeMessage)
            {
                CloudQueueMessage readBackWithoutBase64Encoding = queueRefWithoutBase64Encoding.GetMessage();
                byte[] returnedDataWithoutBase64Encoding = Convert.FromBase64String(readBackWithoutBase64Encoding.AsString);
                if (!CompareByteArray(originalData, returnedDataWithoutBase64Encoding))
                {
                    string orignalData = PrintByteArray(originalData, "OriginalData");
                    string returnedData = PrintByteArray(returnedDataWithoutBase64Encoding, "ReturnedDataWithoutBase64Encoding");
                    Assert.Fail("Data read back from server doesn't match the original data. \r\n{0}\r\n{1}", orignalData, returnedData);
                }

                queueRefWithoutBase64Encoding.DeleteMessage(readBackWithoutBase64Encoding);
            }
            else
            {
                readBack = queue.GetMessage();
                queue.DeleteMessage(readBack);
            }
        }
开发者ID:BurtHarris,项目名称:azure-storage-net,代码行数:32,代码来源:CloudQueueMessageTest.cs

示例3: DeleteSourceMessages

 private void DeleteSourceMessages(CloudQueue sourceQueue, IList<CloudQueueMessage> inboundMessages, Stopwatch stopWatch)
 {
     inboundMessages.ForEach(inMsg => sourceQueue.DeleteMessage(inMsg));
     this.LogInformation("Done deleting {0} messages from {1} queue. Elapsed {2}.", inboundMessages.Count, sourceQueue.Name, stopWatch.Elapsed);
 }
开发者ID:vgribok,项目名称:Aspectacular,代码行数:5,代码来源:AzureQueueMulticaster.cs

示例4: Acknowledge

 internal void Acknowledge(CloudQueue queue)
 {
     queue.DeleteMessage(m_AzureMessage);
 }
开发者ID:dlkj,项目名称:WorkerFramework,代码行数:4,代码来源:AzureQueueMessage.cs

示例5: Run

        public override void Run()
        {
            storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
            cmdQueue = storageAccount.CreateCloudQueueClient().GetQueueReference("krawlercmd");
            urlQueue = storageAccount.CreateCloudQueueClient().GetQueueReference("krawlerurl");
            errorQueue = storageAccount.CreateCloudQueueClient().GetQueueReference("krawlererror");
            lastTenUrlQueue = storageAccount.CreateCloudQueueClient().GetQueueReference("lasttenurlcrawled");
            index = storageAccount.CreateCloudTableClient().GetTableReference("krawlerindex");
            visisted = new HashSet<string>();

            cmdQueue.CreateIfNotExists();
            urlQueue.CreateIfNotExists();
            errorQueue.CreateIfNotExists();
            lastTenUrlQueue.CreateIfNotExists();

            // This is a sample worker implementation. Replace with your logic.
            Trace.TraceInformation("WorkerRole entry point called", "Information");

            Crawler crawler = new Crawler();
            //cmdQueue.Clear();
            //cmdQueue.AddMessage(new CloudQueueMessage("stop"));

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

                CloudQueueMessage cmd = cmdQueue.PeekMessage();
                if (cmd == null || cmd.AsString == "stop")
                {
                    continue;
                }
                else if (cmd.AsString == "start")
                {
                    CloudQueueMessage url = urlQueue.GetMessage();
                    if (!visisted.Contains(url.AsString))
                    {
                        crawler.Crawl(url.AsString);
                        visisted.Add(url.AsString);
                    }

                    urlQueue.DeleteMessage(url);
                }
                else if (cmd.AsString == "load" && urlQueue.PeekMessage() == null)
                {
                    crawler.LoadQueue("http://www.cnn.com");
                }
                else
                {
                    continue;
                }
            }
        }
开发者ID:ngokchau,项目名称:pa4,代码行数:53,代码来源:WorkerRole.cs


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