Skip to content

Commit

Permalink
make partitions public attr
Browse files Browse the repository at this point in the history
  • Loading branch information
spataphore1337 committed May 5, 2024
1 parent 87e0662 commit 8a4a562
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions faststream/kafka/subscriber/usecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __init__(
self.client_id = ""
self.__pattern = pattern
self.__listener = listener
self.__partitions = partitions
self.partitions = partitions
self.__connection_args: "ConsumerConnectionParams" = {}

@override
Expand Down Expand Up @@ -142,16 +142,16 @@ async def start(self) -> None:
client_id=self.client_id,
**self.__connection_args,
)
if self.topics and self.__partitions:
if self.topics and self.partitions:
raise SetupError("You can't use 'topics' and 'partitions' in the same time")
if self.topics:
consumer.subscribe(
topics=self.topics,
pattern=self.__pattern,
listener=self.__listener,
)
elif self.__partitions:
consumer.assign(partitions=self.__partitions)
elif self.partitions:
consumer.assign(partitions=self.partitions)
await consumer.start()
await super().start()

Expand Down

0 comments on commit 8a4a562

Please sign in to comment.