I have azure webjob setup using next code:
Program.cs:
public class Program {
static void Main(){
JobHostConfiguration config = new JobHostConfiguration();
config.Tracing.ConsoleLevel = TraceLevel.Verbose;
config.Queues.BatchSize = 1;
config.UseTimers();
config.Queues.MaxDequeueCount = 1;
config.Queues.MaxPollingInterval = TimeSpan.FromSeconds(3);
ServiceBusConfiguration sbConfig = new ServiceBusConfiguration();
sbConfig.MessageOptions = new OnMessageOptions
{
MaxConcurrentCalls = 5,
AutoRenewTimeout = TimeSpan.FromMinutes(10),
AutoComplete = true
};
config.UseServiceBus(sbConfig);
config.NameResolver = new QueueNameResolver();
var host = new JobHost(config);
host.RunAndBlock();
}
public class QueueNameResolver : INameResolver
{
public string Resolve(string name)
{
return ConfigurationManager.AppSettings[name];
}
}
}
Functions.cs
public static void ProcessQueueMessage([ServiceBusTrigger("%WebjobIncomingQueueName%")] ProcessingInfo processingInfo, TextWriter webjobTextWriter){
webjobTextWriter.WriteLine("Service Bus trigger started");
//long running task simulation
Thread.Sleep(400000);
}
App.config file queue name configuration section:
<appSettings>
<add key="WebjobIncomingQueueName" value="webjob-test" />
</appSettings>
ProcessingInfo class:
public class ProcessingInfo {
public long ID { get; set; }
}
The problem here is that for the same message from webjob-test
queue ProcessQueueMessage
is triggered each minute after the first occurrence. According to answer here this should be easily configured using OnMessageOptions.AutoRenewTimeout
, however it doesn't seems to be working. Can someone please help with this issue?