コード例 #1
0
            public void UpdateMessage(CloudQueueMessage message, TimeSpan visibilityTimeout, MessageUpdateFields updateFields)
            {
                CloudQueueMessage storedMessage = LookupMessage(message.PopReceipt);

                if ((updateFields & MessageUpdateFields.Content) == MessageUpdateFields.Content)
                {
                    // No-op; queue messages already provide in-memory content updating.
                }

                if ((updateFields & MessageUpdateFields.Visibility) == MessageUpdateFields.Visibility)
                {
                    DateTimeOffset nextVisibleTime = DateTimeOffset.Now.Add(visibilityTimeout);
                    storedMessage.SetNextVisibleTime(nextVisibleTime);
                    message.SetNextVisibleTime(nextVisibleTime);
                }
            }
コード例 #2
0
        public static CloudQueueMessage Create(
            byte[] content,
            string id                      = null,
            string popReceipt              = null,
            int?dequeueCount               = null,
            DateTimeOffset?insertionTime   = null,
            DateTimeOffset?nextVisibleTime = null,
            DateTimeOffset?expirationTime  = null)
        {
            var message = new CloudQueueMessage(string.Empty);

            message.SetMessageContent(content);
            if (id != null)
            {
                message.SetId(id);
            }
            if (popReceipt != null)
            {
                message.SetPopReceipt(popReceipt);
            }
            if (dequeueCount.HasValue)
            {
                message.SetDequeueCount(dequeueCount.Value);
            }
            if (insertionTime.HasValue)
            {
                message.SetInsertionTime(insertionTime.Value);
            }
            if (nextVisibleTime.HasValue)
            {
                message.SetNextVisibleTime(nextVisibleTime.Value);
            }
            if (expirationTime.HasValue)
            {
                message.SetExpirationTime(expirationTime.Value);
            }
            return(message);
        }