2

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

enter image description here

enter image description here

Can someone provide a link to an example or some documentation for net6 functions and manual deadlettering?

andrewJames
  • 19,570
  • 8
  • 19
  • 51
Robert Green MBA
  • 1,834
  • 1
  • 22
  • 45
  • What you are looking for is on this [SO Question](https://stackoverflow.com/questions/61191322/how-to-move-a-service-bus-messge-to-deadletter-in-service-bus-queue-trigger-func) – ihimv Jul 15 '22 at 18:33

2 Answers2

2

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.

Jesse Squire
  • 6,107
  • 1
  • 27
  • 30
-1

you can use the azure sdk for .net for this along with message receiver.

To manually dead letter a message we need to use the deadletterAsync method.

await messageReceiver.DeadLetterAsync(lockToken);

Refer the documentation for deadletterAsync .

Mohit Ganorkar
  • 1,917
  • 2
  • 6
  • 11