My Service bus trigger function reads messages from a service bus topic
[Function("Posting")]
public async Task Run(
[ServiceBusTrigger("topicnName", "subscriptionName",Connection = "AppSettings:SERVICE_BUS_CONNSTRING")]
ServiceBusReceivedMessage message,
ServiceBusMessageActions messageActions)
{
}
SERVICE_BUS_CONNSTRING is retrieved from Azure app configuration. And this function is working locally but not in Azure.
My application settings in Azure for worker runtime is set to dotnet-isolated
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "dotnet-isolated",
"slotSetting": false
}
And my host.json is also configured as below:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensions": {
"serviceBus": {
"messageHandlerOptions": {
"autoComplete": false,
"maxConcurrentCalls": 1
}
}
}
}
I have created Isolated service bus topic trigger function with runtime stack dotnet isolated. By using below code able to read the messages from the service bus topic like below:
function code:
local.settings.josn:
host.json:
The above function executed successfully. check below:
I have published the above function into the azure portal.
Make sure to add service bus connection string in the appsettings of function app and check my configuration ln the below:
when i will send messages from the service bus topic got triggered in the portal like below:
Output: