Skip to content

Multi-tenant outbox and inbox #38

Closed
6 of 6 issues completed
Closed

Description

@thomhurst

Complete multi-tenant outbox/inbox support from design §6.6 using application-owned native store configuration.

Already shipped:

Remaining scope (native sibling deliverables #403, #404 and #405; #266 was closed as superseded):

  • Support authorized incoming tenant selection of application-owned scoped connections/DbContexts without replacing native Npgsql or EF configuration. Do not add a duplicate resolver facade.
  • Compose consumers without a fallback tenant: EntityFrameworkCoreConsumerExtensions currently resolves TContext through ConsumePipelineBuilder.Use in a temporary startup scope before an incoming tenant exists. Resolve/validate the selected context in the authorized delivery scope.
  • Keep durable tenant metadata consistent with the selected store and wire header; reject mismatches before durable work. Incoming identifiers require application authorization.
  • Add ITenantSource enumeration from an application-owned catalog of native Npgsql data sources and explicit store options. Reuse PostgreSQL direct/recovery dispatch, ordered lanes, lease coordination and cleanup per tenant store.
  • Enforce one bounded connection budget shared across dispatch, lease and maintenance activity; avoid an unbounded native pool or permanent worker per tenant. Preserve stored tenant headers and isolate each store's lanes/leases.

Acceptance criteria:

  • Real PostgreSQL tests across several databases and schemas prove automatic selection, overlapping message IDs, rollback, concurrent scope isolation and durable tenant/header consistency.
  • A regression composes a consumer with a native scoped resolver that rejects unset tenants; delivery restores and authorizes its tenant before resolving transaction/handler dependencies, including retries.
  • Dispatch tests cover ordered/unordered recovery, isolated leases, cleanup, contention and bounded connections. Added/removed/failed tenant stores, cancellation and shutdown do not leak permits or block unrelated tenants.
  • Inspect pinned native client facilities before building connection coordination; reuse existing Relayer dispatch and store configuration. Add performance coverage when required and update website documentation/status to the actual implemented boundary.

#266 is superseded by this parent. #403 owns scoped EF consumer composition, #404 durable tenant/store/header consistency, and #405 native catalog dispatch with a shared bounded connection budget. These are independent direct children, with no parent/one-child chain. #33 shipped in #161 and is not a blocker. The remaining work is claimable without an external gate. See docs/design.md §6.6 and docs/decisions.md.

Sub-issues

Sub-issues

6 of 6 Issues completed
Loading 6 sub-issues

Activity

  1. added
    phase-2: outbox
    area: outbox
    P3
    on Oct 31, 2026
  2. thomhurst commented on Nov 1, 2026

    @thomhurst
    OwnerAuthor

    Triage against origin/main bf3191f: The outbox packages still contain options only; tenant store resolution and dispatch are not implemented. Added native blocked-by dependencies on #33, matching the prerequisites already documented in this issue. Existing scope and acceptance criteria remain current.

  3. added
    in-progress
    on Nov 2, 2026
  4. thomhurst commented on Nov 2, 2026

    @thomhurst
    OwnerAuthor

    Split the remaining work into independently mergeable native sub-issues: #264 tenant scope/header propagation, #265 tenant-aware outbox/inbox store resolution, and #266 bounded tenant dispatch. #265 depends on #264; #266 depends on #265. Implementing #264 first; this parent remains open until all acceptance criteria, including several tenant databases, are delivered.

  5. removed
    in-progress
    on Nov 2, 2026
  6. thomhurst commented on Nov 2, 2026

    @thomhurst
    OwnerAuthor

    Audited all three children and their prerequisites. They are direct children of #38, with no deeper native sub-issue hierarchy to flatten. Removed the closed #33 dependency (shipped in #161). #264 already has PR #269; its older failed reconnect run matches #154, whose merged native fix still has no published package (all three NuGet indexes and GitHub releases end at 1.25.0). No unchanged CI run was retried.

    Native-first inspection showed that existing scoped EF factories and PostgreSQL transaction overloads already select application-owned stores. Removed #265's stale #264 dependency, claimed the independent selection/isolation work and opened draft #284. Its real PostgreSQL tests exercise three databases and three schemas, inbox identity isolation, rollback, concurrent scopes and native data-source ownership. The PR documents the existing APIs instead of adding a duplicate resolver facade.

    Also removed #266's #265 dependency: the narrowed tests/docs unit adds no production contract that dispatch must await. #266 now owns its native store catalog/source and shared dispatch/maintenance budget and is claimable immediately. Its original dispatch acceptance criteria remain.

    This parent stays open. It explicitly retains dynamic tenant-to-DbContext binding (including startup composition without a fallback tenant) and durable tenant/header consistency, plus bounded dynamic dispatch. #284 does not claim complete multi-tenancy.

  7. thomhurst commented on Nov 10, 2026

    @thomhurst
    OwnerAuthor

    #264/#265 are complete through merged #269/#284. Consolidated the sole remaining child #266 into this issue and closed it as superseded, preserving its native catalog, bounded dispatch/maintenance, isolation and failure acceptance criteria alongside this issue’s automatic scoped-store and durable tenant/header criteria. Main dfa340a still has no ITenantSource/shared tenant connection budget and still resolves EF context during startup composition; those remain implementation work.

  8. added
    in-progress
    on Nov 10, 2026
  9. removed
    in-progress
    on Nov 10, 2026
  10. thomhurst commented on Nov 10, 2026

    @thomhurst
    OwnerAuthor

    Audited origin/main 4e868b14cb1fcd1a6b24b1eb8bd48b71208bf33e: #264/#265 shipped in #269/#284, while #266 closed as superseded rather than implemented. EntityFrameworkCoreConsumerExtensions.Create still resolves TContext during startup; OutboxContext.Add accepts caller-supplied tenant metadata; PostgreSQL has no ITenantSource/shared tenant connection budget. The parent cannot close.

    Split the remaining independent deliverables into native sibling issues: #403 scoped EF consumer composition/validation/retries without a fallback tenant; #404 authorized store/header/durable metadata binding; #405 native tenant catalog dispatch with one shared bounded connection budget. Each preserves its real PostgreSQL, documentation and performance criteria. All are direct children of this parent, with no artificial dependency chain. Implementing #403 under its own lock; #38 remains open for the full acceptance criteria.

  11. added
    in-progress
    on Nov 10, 2026
  12. self-assigned this
    on Nov 10, 2026
  13. thomhurst commented on Nov 10, 2026

    @thomhurst
    OwnerAuthor

    Re-checked and claimed this parent, then audited its acceptance criteria against fresh origin/main bfda3d3. All six native children are closed. #266 was superseded, so its closure alone was not treated as implementation evidence; its dispatch scope shipped through #405 / #429.

    The parent is complete:

    Fresh validation on the audited main commit, in an isolated worktree:

    dotnet test --project tests/Relayer.Outbox.PostgreSql.Tests -c Release --treenode-filter '/*/*/(TenantStoreSelectionTests|OutboxTenantBindingTests|TenantDispatchTests)/*'
    Passed: 38; failed: 0; skipped: 0 (real PostgreSQL, .NET 10.0.403, Docker 29.9.2, macOS ARM64).
    

    The merged implementation PRs also record solution builds, broader PostgreSQL suites, website production builds and benchmark execution coverage. This parent audit changes no source or documentation and makes no new throughput claim. No remaining parent acceptance criterion requires implementation; closing as completed.

  14. removed
    in-progress
    on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3area: outboxphase-2: outbox

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions