Skip to content

RedisOptions

blehnen edited this page Nov 10, 2026 · 6 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. Redis does not need a queue creation step. 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 properties set how many items one LUA script execution processes 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

This setting controls how often the transport checks for delayed messages that are ready to process. Lower values reduce latency. Higher values reduce the load on Redis.

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

The default is TimeSpan.FromSeconds(1).

Time source

The Redis transport can get the current time in several ways. 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

This setting 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