Retry Policy for Azure WebJob QueueTrigger

I would like my turn to repeat unsuccessful web clips every 90 minutes and only for 3 attempts.

When creating the queue, I use the following code

CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient(); IRetryPolicy linearRetryPolicy = new LinearRetry(TimeSpan.FromSeconds(5400), 3); queueClient.DefaultRequestOptions.RetryPolicy = linearRetryPolicy; triggerformqueue = queueClient.GetQueueReference("triggerformqueue"); triggerformqueue.CreateIfNotExists(); 

However, when simulating a failed web search attempt, the queue uses the default retry policy. I'm missing something.

+2
source share
3 answers

I think you could think about it back. Queues do not actually execute behavior. Instead, I assume that you want to do this web task, which is configured to output messages from the queue, and then, if it cannot process the message from the queue, for some reason it will retry the web operation after 90 minutes. In this case, you just need to set the invisibility timeout to 90 minutes (30 seconds by default), which ensures that if the message is not completely processed (that is, GetMessage and DeleteMessage are both called), then the message will reappear in line after 90 minutes.

Take a look at this Getting Started with Queue Repository for more information.

0
source

There is something like the Azure WebJobs SDK Extensions and ErrorTriggerAttribute (it is not yet available in the nuget 1.0.0-beta1 package, but you have access to the public repository)

public static void ErrorMonitor ([ErrorTrigger ("0:30:00", 10, Throttle = "1:00:00")] TraceFilter Filter, TextWriter Log)

https://github.com/Azure/azure-webjobs-sdk-extensions#errortrigger

0
source

You need to use RetryPolicy when you add an item to a queue, rather than a queue, for example.

 var queue = queueClient.GetQueueReference("myQueue"); queue.CreateIfNotExists(); options = new QueueRequestOptions { RetryPolicy = linearRetryPolicy }; await queue.AddMessageAsync(yourMessage, null, new TimeSpan(0, delayMinutes, 0), options, null); 
0
source

All Articles