Skip to content

02 PLAN

Brian Lehnen edited this page Apr 8, 2026 · 1 revision

phase: 03-transports plan: "2" wave: 2 dependencies: ["1"] must_haves:

  • SqlServerTransport.md consumer code uses ILogger pattern (no Log.Log or DotNetWorkQueue.Logging.LogLevel)
  • SqlServerTransport.md links to ConsumerMethod (not ConsumerLinq)
  • SqlServerTransport.md includes one-liner link to MessageHistory
  • SqlServerTransport.md links to samples repo
  • SqlServerOptions.md documents ALL properties from SqlServerMessageQueueTransportOptions
  • SqlServerQueueCreationOptions.md uses correct spelling EnableHoldTransactionUntilMessageCommitted (double t)
  • SqlServerQueueCreationOptions.md documents EnableHistory with HistoryOptions sub-properties
  • UserDequeueColumns.md notes transport-specific parameter types files_touched:
  • SqlServerTransport.md
  • SqlServerOptions.md
  • SqlServerQueueCreationOptions.md
  • UserDequeueColumns.md tdd: false

Plan 2 -- SQL Server Transport Family

Wave 2 -- Transport pages. Depends on Plan 1 (Transports overview). Can run in parallel with Plans 3-7.


Task 1: Update SqlServerTransport.md with correct logging and cross-references

Update `SqlServerTransport.md` with these changes:
  1. Consumer code sample (lines 71-74): Replace the HandleMessages method body. The current code already uses notifications.Log.LogDebug(...) which is the correct MEL ILogger pattern -- confirm this is retained. If the page still has any Log.Log(DotNetWorkQueue.Logging.LogLevel... pattern, replace it with notifications.Log.LogDebug(...).

  2. Feature list (lines 3-9): Add missing features to match source. Current list is missing "Routing" and "History tracking". Update to:

    • Delayed messages
    • Message expiration
    • Message priority
    • Routing
    • History tracking
    • User-defined metadata columns
    • Transactional, status-based, or FIFO processing
  3. Cross-references: Add after the consumer code sample, before the schema section:

    For more consumer patterns, see [ConsumerMethod](https://github.com/blehnen/DotNetWorkQueue/wiki/ConsumerMethod) and [ConsumerAsync](https://github.com/blehnen/DotNetWorkQueue/wiki/ConsumerAsync).
    
    If history tracking is enabled, see [MessageHistory](https://github.com/blehnen/DotNetWorkQueue/wiki/MessageHistory) for retention and query options.
  4. Samples link: Add at the bottom of the page:

    ###### Full samples
    
    See the [SQL Server samples](https://github.com/blehnen/DotNetWorkQueue.Samples/tree/main/Source/Samples/SQLServer) in the DotNetWorkQueue.Samples repository.
  5. Typo fix: Change "requries" to "requires" if present anywhere on the page.

Do NOT change: Queue creation code, producer code, schema section, connection string examples -- these are already correct.

grep -i "DotNetWorkQueue.Logging.LogLevel|Log.Log(|ConsumerLinq|requries" /mnt/f/git/dotnetworkqueue.wiki/SqlServerTransport.md; echo "exit: $?" grep returns no matches (exit code 1). SqlServerTransport.md contains links to ConsumerMethod, MessageHistory, and the samples repo. Feature list includes Routing and History tracking.

Task 2: Expand SqlServerOptions.md with full property documentation

Replace the content of `SqlServerOptions.md` with complete documentation of `SqlServerMessageQueueTransportOptions`. The current page is a stub with only time source and feature flags redirect.

New content for SqlServerOptions.md:

#### 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](https://github.com/blehnen/DotNetWorkQueue/wiki/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](https://github.com/blehnen/DotNetWorkQueue/wiki/MessageHistory) for details on history tracking behavior.

This replaces the 10-line stub with full property coverage from the source class.

grep -c "EnablePriority|EnableStatus|EnableHeartBeat|EnableHistory|HistoryOptions|RetentionDays|AdditionalColumns" /mnt/f/git/dotnetworkqueue.wiki/SqlServerOptions.md grep returns 7 or more matches. SqlServerOptions.md documents every property from SqlServerMessageQueueTransportOptions including HistoryTransportOptions sub-properties.

Task 3: Fix SqlServerQueueCreationOptions.md spelling and add missing options; update UserDequeueColumns.md

**SqlServerQueueCreationOptions.md changes:**
  1. Enable History section (currently lines ~43-47): The page already has an EnableHistory section with correct spelling. Verify it exists and is accurate. If not present, add it after EnableStatusTable with:

    - Enable History
    
    Enables message processing history tracking. When enabled, a record of processed messages is retained. Defaults to `false`.
    
    ```csharp
    createQueue.Options.EnableHistory = true;
    
    
  2. EnableHoldTransactionUntilMessageCommitted spelling: Verify the code sample on the page uses the correct double-t spelling EnableHoldTransactionUntilMessageCommitted. The current page (line 55) already has the correct spelling. Confirm no single-t variant Commited exists anywhere.

  3. EnableRoute: Add this missing option after EnablePriority section:

    - Enable Route
    
    Tag messages with a route string. Consumers can filter to process only messages with a specific route.
    
    ```csharp
    createQueue.Options.EnableRoute = true;
    
    
  4. Cross-reference: Add at the bottom of the page:

    See [SqlServerOptions](https://github.com/blehnen/DotNetWorkQueue/wiki/SqlServerOptions) for the complete property reference and validation rules.
    
    See [MessageHistory](https://github.com/blehnen/DotNetWorkQueue/wiki/MessageHistory) for history retention configuration.
    
    See [UserDequeueColumns](https://github.com/blehnen/DotNetWorkQueue/wiki/UserDequeueColumns) for using additional columns in dequeue queries.
  5. Typo fixes: Fix "seperate" to "separate" and "automaticly" to "automatically" in the EnableStatusTable section.

UserDequeueColumns.md changes:

The page already has transport-specific parameter type notes (lines 33-36). Verify these are present and correct:

  • SQL Server: Microsoft.Data.SqlClient.SqlParameter
  • PostgreSQL: Npgsql.NpgsqlParameter
  • SQLite: System.Data.SQLite.SQLiteParameter

If the note block is already present and accurate, no changes needed to UserDequeueColumns.md. The page was already updated in a prior phase.

grep -i "Commited[^d]|seperate|automaticly" /mnt/f/git/dotnetworkqueue.wiki/SqlServerQueueCreationOptions.md; echo "exit: $?" grep returns no matches (exit code 1). SqlServerQueueCreationOptions.md has correct double-t spelling, EnableHistory section, EnableRoute section, cross-reference links, and no typos.

Clone this wiki locally