Ejemplo n.º 1
0
        public ProcessingQueueItem GetNextMessage()
        {
            ProcessingQueueItem item = new ProcessingQueueItem();

            CloudQueueMessage retrievedMessage = queue.GetMessage();

            if (retrievedMessage == null)
                return null;

            try
            {
                item.Data = (Dictionary<string, long>)_formatter.Deserialize(new System.IO.MemoryStream(retrievedMessage.AsBytes));
                item.Type = (MessageType)item.Data["Type"];
                queue.DeleteMessage(retrievedMessage);
            }
            catch (Exception e)
            {
                if (retrievedMessage.DequeueCount > 3)
                {
                    // delete the 'poison pill'
                    queue.DeleteMessage(retrievedMessage);
                }
                return null;
            }

            return item;
        }
Ejemplo n.º 2
0
        public ProcessingQueueItem GetNextMessage()
        {
            ProcessingQueueItem item = new ProcessingQueueItem();

            CloudQueueMessage retrievedMessage = queue.GetMessage();

            if (retrievedMessage == null)
                return null;

            item.Data = (Dictionary<string, long>)_formatter.Deserialize(new System.IO.MemoryStream(retrievedMessage.AsBytes));
            item.Type = (MessageType)item.Data["Type"];

            queue.DeleteMessage(retrievedMessage);

            return item;
        }