AsgiFastStream
faststream.asgi.app.AsgiFastStream #
AsgiFastStream(broker=None, /, asgi_routes=(), asyncapi_path=None, logger=logger, lifespan=None, title='FastStream', version='0.1.0', description='', terms_of_service=None, license=None, contact=None, tags=None, external_docs=None, identifier=None, on_startup=(), after_startup=(), on_shutdown=(), after_shutdown=())
Bases: FastStream
Source code in faststream/asgi/app.py
lifespan_context instance-attribute
#
lifespan_context = apply_types(func=lifespan, wrap_model=drop_response_type) if lifespan is not None else fake_context
set_broker #
Set already existed App object broker.
Useful then you create/init broker in on_startup
hook.
on_startup #
Add hook running BEFORE broker connected.
This hook also takes an extra CLI options as a kwargs.
Source code in faststream/app.py
on_shutdown #
Add hook running BEFORE broker disconnected.
after_startup #
Add hook running AFTER broker connected.
after_shutdown #
Add hook running AFTER broker disconnected.
run async
#
Run FastStream Application.
Source code in faststream/app.py
exit #
start async
#
Executes startup hooks and start broker.
Source code in faststream/app.py
stop async
#
Executes shutdown hooks and stop broker.
Source code in faststream/app.py
mount #
start_lifespan_context async
#
Source code in faststream/asgi/app.py
lifespan async
#
Handle ASGI lifespan messages to start and shutdown the app.