I've tried a lot, but I don't understand how to configure the following:
When there is a new entry in the Azure service bus, I want an Azure function (4.0) to get triggered.
This is how I expected it to work:
const { app } = require('@azure/functions');
const namespace = "this-is-my-service-bus-namespace"
const fullyQualifiedNamespace = `${namespace}.servicebus.windows.net`;
const topicName = "my-topic";
app.serviceBusTopic('serviceBusQueueTrigger1', {
topicName: topicName,
connection: fullyQualifiedNamespace,
handler: (message, context) => {
context.log('message:', message);
},
});
This gives me an error when it starts up:
The 'serviceBusQueueTrigger1' function is in error: Unable to configure binding 'serviceBusTrigger1' of type 'serviceBusTrigger'. This may indicate invalid function.json properties. Can't figure out which ctor to call.
What does this mean? I don't even have a file called function.json.
Microsoft offers some documentation here, but I don't understand what exactly I have to do. Probably, something with the connection is wrong... Do I have to put settings to a JSON file?
You can create a Model v4 JavaScript Service Bus topic triggered function like below-
Add
subscriptionName: '{subscription name which is created in your topic}'in your code alike me.Code-
You need to copy the connection string as shown below and pass the value in local.settings file.
local.settings.json-
Create a subscription in your topic like below.
I am sending the message to my topic by selecting the subscription.
I am able to get the expected output.
Please make the changes in your code, you will also get the output.