本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Queue.CloudQueue.UpdateMessageAsync方法的典型用法代码示例。如果您正苦于以下问题:C# CloudQueue.UpdateMessageAsync方法的具体用法?C# CloudQueue.UpdateMessageAsync怎么用?C# CloudQueue.UpdateMessageAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.Storage.Queue.CloudQueue
的用法示例。
在下文中一共展示了CloudQueue.UpdateMessageAsync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateEnqueuedMessageAsync
private static async Task UpdateEnqueuedMessageAsync(CloudQueue queue)
{
Console.WriteLine("5. Insert another test message ");
await queue.AddMessageAsync(new CloudQueueMessage("Hello World Again!"));
Console.WriteLine("6. Change the contents of a queued message");
CloudQueueMessage message = await queue.GetMessageAsync();
message.SetMessageContent("Updated contents.");
await queue.UpdateMessageAsync(message, TimeSpan.Zero, MessageUpdateFields.Content | MessageUpdateFields.Visibility);
}
示例2: AzureQueueStorageMessage
public AzureQueueStorageMessage(CloudQueue queue, CloudQueueMessage message, TimeSpan maxMessageTime)
{
_message = message;
_queue = queue;
_strMessage = new Lazy<string>(() => _message.AsString);
var waitFor = ((message.NextVisibleTime.HasValue ? DateTime.UtcNow.AddMinutes(1) : message.NextVisibleTime.Value.UtcDateTime) - DateTime.UtcNow).Subtract(TimeSpan.FromSeconds(10));
_lockWatcher = AsyncEnumerableEx.CreateTimer(waitFor)
.Select(i => _queue.UpdateMessageAsync(_message, TimeSpan.FromMinutes(1), MessageUpdateFields.Visibility))
.Unwrap()
.TakeUntilDisposed(maxMessageTime, t => _isDisposed = true);
}
示例3: UpdateEnqueuedMessageAsync
/// <summary>
/// Update an enqueued message and its visibility time. For workflow scenarios this could enable you to update
/// the status of a task as well as extend the visibility timeout in order to provide more time for a client
/// continue working on the message before another client can see the message.
/// </summary>
/// <param name="queue">The sample queue</param>
private static async Task UpdateEnqueuedMessageAsync(CloudQueue queue)
{
// Insert another test message into the queue
Console.WriteLine("5. Insert another test message ");
await queue.AddMessageAsync(new CloudQueueMessage("Hello World Again!"));
Console.WriteLine("6. Change the contents of a queued message");
CloudQueueMessage message = await queue.GetMessageAsync();
message.SetMessageContent("Updated contents.");
await queue.UpdateMessageAsync(
message,
TimeSpan.Zero, // For the purpose of the sample make the update visible immediately
MessageUpdateFields.Content |
MessageUpdateFields.Visibility);
}