I have an Azure function that has the following simple code:
public class MyDequeuer
{
[FunctionName("SampleMessageExecutor")]
public static async Task Run(
[ServiceBusTrigger("test-queue", AccessRights.Listen, Connection = "ServiceBusConnectionString")]
Message inMessage, string locktoken, ILogger log, ExecutionContext ctx)
{
try {
some code..
} catch(Exception e) {
await inMessage.DeadLetterAsync(locktoken);
}
}
}
This works fine. However when I at some point later say maybe 1h later or 24h later go to the deadletter queue and try to repair and resubmit the message from the service bus explorer then I see lots of errors saying that the message locktoken has expired. How are you supposed to deal with a scenario where messages can end up on deadletter and maybe reprocessed hours or days later?
I am using function runtime dotnet core 3.1.