I am creating an azure function that is triggered using service bus topic using .Net 6.0. I am trying to run it on my local but it seems that the trigger is not working. I added message to my topic but the function didn't get call.
Azure Function
[FunctionName("TestFunction")]
public static void Run(
[ServiceBusTrigger("test-topic", "test-sub", Connection = "AzureWebJobsServiceBus")] string messageBodyAsString,
ILogger logger)
{
logger.LogInformation($"C# function triggered to process a message: {messageBodyAsString}");
}
local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"AzureWebJobsServiceBus": "Endpoint="
}
if works in azure and you can't debug locally, it could be either firewall or proxy' try first adding "transportType": "amqpWebSockets" to your host.json. that will solve the firewall problem if that is the only problem. Sometimes the proxy can block WebSockets