There was an error while loading. Please reload this page.
1 parent 21cde5e commit 02ce945Copy full SHA for 02ce945
1 file changed
docs/docs/en/getting-started/context.md
@@ -94,15 +94,15 @@ app = FastStream(context=context)
94
It is important to keep in mind that the broker context takes precedence over the FastStream context.
95
96
```python
97
- from faststream import FastStream
98
- from faststream.context import ContextRepo
+ from typing import Annotated
+ from faststream import FastStream, ContextRepo, Context
99
from faststream.nats import NatsBroker
100
101
broker = NatsBroker(context=ContextRepo({"data": "BROKER"}))
102
app = FastStream(broker, context=ContextRepo({"data": "APP"}))
103
104
@broker.subscriber("queue")
105
- async def handle(data = Context()) -> None:
+ async def handle(data: Annotated[str, Context()]) -> None:
106
assert data == "BROKER"
107
```
108
0 commit comments