Repository navigation
Description
Some work must survive a crash but never needs to leave the service: a follow-up step after a commit, a retry-until-done cleanup, a fan-out to handlers in the same process. The in-memory transport loses this work when the process stops, and routing it through a broker adds an entity, a round trip and a failure mode for a message with one producer and one consumer in the same deployment.
The PostgreSQL outbox already provides durable rows, fenced claims, lane leases, scheduling and leased recovery. Poison handling shipped in #413 (closing #34); reuse its fenced transitions and key barriers rather than adding a second poison-row protocol.
Proposal
A named transport whose destination is a local handler and whose queue is the outbox database:
- Sending enlists in the business transaction exactly like any outbox send.
- "Dispatch" invokes the consume pipeline in-process instead of a native broker send, with the same failure pipeline, retry, delay and dead-letter behavior as any consumer.
- Ordered routes use lanes; unordered routes use commit-triggered direct dispatch with leased recovery.
- Completion deletes the row in the same transaction as the handler's work where the handler uses the same database, so the work is effectively exactly-once there.
Before building, check D1 and D42: this adds a queue Relayer implements itself rather than wraps. Record a decision naming why a native database queue feature is not used, or scope this to reuse one.
Acceptance criteria
- A recorded decision in
docs/decisions.mdcovering the D1/D42 question. - Passes the transport conformance suite, with the capabilities it does not have declared and rejected at startup (D14, D24).
- Real-PostgreSQL tests: work enqueued in a transaction that rolls back never runs; work survives a process kill and runs once on another instance; a poison item is dead-lettered without blocking others.
- Performance coverage for per-message work, and a site guide stating when to use this instead of a broker.
Delivery
Native sub-issues preserve the full scope: #458 supplies native-transaction fenced completion and the database-queue decision; #459 depends on it and delivers the named transport, consume integration, conformance/crash tests, performance coverage and usage guide. The durable local transport remains planned until #459 ships.
Activity
thomhurst commentedon Nov 10, 2026
Rechecked against origin/main at 54c9168. Poison handling is not implemented there yet: PostgreSqlOutboxStore.RecordFailureAsync increments attempts and releases the claim, and the roadmap explicitly marks poison handling planned. Added the native blocked_by dependency on #34 and corrected the premise above. Reuse its fenced poison transitions, parked-key barriers and dead-letter manager rather than introducing a competing queue failure protocol.
Followed the blocker to PR #413 under its own lock. Its reviewed head 14f9f4f has clear current-head Claude and Codex verdicts, no review threads or outstanding findings, and is already ready with auto-merge armed. Required CI run 42757509890 is still running. No retry, extra review request or competing implementation is appropriate; return to this issue when #34 closes.
Implementation follow-up must carry row identity and the fencing token into the consume transaction: existing dispatchers invoke ITransport.SendAsync and delete rows separately after success, so simply invoking a local handler from SendAsync cannot provide atomic business-work/row completion. D1/D42 still require a recorded database-queue decision before implementing that path.
thomhurst commentedon Nov 10, 2026
The earlier blocker is resolved: #413 merged, #34 closed, and run 42757509890 succeeded. Rechecked current main ab4329c: no durable local transport exists and no open PR delivers it.
Split the independent store and transport deliverables into native sub-issues #458 and #459; #459 depends on #458. The parent acceptance criteria remain unchanged. Implementing #458 first: the existing dispatchers delete after ITransport.SendAsync on a separate boundary, so atomic handler completion needs an explicit native transaction primitive before a local transport can safely integrate. The transport/conformance/process-kill/performance/usage-guide scope is preserved in #459. PostgreSQL LISTEN/NOTIFY source explicitly discards notifications on reboot; it cannot replace durable outbox rows. The first PR records the D1/D42 exception and keeps the transport planned.
thomhurst commentedon Nov 10, 2026
Rechecked every parent acceptance criterion against
origin/mainat 91472ae, rather than closing solely because its two native children are closed. The earlier blocker is resolved: #413 merged as 8669f40, #34 is closed, and run 42757509890 completed successfully.All parent deliverables are on main:
PostgreSqlLocal, registration, shared consume/failure pipelines and direct/recovery/ordered dispatch. Both commits are ancestors of the audited main.PostgreSqlLocalTransportdeclares capabilities;PostgreSqlLocalBuilderExtensionsrejects unsupported envelopes/batch handlers at startup.LocalTransportConformanceTestsexercises the shared conformance suite and explicitly verifies capability skips for unsupported native retry/dead-letter/delay controls.LocalTransportTests.Enqueue_rollback_never_invokes_the_consumer,Killed_consumer_rolls_back_business_work_and_another_process_completes_once(an actual killed process followed by a fresh process), andFailed_business_changes_roll_back_and_poison_does_not_block_other_keys(ordered and unordered) cover the requested rollback, crash recovery and poison isolation. Atomic business completion and lost-fence rollback have separate tests.PostgreSqlLocalTransportBenchmarkshas[MemoryDiagnoser], a native completion baseline and local-consume cases with metrics enabled/disabled. The PostgreSQL durable local transport guide states when to use it instead of a broker, transaction requirements, capability limits and at-least-once external effects. Sidebar, roadmap and home-page status are updated.Validation evidence is in merged #460 and #467. #467's required CI run 42830288232 passed Build & Test, Documentation site and CI Passed. Its recorded focused validation covers real PostgreSQL, shared conformance, process-kill recovery, and benchmark smoke execution. No tests were rerun for this read-only acceptance audit. Benchmark smoke is coverage evidence, not a throughput/allocation budget claim; the existing high-concurrency pooling follow-up #469 remains independently tracked.
No parent implementation remains. The outdated Delivery paragraph's “planned until #459 ships” condition is now fulfilled. Unrelated stale poison-status wording found in older reference pages is recorded in #495. Closing #361 as delivered by #460 and #467.