Topic
faststream.confluent.Topic #
Topic(
name: str,
*,
num_partitions: int = 1,
replication_factor: int = 1,
declare: bool = True,
)
Bases: NameRequired
A Kafka topic with its creation settings.
Can be used instead of a plain topic name to configure the topic FastStream creates for you.
You can find information about all options in the official Kafka documentation:
https://kafka.apache.org/documentation/#topicconfigs
Initialize the Kafka topic.
| PARAMETER | DESCRIPTION |
|---|---|
name | Kafka topic name. TYPE: |
num_partitions | Number of partitions to create the topic with. TYPE: |
replication_factor | Replication factor to create the topic with. TYPE: |
declare | Whether to create the topic automatically or just connect to it. Missing topics are not created and their absence is not reported, so set it to TYPE: |
Source code in faststream/confluent/schemas/topic.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
validate classmethod #
validate(value: str | Self, **kwargs: Any) -> Self
validate(value: None, **kwargs: Any) -> None
validate(
value: str | Self | None, **kwargs: Any
) -> Self | None
Factory to create object.
Source code in faststream/_internal/proto.py
32 33 34 35 36 37 | |
add_prefix #
add_prefix(prefix: str) -> Topic
Source code in faststream/confluent/schemas/topic.py
77 78 79 80 81 82 83 | |
to_confluent #
to_confluent() -> NewTopic
Source code in faststream/confluent/schemas/topic.py
85 86 87 88 89 90 | |