I am making an azure cloudfunction with nodejs that gets triggered by a servicebus topic.
Reading this I am super confused, they have a version for everything and nothing makes sense in their documentation.
https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=in-process%2Cazure-cli%2Cv4&pivots=programming-language-javascript
The host.json file has 2 versions, the schema version and the bundle range version. Then the article talks about 5.x+ version, but the default range is 3.3.0 to 4.0 but not including 4. I am very confused what version am I using, what binding options are available to me and none of the articles explain anything in a clear and concise manner.
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.3.0, 4.0.0)"
}
}
Does this include 5.x+ that they talk about here? Do I need to make this 5.0.0?
If I use the host above, does this host.json config become invalid? The link above does not show messageHandlerOptions as one of the options (for 5.0.x) but mentions it being ok if not using sessions. Does it only apply for 2.0.x?
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.3.0, 4.0.0)"
},
"extensions": {
"serviceBus": {
"prefetchCount": 1,
"messageHandlerOptions": {
"autoComplete": true,
"maxConcurrentCalls": 1,
"maxAutoRenewDuration": "00:09:30"
}
}
},
"functionTimeout": "00:09:55"
}
What is the difference between Function and Extension?

For "Bundle v3.x" / "Functions 2.x+" Service Bus settings:
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.3.0, 4.0.0)"
},
"extensions": {
"serviceBus": {
"prefetchCount": 1,
"messageHandlerOptions": {
"autoComplete": true,
"maxConcurrentCalls": 1,
"maxAutoRenewDuration": "00:09:30"
}
}
},
"functionTimeout": "00:09:55"
}
For "Bundle v4.x" / "Extension 5.x+" Service Bus settings (the OP referenced doc does not list this Bundle version but it is listed here):
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.0.0, 5.0.0)"
},
"extensions": {
"serviceBus": {
"prefetchCount": 1,
"autoCompleteMessages": true,
"maxAutoLockRenewalDuration": "00:09:30",
"maxConcurrentCalls": 1
}
},
"functionTimeout": "00:09:55"
}
Visual Studio Code might not recognize stuff but things should still run if you have use one of these.
This took me hours to understand as well. This source code helped me understand the map between extensionBundle.version property in root host.json and "Extensions 5.x+" in the Azure Function Service Bus host.json settings (as referenced in the "host.json settings" section).
extensionBundle.version property - this is a way Azure injects all of the Azure Function binding extensions at runtime for non-C# languages (no need to install NuGet packages since we are working in TypeScript, Python, etc. and not .NET). Also, reading this helped me understand the extensionBundle.version syntax.extensionBundle.version (e.g. 4.x)Back to the source code: this is the branch for the 4.x extension bundle release and it references a majorVersion: 5 for Microsoft.Azure.WebJobs.Extensions.ServiceBus extension (i.e. NuGet package).
My Visual Studio Code still says my Service Bus extension v5.x configuration is invalid but it works. I haven't figured how to fix Visual Studio Code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With