예제 #1
0
        //Poison Message
        public void ProcessMessage()
        {
            CloudQueueClient queueClient      = StorageClientManager.GetQueueClient();
            CloudQueue       collectionsQueue = queueClient.GetQueueReference(_queueCollections);

            collectionsQueue.CreateIfNotExist();

            CloudQueueMessage message = collectionsQueue.GetMessage();

            if (message == null)
            {
                //Stop Polling
                return;
            }

            try
            {
                //Do Work
                collectionsQueue.DeleteMessage(message);
            }
            catch //Handle Poisned Messages
            {
                if (message.DequeueCount > 3)
                {
                    CloudQueue poisonQueue = queueClient.GetQueueReference(_queuePoison);
                    poisonQueue.CreateIfNotExist();
                    poisonQueue.AddMessage(message);
                    collectionsQueue.DeleteMessage(message);
                }
            }
        }
예제 #2
0
        public void RunQueues()
        {
            Console.WriteLine("RunQueues()");
            _queueClient = StorageClientManager.GetQueueClient();

            CreateQueue(_queueName);
            GetQueueInfomration(_queueName);
            DeleteQueue(_queueName);
        }
예제 #3
0
        //Create 1,000 Queues
        private void CreateJobs()
        {
            CloudQueueClient queueClient = StorageClientManager.GetQueueClient();

            queueClient.GetQueueReference(_queueCollections);
            CloudQueue queue = queueClient.GetQueueReference(_queueCollections);

            for (int i = 0; i < 10000; i++)
            {
                CloudQueueMessage message = new CloudQueueMessage(string.Format("collection job #{0}", i));
                queue.AddMessage(message);
            }
        }