Skip to content

docs: add Patterns page composing the outbox in a service#103

Merged
lesnik512 merged 6 commits into
mainfrom
docs/messaging-service-patterns
Jun 19, 2026
Merged

docs: add Patterns page composing the outbox in a service#103
lesnik512 merged 6 commits into
mainfrom
docs/messaging-service-patterns

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Summary

Adds a new Patterns docs section with one page,
docs/patterns/messaging-service.md, showing an anonymized chat /
notifications service that composes three outbox primitives end-to-end:

  • Transactional event relaypublish(queue=, session=) inside the use-case
    transaction beside domain writes; a subscriber relays the row to Kafka.
  • Fire-unless-cancelled timer — arm with timer_id + activate_in, disarm
    with cancel_timer on read; covers the at-most-one-live dedup, the
    lease-guarded cancel, and the inherent race window.
  • Testing the composed app — nested TestOutboxBroker + TestKafkaBroker,
    the sync-mode / run_loops=True distinction, and the real-engine
    validate_schema() caveat.

The existing tutorials teach one primitive at a time and the guides document each
feature abstractly; nothing showed the primitives composed in a real service.
This page fills that gap and cross-links the primitive guides for depth.

Why

Patterns are drawn from real production usage of faststream-outbox, presented
generically (a chat / notifications service — no private service named). Coverage
is the core trio only; hardening features (native relay, DLQ, observability) are
one-line "See also" links.

Verification

  • just docs-build (mkdocs build --strict) passes — all six cross-links resolve.
  • Every snippet keyed to the public API (OutboxBroker, OutboxRouter,
    make_outbox_table, TestOutboxBroker, publish / cancel_timer); a final
    whole-branch review verified each technical claim against source.

Notes

  • Planning bundle (design.md + plan.md) included under
    planning/changes/active/2026-06-19.01-messaging-service-patterns-doc/. On
    merge it should move to planning/changes/archive/ with status: shipped /
    pr: / outcome: filled, per the repo convention.

🤖 Generated with Claude Code

lesnik512 and others added 6 commits June 19, 2026 22:00
Design for docs/patterns/messaging-service.md — an anonymized chat /
notifications service composing three outbox primitives end-to-end
(transactional event relay, fire-unless-cancelled timer, testing the
composed app), wired with a real DI container.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address final-review minor findings: the type comment omitted "unread"
(used by the timer payload), and include_routers referenced a bare broker.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…class-scoped timer methods

- Use broker.include_router(ROUTER) to match the rest of the docs (both
  methods exist upstream; singular is the house convention).
- State the load-bearing invariant: producer, repository, and transaction
  must resolve the same request-scoped AsyncSession or atomicity breaks.
- Show arm/cancel_unread_timer under a `class OutboxEventProducer:`
  continuation instead of a `# inside ...` comment over module-scope defs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…103)

Move the bundle active/ → archive/, set status: shipped + pr: 103 +
outcome on design.md and plan.md, and add the Index line under Archived.
No architecture/ promotion — docs-only change, no new invariant.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lesnik512 lesnik512 merged commit 86bd4e9 into main Jun 19, 2026
3 checks passed
@lesnik512 lesnik512 deleted the docs/messaging-service-patterns branch June 19, 2026 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant