Want to know how the azure function trigger will work when the messages are continuously being delivered to service bus topic. As far as i know, the azure functions gets triggered the moment topic receives the message. Under when batch & session is enabled, will function wait for specific period of time so that the topic gets multiple message and multiple messages can be delivered to azure functions.
The messaging with SDK might be delayed for some but will not require waiting for a specific period of time, unlike PeekLock. Multiple messages can be delivered with batching.
Batching:
Batching delivers a set number of messages to the function as a single batch, allowing for processing multiple messages in one invocation. When batching is enabled, it doesn't wait for a specific period to accumulate messages before delivering them to the function. The code for the Azure Service Bus trigger for Azure Functions is taken from DOC
{
"version": "2.0",
"extensions": {
"serviceBus": {
"clientRetryOptions": {
"mode": "exponential",
"tryTimeout": "00:01:00",
"delay": "00:00:10.90",
"maxDelay": "00:10:00",
"maxRetries": 3
},
"prefetchCount": 100, // Adjust as needed
"autoCompleteMessages": true,
"maxAutoLockRenewalDuration": "00:05:00",
"maxConcurrentCalls": 16,
"maxMessageBatchSize": 1000,
"minMessageBatchSize": 1,
"maxBatchWaitTime": "00:00:30"
}
}
}
Sessions enable joint and ordered handling of unbounded sequences of related messages. Sessions can be used in first in, first out (FIFO) and request-response patterns. Enabling sessions in your Service Bus queue or topic doesn't change the triggering mechanism for batching.