Azure / Azure/Azure-Functions

Autocomplete = false ignored on Service Bus Binding (FunctionStartup related?)

Open
#1,286 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
PowerShell
Stars
1.1k
Forks
215
Avg merge
4h 2m
Merged PRs (30d)
1

Description

I have reproduced this issue with a very simple function

````csharp
[FunctionName("Function1")]
public async Task Run(
[ServiceBusTrigger("testqueue", Connection = "ServiceBusConnectionString")]Message message,
MessageReceiver messageReceiver)
{
await messageReceiver.CompleteAsync(message.SystemProperties.LockToken);

await Task.Delay(70 * 1000);

_logger.LogInformation($"C# ServiceBus queue trigger function processed message: {message.MessageId}");
}
````

this is my host.json

````json
{
"version": "2.0",
"extensions": {
"serviceBus": {
"messageHandlerOptions": {
"autoComplete": false,
"maxConcurrentCalls": 500
}
}
}
}
````

I have a custom function startup.

````csharp
[assembly: FunctionsStartup(typeof(Startup))]

namespace AutoCompleteIgnored
{
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
//Do nothing
}
}
}
````

Even though I have autoComplete: false in the host.json, it is still trying to renew the lock when the function has finished running - so it throws an exception for each function invocation

````
[23/07/2019 8:21:04 PM] MessageReceiver error (Action=RenewLock, ClientId=MessageReceiver1testqueue, EntityPath=testqueue, Endpoint=moffmo.servicebus.windows.net)[23/07/2019 8:21:04 PM] Microsoft.Azure.ServiceBus: The lock supplied is invalid. Either the lock expired, or the message has already been removed from the queue. Reference:d8a0575d-d7b1-42f9-aaca-052bd6729015, TrackingId:0696ac9e-08f8-4a03-9645-8773d360c016_B8, SystemTracker:moffmo:Queue:testqueue, Timestamp:2019-07-23T20:21:05.
````

I have push the most basic reproduction of this issue to https://github.com/Moffmo/AzureFunctionServiceBusIssue feel free to clone to test.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.