Skip to content

RedisOptions

Brian Lehnen edited this page Apr 8, 2026 · 5 revisions

Redis Options

NuGet package: DotNetWorkQueue.Transport.Redis

Options class: RedisQueueTransportOptions

Namespace: DotNetWorkQueue.Transport.Redis.Basic

Always-on features

Unlike the relational transports, Redis features are always enabled. There is no queue creation step required -- queues are created on demand.

Feature Value Notes
EnablePriority always true
EnableStatus always true
EnableHeartBeat always true
EnableDelayedProcessing always true
EnableStatusTable always true
EnableRoute always true
EnableMessageExpiration always true
EnableHistory false (settable) Opt-in history tracking

When EnableHistory is set to true, the HistoryOptions property (type HistoryTransportOptions) controls retention. See MessageHistory for the full list of history options.

Batch processing limits

These control how many items are processed per LUA script execution on the Redis server.

Property Type Default Description
ClearExpiredMessagesBatchLimit int 50 Expired messages removed per batch
ClearErrorMessagesBatchLimit int 50 Error messages removed per batch
MoveDelayedMessagesBatchLimit int 50 Delayed messages promoted per batch
ResetHeartBeatBatchLimit int 50 Dead messages recovered per batch
queue.Configuration.Options().ClearExpiredMessagesBatchLimit = 10;
queue.Configuration.Options().ClearErrorMessagesBatchLimit = 10;
queue.Configuration.Options().MoveDelayedMessagesBatchLimit = 10;
queue.Configuration.Options().ResetHeartBeatBatchLimit = 10;
Delayed processing monitor

Controls how frequently the transport checks for delayed messages that are ready to process. Lower values reduce latency; higher values reduce Redis load.

queue.Configuration.Options().DelayedProcessingConfiguration.MonitorTime = TimeSpan.FromSeconds(1);

The default is TimeSpan.FromSeconds(1).

Time source

The Redis transport supports multiple ways to obtain the current time. All time-dependent operations (delayed processing, expiration, heartbeat) use the configured time source.

TimeServer value Description
TimeLocations.LocalMachine (default) Uses the local system clock. Only safe if all machines have synchronized clocks.
TimeLocations.RedisServer Uses the Redis server clock. In a cluster, all nodes should be time-synced.
TimeLocations.SntpServer Uses an NTP server. Slowest but safest when clock sync is not guaranteed.
TimeLocations.Custom User-supplied time provider.
queue.Configuration.Options().TimeServer = TimeLocations.SntpServer;
SNTP configuration

When TimeServer is set to SntpServer, these properties configure the NTP client:

Property Type Default
Server string "pool.ntp.org"
Port int 123
TimeOut TimeSpan 8 seconds
queue.Configuration.Options().SntpTimeConfiguration.Server = "time.google.com";
queue.Configuration.Options().SntpTimeConfiguration.Port = 123;
Message ID generation

Controls how message IDs are generated.

MessageIdLocation value Description
MessageIdLocations.RedisIncr (default) Uses Redis INCR for sequential IDs
MessageIdLocations.Uuid Uses client-generated UUIDs
MessageIdLocations.Custom User-supplied ID generator
queue.Configuration.Options().MessageIdLocation = MessageIdLocations.Uuid;

See also: RedisPoisonMessages for custom poison message handling.

Clone this wiki locally