We have several Azure Function (1.0) apps with a ServiceBus trigger. We are experiencing a sporadic problem where messages are picked up and processed twice, which causes huge problems.
Our sample code looks like this:
[FunctionName("CreateFile")]
public static async Task Run([ServiceBusTrigger(CreateFileTask.topic, "default", Connection = "Queue.ConnectionString")]string mySbMsg, ILogger log)
{
...
The most recent time this occurred, the message was retrieved and started processing at 7:00pm. At 7:03pm, the message was again retrieved and processed in parallel. Both processes finished successfully, which resulted in the creation of two files.
This problem doesn't happen frequently (maybe once every two months), but it is a huge headache when it does.
How can we prevent this from occurring in the future?
question from:
https://stackoverflow.com/questions/65830451/azure-functions-service-bus-messages-processed-twice 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…