简体   繁体   中英

Microsoft.Azure.ServiceBus: The lock supplied is invalid. Either the lock expired, or the message has already been removed from the queue

I've got a service bus topic triggered function which gets triggered whenever some data is pushed to the topic.

The function looks something like this:

[FunctionName("funcGetServiceBusEntities")]
public async Task Run([ServiceBusTrigger("sbtopic", "sbsub", Connection = "ServiceBusConnectionString")]Message message, MessageReceiver messageReceiver, [DurableClient] IDurableOrchestrationClient starter, ILogger log)
{  
   // perform processing on the data

   //...

   //...

   // Complete since we don't want to process the message again
   await messageReceiver.CompleteAsync(message.SystemProperties.LockToken);

   //...
}

I' m not sure why I'm getting this error:

Microsoft.Azure.ServiceBus: The lock supplied is invalid. Either the lock expired, or the message has already been removed from the queue. Reference:ab88d42f-5fed-4392-983a-921cc6eab776, TrackingId:7664c851-9f29-4b4f-a334-4038e0921810_B11, SystemTracker:sb-dev:Topic:sbtopic|sbsub, Timestamp:2020-03-31T12:09:32.

Is the implementation of CompleteAsync wrong?

This is what you faced now:

在此处输入图片说明

Please notice that after triggered the message will be removed. So you don't need to tag it and don't worry about process the message again. It has already been removed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM