0
votes

The Azure Service Bus Queue triggered function would perform a default policy for sending message into the dead letter queue if message is poisoned. However, is there anyway that we could manually send the message to dead letter queue? There are couple of times that we wouldn't want Azure Function to perform its default policy due to some kind of internal or business exception, we would like to bind additional information to our message and manually send it to our Azure Service Bus Deadletter Queue.

In a previous version where it's using BrokeredMessage object, there is a method called

BrokeredMessage msg;
msg.DeadLetter();

However, in the most recent Functino 2.X, where it's using the Message object, that doesn't have this method somehow...

1

1 Answers

1
votes

With Functions 2.0 you use the .NET Standard Service Bus client. Message no longer has operations such as dead-lettering. Instead, you need to add an additional parameter of MessageReceiver type to be able to use DeadletterAsync() method it provides. You can find an example of how to use message receiver in my post.