When using the WebJobs SDK what is the proper way to move a BrokeredMessage to the deadletter queue? Usually I would just call msg.DeadLetter(). However, the SDK takes care of managing the life cycle of the brokered message. It will call msg.Complete() if the method returns successful, and it will retry the message if an exception occurs. I need the 3rd case of telling the ServiceBus queue to move the message to the deadletter queue as it is a bad message.
You can explicitly deadletter the service bus queue and trigger a function when the message is dead lettered.
public static void ProcessSBQueueMessage(
[ServiceBusTrigger("inputqueue")] BrokeredMessage inputText)
{
inputText.DeadLetter("Webjobs", "webjobsdescription");
Console.WriteLine(inputText);
}
public static void ProcessSBDeadLetterQueueMessage(
[ServiceBusTrigger("inputqueue/$DeadLetterQueue")] BrokeredMessage inputText)
{
Console.WriteLine(inputText);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With