Skip to content

OutboxRouter does not forward routers to the inner broker #158

Description

@lesnik512

What

OutboxRouter.__init__ (faststream_outbox/fastapi/router.py) mirrors most of
OutboxBroker.__init__'s kwargs and forwards them through StreamRouter's
**connection_kwars, but routers is not among them. OutboxBroker(..., routers=[...]) works;
OutboxRouter(..., routers=[...]) is a TypeError.

dlq_table and metrics_recorder were the other two gaps here and were forwarded in #88, which
left routers as the only unforwarded OutboxBroker argument.

Why it is still open

Unlike dlq_table / metrics_recorder, this is not mechanical. OutboxRouter is itself a
StreamRouter, so app.include_router(router) already contributes the router's own subscribers via
the FastAPI lifespan. A separate routers sequence would introduce a second, differently-timed
source of subscribers into the same broker, and its behaviour is unsettled on two axes:

  • Start / lifespan — when do the nested routers' subscribers start relative to the FastAPI
    lifespan, and what happens if the app never includes the outer router?
  • AsyncAPI — how the nested routers' channels and operations compose into the document the
    router serves at schema_url (default /asyncapi).

Forwarding the kwarg without settling those would ship whichever behaviour falls out of
StreamRouter's ordering, which is not obviously the one a user would expect.

Workaround

Register subscribers directly on the OutboxRouter@router.subscriber(\"queue\") — rather than
composing sub-routers under it. Nothing is unreachable today.

Revisit trigger

A concrete "include a sub-router under the FastAPI outbox router" demand from someone hitting it,
rather than a hypothesised one. That report is also what would pin down the expected lifespan and
AsyncAPI semantics, which is the part currently missing.

Context

Carried over from planning/deferred.md, retired when the repo adopted the PR-body-as-spec
convention. Originally surfaced as F8-01 in the 2026-06-14 pass-3 audit, which confirmed the
dlq_table / metrics_recorder half was mechanically forwardable and flagged routers as the part
warranting a design call.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-triageMaintainer needs to evaluate this issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions