-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add Context initial section (#1089)
* docs: add Context initial examples * docs: add orjson mention * chore: bump version * ruff format replaced with black --------- Co-authored-by: Davor Runje <[email protected]>
- Loading branch information
1 parent
1e5f52e
commit 8ab9d30
Showing
32 changed files
with
402 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from faststream import Context | ||
from faststream.kafka import KafkaBroker | ||
|
||
broker = KafkaBroker() | ||
|
||
@broker.subscriber("test-topic") | ||
async def handle( | ||
msg: str, | ||
collector: list[str] = Context(initial=list), | ||
): | ||
collector.append(msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from faststream import Context | ||
from faststream.nats import NatsBroker | ||
|
||
broker = NatsBroker() | ||
|
||
@broker.subscriber("test-subject") | ||
async def handle( | ||
msg: str, | ||
collector: list[str] = Context(initial=list), | ||
): | ||
collector.append(msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from faststream import Context | ||
from faststream.rabbit import RabbitBroker | ||
|
||
broker = RabbitBroker() | ||
|
||
@broker.subscriber("test-queue") | ||
async def handle( | ||
msg: str, | ||
collector: list[str] = Context(initial=list), | ||
): | ||
collector.append(msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from faststream import Context | ||
from faststream.redis import RedisBroker | ||
|
||
broker = RedisBroker() | ||
|
||
@broker.subscriber("test-channel") | ||
async def handle( | ||
msg: str, | ||
collector: list[str] = Context(initial=list), | ||
): | ||
collector.append(msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
=== "Kafka" | ||
```python linenums="1" hl_lines="4 6" | ||
{!> docs_src/getting_started/context/kafka/initial.py [ln:6-11] !} | ||
``` | ||
|
||
=== "RabbitMQ" | ||
```python linenums="1" hl_lines="4 6" | ||
{!> docs_src/getting_started/context/rabbit/initial.py [ln:6-11] !} | ||
``` | ||
|
||
=== "NATS" | ||
```python linenums="1" hl_lines="4 6" | ||
{!> docs_src/getting_started/context/nats/initial.py [ln:6-11] !} | ||
``` | ||
|
||
=== "Redis" | ||
```python linenums="1" hl_lines="4 6" | ||
{!> docs_src/getting_started/context/redis/initial.py [ln:6-11] !} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.