Skip to content

ChannelBinding

faststream.specification.asyncapi.v2_6_0.schema.bindings.kafka.channel.ChannelBinding #

Bases: BaseModel

A class to represent a channel binding.

topic class-attribute instance-attribute #

topic: str | None = None

partitions class-attribute instance-attribute #

partitions: PositiveInt | None = None

replicas class-attribute instance-attribute #

replicas: PositiveInt | None = None

bindingVersion class-attribute instance-attribute #

bindingVersion: str = '0.4.0'

from_sub classmethod #

from_sub(binding: ChannelBinding | None) -> Self | None
Source code in faststream/specification/asyncapi/v2_6_0/schema/bindings/kafka/channel.py
@classmethod
def from_sub(cls, binding: kafka.ChannelBinding | None) -> Self | None:
    if binding is None:
        return None

    return cls(
        topic=binding.topic,
        partitions=binding.partitions,
        replicas=binding.replicas,
    )

from_pub classmethod #

from_pub(binding: ChannelBinding | None) -> Self | None
Source code in faststream/specification/asyncapi/v2_6_0/schema/bindings/kafka/channel.py
@classmethod
def from_pub(cls, binding: kafka.ChannelBinding | None) -> Self | None:
    if binding is None:
        return None

    return cls(
        topic=binding.topic,
        partitions=binding.partitions,
        replicas=binding.replicas,
    )