Skip to content

Exchange

faststream.specification.schema.bindings.amqp.Exchange dataclass #

Exchange(
    type: Literal[
        "default",
        "direct",
        "topic",
        "fanout",
        "headers",
        "x-delayed-message",
        "x-consistent-hash",
        "x-modulus-hash",
    ],
    name: str | None = None,
    durable: bool | None = None,
    auto_delete: bool | None = None,
)

type instance-attribute #

type: Literal[
    "default",
    "direct",
    "topic",
    "fanout",
    "headers",
    "x-delayed-message",
    "x-consistent-hash",
    "x-modulus-hash",
]

name class-attribute instance-attribute #

name: str | None = None

durable class-attribute instance-attribute #

durable: bool | None = None

auto_delete class-attribute instance-attribute #

auto_delete: bool | None = None

is_respect_routing_key property #

is_respect_routing_key: bool

Is exchange respects routing key or not.

from_exchange classmethod #

from_exchange(exchange: RabbitExchange) -> Exchange
Source code in faststream/specification/schema/bindings/amqp.py
@classmethod
def from_exchange(cls, exchange: "RabbitExchange") -> "Exchange":
    if not exchange.name:
        return cls(type="default")
    return cls(
        type=exchange.type.value,
        name=exchange.name,
        durable=exchange.durable,
        auto_delete=exchange.auto_delete,
    )