Skip to content

FastStream

  • Start here: Request handlers and the ambient scope
  • Common recipes: micro.install(app) opens the app on startup and binds the active app inside subscriber handlers, so patterns resolve their backends ambiently without explicit backend= wiring.

grelmicro.integrations.faststream

FastStream integration that opens a Grelmicro app and binds it per message.

install

install(
    app: FastStream,
    micro: Grelmicro,
    *,
    ambient: bool = True,
) -> None

Wire micro into a FastStream app.

Opens async with micro: on app startup and closes it after shutdown, so the components are registered before any message is handled. When ambient is True, registers a broker middleware so patterns resolve through Grelmicro.current() inside subscriber handlers.

Prefer the polymorphic micro.install(app), which detects the framework and calls this for you.

PARAMETER DESCRIPTION
app

The FastStream application to wire.

TYPE: FastStream

micro

The Grelmicro app to open on startup and bind per message.

TYPE: Grelmicro

ambient

Register a broker middleware so patterns resolve ambiently inside subscriber handlers. Default True. Pass False to skip it.

TYPE: bool DEFAULT: True