Skip to content

04 PLAN

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

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

  • PostGreTransport.md consumer code uses ILogger pattern (no Log.Log or DotNetWorkQueue.Logging.LogLevel)
  • PostGreTransport.md links to ConsumerMethod (not ConsumerLinq)
  • PostGreTransport.md includes one-liner link to MessageHistory
  • PostGreTransport.md links to samples repo
  • PostGreOptions.md documents ALL properties from PostgreSqlMessageQueueTransportOptions
  • PostGreQueueCreationOptions.md uses correct spelling EnableHoldTransactionUntilMessageCommitted (double t)
  • PostGreQueueCreationOptions.md documents EnableHistory with HistoryOptions files_touched:
  • PostGreTransport.md
  • PostGreOptions.md
  • PostGreQueueCreationOptions.md tdd: false

Plan 4 -- PostgreSQL Transport Family

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


Task 1: Update PostGreTransport.md with correct logging, features, and cross-references

Update `PostGreTransport.md` with these changes:
  1. Consumer HandleMessages method (lines 72-75): The current code already uses notifications.Log.LogDebug(...) which is correct MEL ILogger pattern. Verify this is retained.

  2. Feature list (lines 3-9): Add missing features. Current list says "User Defined metadata" and "Transactional or status based or FIFO with no rollback". 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:

    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:

    ###### Full samples
    
    See the [PostgreSQL samples](https://github.com/blehnen/DotNetWorkQueue.Samples/tree/main/Source/Samples/PostgreSQL) in the DotNetWorkQueue.Samples repository.

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

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

Task 2: Expand PostGreOptions.md with full property documentation

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

New content for PostGreOptions.md:

#### PostgreSQL Options

**NuGet package:** `DotNetWorkQueue.Transport.PostgreSQL`

**Options class:** `PostgreSqlMessageQueueTransportOptions`

**Namespace:** `DotNetWorkQueue.Transport.PostgreSQL.Basic`

##### Time source

The PostgreSQL transport gets its time from the PostgreSQL server, not the application host. If you have consumers on multiple machines, they all agree on what time it is.

##### 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 [PostGreQueueCreationOptions](https://github.com/blehnen/DotNetWorkQueue/wiki/PostGreQueueCreationOptions) 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.

The PostgreSQL options class is structurally identical to SQL Server. The key difference is the time source (PostgreSQL server vs SQL Server GetUTCDate()).

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

Task 3: Fix PostGreQueueCreationOptions.md spelling, add EnableRoute, fix typos

Update `PostGreQueueCreationOptions.md` with these changes:
  1. EnableHoldTransactionUntilMessageCommitted spelling (line 43-46): The current page uses correct spelling in the code sample but the section heading says "commited" in prose (line 41: "Holding a transaction until the message is commited"). Fix the heading to "committed".

  2. EnableRoute: Add this missing option after the 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;
    
    
  3. EnableHistory section: The page already has an EnableHistory section (lines 97-103). Verify it exists and is correct.

  4. Cross-references: Add at the bottom of the page:

    See [PostGreOptions](https://github.com/blehnen/DotNetWorkQueue/wiki/PostGreOptions) 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.

Do NOT change: Code samples for Additional columns, Additional constraints, EnableDelayedProcessing, EnableHeartBeat, EnableMessageExpiration, EnablePriority, EnableStatus, Queue Type -- these are already correct.

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

Clone this wiki locally