I have got Azure Service bus topic trigger created. Not sure why it is not pulling messages off a subscription from a topic. I do have my user role setup in as reader/write in Azure using Visual studio 2022 login to organisations Azure Account.
Using the following versions :
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.19.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="5.13.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.15.1" />
</ItemGroup>
and local.settings.json as
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
"ServiceBusConnectionString__fullyQualifiedNamespace": "xxxxxx.servicebus.windows.net"
}
}
and the function is simply as follows:
[Function(nameof(ServiceBusTrigger))]
public void Run([ServiceBusTrigger("xxxx", "yyyy", Connection = "ServiceBusConnectionString")] ServiceBusReceivedMessage message)
{
_logger.LogInformation("Message ID: {id}", message.MessageId);
_logger.LogInformation("Message Body: {body}", message.Body);
_logger.LogInformation("Message Content-Type: {contentType}", message.ContentType);
}
function is started and confirmed messages are in subscription queue:
Azure Functions Core Tools
Core Tools Version: 4.0.5413 Commit hash: N/A (64-bit)
Function Runtime Version: 4.25.3.21264
[2023-10-19T00:32:59.110Z] Found C:\SCM\Poc\functions\ServiceBusTopicDemo\LocalFunctionProj\LocalFunctionProj.csproj. Using for user secrets file configuration.
[2023-10-19T00:33:01.599Z] Worker process started and initialized.
Functions:
ServiceBusTrigger: serviceBusTrigger
For detailed output, run func with --verbose flag.
[2023-10-19T00:33:05.890Z] Host lock lease acquired by instance ID '000000000000000000000000C8B5EEE0'.
Could you provide more detail about this?
Is the logging output actually fetching message data? I've done the exact same integration with queues, not topics and it works fine.
I see that your ServiceBusConnectionString is not the same as defined in your local.settings.json, that will be the case if not set correctly.
Besides that, everything seems okay.