I'm trying to deadletter a message but can't seems to find the right library:
MessageReceiver
ServiceBusReceiver
ServiceBusReceivedMessage
I've tried both. Getting runtime errors with all of them.
net6.0 Azure Function
Can someone provide a link to an example or some documentation for net6 functions and manual deadlettering?
To perform message settlement tasks, you'll want to bind to ServiceBusMessageActions
. This will give you access to operations such as dead lettering, completion, and abandonment.
For example:
[FunctionName("BindingToMessageActions")]
public static async Task Run(
[ServiceBusTrigger("<queue_name>", Connection = "<connection_name>")]
ServiceBusReceivedMessage[] messages,
ServiceBusMessageActions messageActions)
{
foreach (ServiceBusReceivedMessage message in messages)
{
// Dead letter all the things!
await messageActions.DeadLetterMessageAsync(message);
}
}
More examples for using the extensions bindings for various scenarios can be found in the Examples section of the overview documentation.