Skip to content

SqlServerOptions

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

SQL Server Options

NuGet package: DotNetWorkQueue.Transport.SqlServer

Options class: SqlServerMessageQueueTransportOptions

Namespace: DotNetWorkQueue.Transport.SqlServer.Basic

Time source

The SQL Server transport gets its time from GetUTCDate() on the server. No configuration needed. The server clock is always used for delayed processing, expiration, and heartbeat timestamps, so multiple app instances stay in sync.

Queue creation options

All feature flags below are set at queue creation time via the creation class and cannot be changed after the queue exists. See SqlServerQueueCreationOptions for usage examples.

Property Type Default Notes
EnablePriority bool false Adds a priority column; higher-priority messages dequeue first
EnableStatus bool true Required when EnableHeartBeat is true
EnableHeartBeat bool true Must be false when EnableHoldTransactionUntilMessageCommitted is true
EnableDelayedProcessing bool false Required for retry delays
EnableStatusTable bool false Auto-set to true if AdditionalColumns are present
EnableRoute bool false Tag messages with a route string for selective consumption
EnableMessageExpiration bool false RPC queues force this to true
EnableHoldTransactionUntilMessageCommitted bool false Forces EnableHeartBeat and EnableStatus to false
EnableHistory bool false Creates a history table for message lifecycle tracking
QueueType QueueTypes Normal Normal, RpcSend, or RpcReceive
AdditionalColumns ColumnList empty Custom columns on the status or metadata table
AdditionalConstraints ConstraintList empty Custom indexes on user columns
AdditionalColumnsOnMetaData bool false If true, user columns go on the metadata table instead of the status table

When EnableHistory is true, the HistoryOptions property (type HistoryTransportOptions) controls retention:

Property Type Default
RetentionDays int 30
MaxExceptionLength int 4000
StoreBody bool false
TrackEnqueue bool true
TrackProcessing bool true
TrackComplete bool true
TrackError bool true
TrackDelete bool true
TrackExpire bool true
MonitorTime TimeSpan 1 day
Validation rules

The options class runs ValidConfiguration() before creating the queue. The following constraints are enforced:

  • EnableHoldTransactionUntilMessageCommitted = true requires EnableHeartBeat = false and EnableStatus = false
  • EnableHeartBeat = true requires EnableStatus = true

See MessageHistory for details on history tracking behavior.

Clone this wiki locally