0
votes

I've created an really simple .net core 3.1 functions project with an function that should be triggered based on an service bus queue.

Code looks like this:

[FunctionName("PublishImage")]
public static async Task Run(
    [QueueTrigger("publishimage")]string message,
    ILogger log)
{
    log.LogInformation($"Started to publish image: {message}");
}

When i start the function locally i see that he finds the function and i don't get any exception.

Then when i send a message to the queue. It doesn't get triggered. In Azure i see that there are now 4 message in the queue and what ever i do it doesn't get triggered, see no exceptions locally and if i try to run it in Azure with application Insights enabled i don't see any exception or any information. Also turning logging on doesn't give any information.

My host.json now looks like this:

{
    "version": "2.0",
    "functionTimeout": "04:00:00",
    "extensions": {
        "queues": {
            "maxPollingInterval": "00:00:02",
            "visibilityTimeout": "00:00:30",
            "batchSize": 16,
            "maxDequeueCount": 5,
            "newBatchThreshold": 8
        }
    }
}
  • Microsoft.NET.Sdk.Functions 3.0.7 is installed.
  • Runtime in azure is ~3
  • The app setting AzureWebJobsServiceBus is set and verified
2

2 Answers

1
votes

Yeah, you are confusing Azure Service Bus and Azure Storage Queues. QueueTrigger is for Storage Queue and ServiceBusTrigger for a Service Bus.

0
votes

I've found the solution. I was using an Service Bus queue. Therefor i should not use the QueueTrigger but the ServiceBusTrigger. Changing the code to following fixed the problem:

[FunctionName("PublishImage")]
public static async Task Run(
    [ServiceBusTrigger("publishimage")]string message,
    ILogger log)
{
    log.LogInformation($"Started to publish image: {message}");
}