Skip to content

QueueDelayConfiguration

Brian Lehnen edited this page Nov 1, 2015 · 2 revisions

Queue Delay

For transports that require polling, you may not wish to constantly query them when there is no work to process. This can be configured via the queue delay settings.

This is controlled by a collection of timestamps on the transport configuration. When no record is found to process the worker will increment a count, and then pause for the length of time indicated by the time span. When a record is found, the delay index is reset back to 0.

The configuration has default delays, but you can change them.

queue.Configuration.TransportConfiguration.QueueDelayBehavior.Clear();
var list = new List<TimeSpan>
{
	TimeSpan.FromMilliseconds(500),
	TimeSpan.FromMilliseconds(500),
    TimeSpan.FromMilliseconds(500),
    TimeSpan.FromMilliseconds(500),
    TimeSpan.FromMilliseconds(1000),
    TimeSpan.FromMilliseconds(2000)
};
queue.Configuration.TransportConfiguration.QueueDelayBehavior.Add(list);
Clone this wiki locally