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); } }
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); }