RequestDAG — Aquilia Documentation
Comprehensive guide and documentation for RequestDAG in the Aquilia framework. View API reference, examples, and implementation patterns.
Dependency Injection / RequestDAG RequestDAG & Inline Injection The RequestDAG resolves dependencies declared inline via Dep() in route signatures. It compiles a deduplicated, concurrent execution graph per request. Core Execution Mechanics , , , , ].map((card, i) => ( ))} Resolution Flow Consider a route handler with deeply nested dependencies: from typing import Annotated from aquilia.di import Dep async def get_db(): print("Opening DB") yield "DB_SESSION" print("Closing DB") async def get_user_repo(db: Annotated[str, Dep(get_db)]): print("Creating UserRepo") return async def get_auth_service(db: Annotated[str, Dep(get_db)]): print("Creating AuthService") return # In your controller class: class MyController(Controller): @get("/dashboard") async def dashboard_view( self, ctx, repo: Annotated[dict, Dep(get_user_repo)], auth: Annotated[dict, Dep(get_auth_service)], ): return Execution Output Trace: Opening DB // Executed only once due to deduplication! Creating UserRepo // Resolved concurrently Creating AuthService HTTP Response sent to client Closing DB // Teardown executed in LIFO order after response Decorators Extractors )
Go to Homepage