FastStream
faststream.app.FastStream #
FastStream(
broker=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
A class representing a FastStream application.
Source code in faststream/_internal/application.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
run async
#
run(log_level=INFO, run_extra_options=None, sleep_time=0.1)
Run FastStream Application.