I have two Service Bus Queues and Azure Service Bus Queue Trigger.
The function reads 1000 messages from the queue and forwards them to another (for test) When publishing to Azure (plan consumption) I get 1030+ function hits even though I only have 1000 messages in the queue. I think this has to do with the number of function instances.
Q: How to process 1 unique message only once for 1 function instance?
[FunctionName("Function1")]
public static async Task Run([ServiceBusTrigger("export-queue",
Connection = "Connection")]
string myQueueItem, ILogger log)
{
log.LogInformation($"Message: {myQueueItem}:{DateTime.Now}");
Thread.Sleep(2000);
queueClient = new QueueClient(ServiceBusConnectionString, QueueName);
var message = new Message(Encoding.UTF8.GetBytes(myQueueItem));
await queueClient.SendAsync(message);
await queueClient.CloseAsync();
}