I have an Azure Function that is hooked up to a Service Bus queue. It receives a message and generates records to save in an Azure Table storage.
The Service Bus queue currently has a lot of messages:
Since there are a lot of pending messages, I would expect the scaling of the Azure Functions to happen, however it does not seem to be the case:
There is only one instance of the Function running and I expected more to help empty the queue.
As specified in the Azure Function's documentation on scaling when using a service bus, I made sure the policy used by the Azure Function included the Manage rights to help scaling:
Question
Why is my Azure Function running on a Consumption Plan not scaling to help dequeue all the messages from the Service Bus?
Update
Here is an extract of the Azure Function:
public static class RecordImporter
{
private static readonly IImporter Importer;
static RecordImporter()
{
Importer = new AzureTableImporter();
}
[FunctionName("Importer")]
public static async Task Run([ServiceBusTrigger("records ", Connection = "serviceBusConnectionString")] string serializedRecords, ILogger log)
{
var records = JsonConvert.DeserializeObject<List<Record>>(serializedRecords);
await Importer.AddRecordsAsync(records);
}
}