Azure:如何将邮件从中毒队列移回主队列? [英] Azure: How to move messages from poison queue to back to main queue?

查看:94
本文介绍了Azure:如何将邮件从中毒队列移回主队列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有工具或库可以在队列之间移动消息? 目前,我正在执行以下操作

I'm wondering if there is a tool or lib that can move messages between queues? Currently, i'm doing something like below

public static void ProcessQueueMessage([QueueTrigger("myqueue-poison")] string message, TextWriter log)
{
    CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connString);
    CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
    CloudQueue queue = queueClient.GetQueueReference("myqueue");
    queue.CreateIfNotExists();

    var messageData = JsonConvert.SerializeObject(data, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() });
    queue.AddMessage(new CloudQueueMessage(messageData));
}

推荐答案

基本上,Azure存储不支持将消息从一个队列移动到另一个队列.您将需要自己执行此操作.

Essentially Azure Storage doesn't support moving messages from one queue to another. You would need to do this on your own.

实现将消息从一个队列移动到另一个队列的一种方法是通过将消息从源队列中出队(调用GetMessages),读取消息的内容,然后在目标队列中创建新消息.您可以通过使用Storage Client Library来做到这一点.

One way to implement moving the messages from one queue to another is by dequeuing the messages from the source queue (by calling GetMessages), read the contents of the message and then creating a new message in the target queue. This you can do via using Storage Client Library.

我想到的一种用于移动消息的工具是 Cerebrata Azure Management Studio .它具有此功能.

One tool that comes to my mind for moving messages is Cerebrata Azure Management Studio. It has this functionality.

截至(a)2018年11月11日的 Microsoft Azure Storage Explorer 不支持移动队列消息.

As at (2018-09-11) version 1.4.1 of the Microsoft Azure Storage Explorer doesn't support moving queue messages.

这篇关于Azure:如何将邮件从中毒队列移回主队列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆