【问题标题】:How to move move messages one by one from DLQ to Deffered using c#如何使用c#将消息从DLQ一一移动到Deffered
【发布时间】:2022-01-12 18:32:08
【问题描述】:

我想在特定条件下将消息从 DLQ 移动到延迟,例如如果自定义属性“RetryCount”大于 5,否则我必须将其移动到主队列。将消息从 DLQ 传输到主队列工作正常。但是在从 DLQ 读取到延迟队列后,我没有找到合适的解决方案来移动消息。我正在使用 C# 代码。 注意:我使用的是主题和订阅模型

【问题讨论】:

  • “延迟队列”是什么意思? ASB 中没有延迟队列这样的东西。有延迟消息。

标签: c# .net azureservicebus


【解决方案1】:

我们可以使用QueueExplorer 将消息从死信队列中移出。查看此SO 了解更多信息

您还可以根据您的要求使用 Service Bus Explorer 对其进行管理,您可以获取信息here

下面是一个用于转发死信消息的示例代码

var transport = endpointConfiguration.UseTransport<AzureServiceBusTransport>();
var queues = transport.Queues();
queues.ForwardDeadLetteredMessagesTo(
        condition: queueName =>
        {
            return queueName != "error" &&
                   queueName != "audit" &&
                   queueName != "centralizeddlq";
        },
        forwardDeadLetteredMessagesTo: "centralizeddlq");
var subscriptions = transport.Subscriptions();
subscriptions.ForwardDeadLetteredMessagesTo("centralizeddlq");

【讨论】:

    猜你喜欢
    • 2014-01-01
    • 2016-02-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-27
    • 2020-07-12
    • 1970-01-01
    • 2018-07-28
    相关资源
    最近更新 更多