Skip to content

TopicPartition

faststream.confluent.TopicPartition #

TopicPartition(topic, partition=-1, offset=-1001, metadata=None, leader_epoch=None)
Source code in faststream/confluent/schemas/partition.py
def __init__(
    self,
    topic: str,
    partition: int = -1,
    offset: int = -1001,
    metadata: Optional[str] = None,
    leader_epoch: Optional[int] = None,
) -> None:
    self.topic = topic
    self.partition = partition
    self.offset = offset
    self.metadata = metadata
    self.leader_epoch = leader_epoch

topic instance-attribute #

topic = topic

partition instance-attribute #

partition = partition

offset instance-attribute #

offset = offset

metadata instance-attribute #

metadata = metadata

leader_epoch instance-attribute #

leader_epoch = leader_epoch

to_confluent #

to_confluent()
Source code in faststream/confluent/schemas/partition.py
def to_confluent(self) -> ConfluentPartition:
    kwargs: _TopicKwargs = {
        "topic": self.topic,
        "partition": self.partition,
        "offset": self.offset,
    }
    if self.metadata is not None:
        kwargs["metadata"] = self.metadata
    if self.leader_epoch is not None:
        kwargs["leader_epoch"] = self.leader_epoch
    return ConfluentPartition(**kwargs)