Reputation: 6962
We have a need to process messages from an Azure Storage Queue serially, one at a time.
By default, the JobHostConfiguration.Queues.BatchSize
is set to 16
And those 16 messages the WebJob pulls off the queue will be processed in parallel. Instead, we need the WebJob to process the messages serially, one at a time.
How can this be achieved?
We are currently forced to set the BatchSize
to 1, which is not ideal because it introduces a lot of spin up/down time around reading from the message queue.
Clarification: We do not need to enforce first in first out, or guaranteed order processing, just one at a time processing.
Upvotes: 1
Views: 1282
Reputation: 416
JobHostConfiguration config = new JobHostConfiguration();
config.Queues.BatchSize = 1;
config.Queues.MaxDequeueCount = 1;
config.Queues.MaxPollingInterval = TimeSpan.FromSeconds(5);
Set your BatchSize and MaxDequeueCount to 1, Set MaxPollingInterval to 5 seconds.
Upvotes: 2