QueueTrigger attribute visibility timeout

If I got a message from the queue using Azure.Storage.Queue

queue.GetMessage(TimeSpan.FromMinutes(20)); 

I can set the visibility timeout, however, when I try to use the Azure.WebJobs attributes (SDK 0.4.0-beta) to automatically bind the website to the queue

i.e.

 public static void ProcessQueueMessage([QueueTrigger("myqueue")] string message){ //do something with queue item } 

Is there a way to set the visibility timeout for an attribute? There seems to be no option in JobHostConfiguration (). Queues. If there is no way to override, will this be the standard 30 seconds?

+4
source share
2 answers

In the latest version v1.1.0, you can now control the visibility timeout by registering your own QueueProcessor instances with JobHostConfiguration.Queues.QueueProcessorFactory . This allows you to control advanced message processing behavior globally or in each queue / function.

For example, to set visibility for failed messages, you can override ReleaseMessageAsync as follows:

 protected override async Task ReleaseMessageAsync(CloudQueueMessage message, FunctionResult result, TimeSpan visibilityTimeout, CancellationToken cancellationToken) { // demonstrates how visibility timeout for failed messages can be customized // the logic here could implement exponential backoff, etc. visibilityTimeout = TimeSpan.FromSeconds(message.DequeueCount); await base.ReleaseMessageAsync(message, result, visibilityTimeout, cancellationToken); } 

More information can be found in the release notes here .

+5
source

I have the same question and have not yet found the answer. But, to answer part of your question, the default rental is 10 minutes.

Quote from Azure Website: β€œWhen the method ends, the queue message is deleted. If the method fails before completion, the queue message is not deleted, after the 10-minute lease expires, the message is freed to be picked up again and processed. This sequence will not be repeated indefinitely if the message always throws an exception. After 5 unsuccessful attempts to process the message, the message is moved to the queue named {queuename} -poison. The maximum number of attempts is configurable. "

Link: http://azure.microsoft.com/en-us/documentation/articles/websites-dotnet-webjobs-sdk-get-started/ Section: ContosoAdsWebJob - Functions.cs - Create a Thumbnail Method

Hope this helps!

+4
source

All Articles