Skip to content

Commit

Permalink
add partitions for subscribe method of router FastAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
spataphore1337 committed May 5, 2024
1 parent c7ff557 commit 2b51200
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion faststream/kafka/fastapi/fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
if TYPE_CHECKING:
from asyncio import AbstractEventLoop
from enum import Enum

from aiokafka import TopicPartition
from aiokafka.abc import AbstractTokenProvider, ConsumerRebalanceListener
from aiokafka.coordinator.assignors.abstract import AbstractPartitionAssignor
from fastapi import params
Expand Down Expand Up @@ -919,6 +919,12 @@ def subscriber(
Pattern to match available topics. You must provide either topics or pattern, but not both.
"""),
] = None,
partitions: Annotated[
Optional[Iterable["TopicPartition"]],
Doc("""
A topic and partition tuple. You can't use 'topics' and 'partitions' in the same time.
"""),
] = (),
# broker args
dependencies: Annotated[
Iterable["params.Depends"],
Expand Down Expand Up @@ -1401,6 +1407,12 @@ def subscriber(
Pattern to match available topics. You must provide either topics or pattern, but not both.
"""),
] = None,
partitions: Annotated[
Optional[Iterable["TopicPartition"]],
Doc("""
A topic and partition tuple. You can't use 'topics' and 'partitions' in the same time.
"""),
] = (),
# broker args
dependencies: Annotated[
Iterable["params.Depends"],
Expand Down Expand Up @@ -1883,6 +1895,12 @@ def subscriber(
Pattern to match available topics. You must provide either topics or pattern, but not both.
"""),
] = None,
partitions: Annotated[
Optional[Iterable["TopicPartition"]],
Doc("""
A topic and partition tuple. You can't use 'topics' and 'partitions' in the same time.
"""),
] = (),
# broker args
dependencies: Annotated[
Iterable["params.Depends"],
Expand Down Expand Up @@ -2368,6 +2386,12 @@ def subscriber(
Pattern to match available topics. You must provide either topics or pattern, but not both.
"""),
] = None,
partitions: Annotated[
Optional[Iterable["TopicPartition"]],
Doc("""
A topic and partition tuple. You can't use 'topics' and 'partitions' in the same time.
"""),
] = (),
# broker args
dependencies: Annotated[
Iterable["params.Depends"],
Expand Down Expand Up @@ -2575,6 +2599,7 @@ def subscriber(
batch_timeout_ms=batch_timeout_ms,
listener=listener,
pattern=pattern,
partitions=partitions,
# broker args
dependencies=dependencies,
parser=parser,
Expand Down

0 comments on commit 2b51200

Please sign in to comment.