Skip to content

Added Fastapi Lifespan to docs #589

Open
Shaxzodbek16 wants to merge 2 commits intotaskiq-python:masterfrom
Shaxzodbek16:master
Open

Added Fastapi Lifespan to docs #589
Shaxzodbek16 wants to merge 2 commits intotaskiq-python:masterfrom
Shaxzodbek16:master

Conversation

@Shaxzodbek16
Copy link

This pull request updates the documentation for integrating Taskiq with FastAPI, focusing on how to properly manage broker startup and shutdown. The main improvement is the addition of a recommended approach using FastAPI's lifespan event, while also marking the older on_event method as deprecated.

Broker lifecycle management documentation:

  • Added a new "Lifespan (Recommended)" tab with example code showing how to use FastAPI's lifespan event for broker startup and shutdown, ensuring proper resource management.
  • Marked the on_event approach as deprecated and organized both methods into a tabbed interface for clarity. [1] [2]

Copilot AI review requested due to automatic review settings February 5, 2026 05:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates the FastAPI integration documentation to recommend the modern lifespan context manager approach for managing broker startup and shutdown, while retaining the older on_event method marked as deprecated.

Changes:

  • Added a new documentation section showing how to use FastAPI's lifespan event with asynccontextmanager for broker lifecycle management
  • Organized both the recommended lifespan approach and the deprecated on_event approach into a tabbed interface for easy comparison

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant