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: Application
Source code in faststream/asgi/app.py
lifespan_context instance-attribute
#
lifespan_context = apply_types(
func=lifespan, wrap_model=drop_response_type
)
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/_internal/application.py
on_shutdown #
Add hook running BEFORE broker disconnected.
Source code in faststream/_internal/application.py
after_startup #
Add hook running AFTER broker connected.
Source code in faststream/_internal/application.py
after_shutdown #
Add hook running AFTER broker disconnected.
Source code in faststream/_internal/application.py
exit #
start async
#
Executes startup hooks and start broker.
Source code in faststream/_internal/application.py
stop async
#
Executes shutdown hooks and stop broker.
Source code in faststream/_internal/application.py
from_app classmethod
#
Source code in faststream/asgi/app.py
mount #
run async
#
run(log_level=INFO, run_extra_options=None, sleep_time=0.1)
Source code in faststream/asgi/app.py
start_lifespan_context async
#
Source code in faststream/asgi/app.py
lifespan async
#
Handle ASGI lifespan messages to start and shutdown the app.