0

I am using ServiceBusQueueTrigger in NodeJS. When there is error, it is expected to put message to Deadletter Queue instead of Complete it. How can I do that?

Below is my code in index.js:

module.exports = async function(context, message) {
    ...
}
DaiKeung
  • 1,077
  • 1
  • 19
  • 38
  • According to my research, if the function fails, it will call ```Abandon``` method and tell service bus message processing failed. The service bus will check if the DeliveryCount of this message reaches MaxDeliveryCount. If it reaches, service bus will move it to Deadletter Queue. Otherwhise, service bus will let the function continue to process it. For more details, please refer to https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus#trigger---poison-messages and https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-dead-letter-queues – Jim Xu Nov 08 '19 at 03:30
  • Thanks @JimXu. Oh, I may know why as I used NodeJS servicebus which I needed to delete message after finish task. Now, I caught exception then it treated me as FINISHED. So, what I can do is remove all exception handling, right ? – DaiKeung Nov 08 '19 at 03:38
  • You can do that. – Jim Xu Nov 08 '19 at 04:47

1 Answers1

1

According to my research, if the function fails, it will call Abandon method and tell service bus message processing failed. The service bus will check if the DeliveryCount of this message reaches MaxDeliveryCount. If it reaches, service bus will move it to Deadletter Queue. Otherwhise, service bus will let the function continue to process it. For more details, please refer to https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus#trigger---poison-messages and https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-dead-letter-queueshttps://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-dead-letter-queues

Jim Xu
  • 21,610
  • 2
  • 19
  • 39