diff --git a/src/application/broker_init.py b/src/application/broker_init.py index 7cf749b..fa1b13b 100644 --- a/src/application/broker_init.py +++ b/src/application/broker_init.py @@ -4,7 +4,7 @@ from faststream.rabbit import RabbitBroker -def get_broker(broker: RabbitBroker): +def get_lifespan(broker: RabbitBroker): @asynccontextmanager async def lifespan(app: FastAPI): await broker.start() diff --git a/src/application/main.py b/src/application/main.py index 871c83e..9871b6a 100644 --- a/src/application/main.py +++ b/src/application/main.py @@ -11,7 +11,7 @@ ) from src.application.api.exception_handler import setup_exception_handlers from src.application.api.swagger import init_swagger_endpoints -from src.application.broker_init import get_broker +from src.application.broker_init import get_lifespan from src.application.config import Settings from src.application.di.di_builder import build_di from src.application.metrics_init import init_metrics @@ -59,7 +59,7 @@ async def main() -> None: """Main entry point.""" config = load_config(config_type_model=Settings) broker = RabbitBroker(**config.broker.model_dump(), logger=logger) # type: ignore - lifespan = get_broker(broker=broker) + lifespan = get_lifespan(broker=broker) configure_logger(logger_config=config.logging) app = init_app(app_config=config.app, lifespan=lifespan) build_di(app=app, config=config, broker=broker)