Javascript Azure功能输出转到死信队列

时间:2018-05-31 06:15:33

标签: javascript node.js azure azure-functions azureservicebus

我有一个javascript Azure函数,它将消息放在Service Bus队列中:

module.exports = function (context, req) {
  var flatten = require('flat')

  var message = flatten(req.body);
  context.bindings.outputSbMsg = message;
  context.done();
};

当它通过Http触发器运行时,该函数成功完成。但是,消息最终会显示在Service Bus中的Dead Letter队列中。我在日志中看不到任何错误。我应该在哪里查看原因是什么?

1 个答案:

答案 0 :(得分:0)

邮件具有deliveryCount属性,创建或更新队列时,maxDeliveryCount可在队列上设置。

队列中的消息只能收到maxDeliveryCount的次数,即,一旦传递计数达到最大传递计数,就不能使用接收者接收消息了。队列,因为它将被移至死信队列。

如果要在将消息移至死信队列后接收消息,则需要为死信队列创建接收者。

请参阅此示例processMessageFromDLQ.js,该示例与版本7.0.0 @ azure / service-bus相同。

此外,您还可以通过指定原因将消息显式发送到死信队列,请参考示例movingMessagesToDLQ.js

版本7.0.0最近已发布。请参阅下面的链接。