【问题标题】:How to send service bus message to deadletter queue in NodeJS?如何将服务总线消息发送到 NodeJS 中的死信队列?
【发布时间】:2020-01-11 00:08:45
【问题描述】:

如何将消息发送到死信队列?

serviceBusService.receiveQueueMessage(MESSAGE_QUEUE, {isPeekLock: true}, (error, message) => {
    ...... // want to put message to deadletter queue if there is exception
    serviceBusService.deleteMessage(message, error => {
    });
});

【问题讨论】:

    标签: node.js servicebus dead-letter


    【解决方案1】:

    大多数情况下,您希望依靠系统来决定何时将消息移动到 DLQ 并尽可能让其成为消息传递引擎的职责(而不是明确地将消息放在 DLQ 上)。这种情况下的指导是通过此处的文档提供的:How to handle application crashes and unreadable messages

    【讨论】:

      【解决方案2】:

      看起来您正在使用依赖于 HTTP REST api 的较旧的 azure-sb 包。如果您改用较新的 @azure/service-bus 包,它使用更快的 AMQP 实现,您收到的消息上有一个 deadletter() 方法,您可以使用该方法将消息发送到死信队列。

      【讨论】:

        猜你喜欢
        • 2020-07-26
        • 2019-09-27
        • 2020-07-19
        • 1970-01-01
        • 2017-02-13
        • 1970-01-01
        • 1970-01-01
        • 2022-12-19
        • 2012-08-28
        相关资源
        最近更新 更多