Durable function triggered by servicebus message doesnt remove service bus message

Viewed 34

We have a durable function which is invoked from a Service Bus Trigger working fine with Azure

However, it appears as though the message doesn't get removed from Service Bus until the whole process has finished

Is this by design? Is there a workaround for this? Because it will cause me problems if the message gets picked up twice

Paul

1 Answers

Yes, that's by design. It completes it automatically when the function execution completes successfully - and that is not until the end of the orchestration, if it gets all the way through.

You could have a separate non-durable Azure Function with the ServiceBus trigger - and get that to start a new instance of the durable function. That orchestration would run asynchronously, meanwhile the trigger function itself would return immediately (and mark the message as completed). You'd just need to ensure your durable function does the right thing (for you) in event of a failure.

See https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-instance-management?tabs=csharp for example

Related