Skip to content

Exchange

faststream.specification.asyncapi.v2_6_0.schema.bindings.amqp.channel.Exchange #

Bases: BaseModel

A class to represent an exchange.

ATTRIBUTE DESCRIPTION
name

name of the exchange (optional)

type

type of the exchange, can be one of "default", "direct", "topic", "fanout", "headers"

durable

whether the exchange is durable (optional)

autoDelete

whether the exchange is automatically deleted (optional)

vhost

virtual host of the exchange, default is "/"

name class-attribute instance-attribute #

name = None

type instance-attribute #

type

durable class-attribute instance-attribute #

durable = None

autoDelete class-attribute instance-attribute #

autoDelete = None

vhost class-attribute instance-attribute #

vhost = '/'

from_spec classmethod #

from_spec(binding: None, vhost: str) -> None
from_spec(binding: Exchange, vhost: str) -> Self
from_spec(binding, vhost)
Source code in faststream/specification/asyncapi/v2_6_0/schema/bindings/amqp/channel.py
@classmethod
def from_spec(cls, binding: amqp.Exchange | None, vhost: str) -> Self | None:
    if binding is None:
        return None

    return cls(
        name=binding.name,
        type=binding.type,
        durable=binding.durable,
        autoDelete=binding.auto_delete,
        vhost=vhost,
    )