When using the ServiceBusTrigger
with Azure Functions to trigger the function to execute on new messages in a Service Bus Queue, their doesn't seem to be a way to auto renew the message timeout. Sure, you can always call the BrokeredMessage.RenewLock
method, but with Functions there appears to be no way to configure it to auto renew the message lock.
Is there a way anyone has found to configure an Azure Function to Auto Renew the BrokeredMessage lock while a Service Bus Queue message is being processed?
Yes, I know you can increase the default timeout on the Service Bus Queue, but the maximum configurable default timeout is 5 minutes; which can still be too short .
Thanks!
Here's an example of using the ServiceBusTrigger
attribute in C# when building an Azure Function like mentioned using Visual Studio. Notice, the ServiceBusTrigger
usage does not allow a Timeout Duration to be set, or an Auto Renew to be configured either.
[FunctionName("MyFunction1")]
public static async Task Run(
[ServiceBusTrigger("queuename", AccessRights.Listen, Connection = "AzureServiceBus")] BrokeredMessage sbCommand,
ILogger log)
{
// process message here
}
The functionTimeout in the host. json file can be configured using a timespan string format ranging from a minimum of 1 second ( 00:00:01 ), up to a maximum of 10 minutes ( 00:10:00 ) for Consumption Plan hosting and Unlimited ( -1 ) for Premium and Dedicated Plans .
Function app timeout duration Regardless of the function app timeout setting, 230 seconds is the maximum amount of time that an HTTP triggered function can take to respond to a request. This is because of the default idle timeout of Azure Load Balancer.
By default, Azure functions timeout after 10 minutes (or 30 minutes if running in an App Service Plan, or a Premium plan).
Azure Functions integrates with Azure Service Bus via triggers and bindings. Integrating with Service Bus allows you to build functions that react to and send queue or topic messages.
The function renews the message lock by itself. You don't need to renew the lock manually, it is handled by the run time of the function. Please refer this article.
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