Skip to content

get_routing_hash

faststream.rabbit.shared.schemas.get_routing_hash #

get_routing_hash(
    queue: RabbitQueue,
    exchange: Optional[RabbitExchange] = None,
) -> int

Calculate the routing hash for a RabbitMQ queue and exchange.

PARAMETER DESCRIPTION
queue

The RabbitMQ queue.

TYPE: RabbitQueue

exchange

The RabbitMQ exchange (optional).

TYPE: Optional[RabbitExchange] DEFAULT: None

RETURNS DESCRIPTION
int

The routing hash as an integer.

Note

The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)

Source code in faststream/rabbit/shared/schemas.py
def get_routing_hash(
    queue: RabbitQueue,
    exchange: Optional[RabbitExchange] = None,
) -> int:
    """Calculate the routing hash for a RabbitMQ queue and exchange.

    Args:
        queue: The RabbitMQ queue.
        exchange: The RabbitMQ exchange (optional).

    Returns:
        The routing hash as an integer.
    !!! note

        The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
    """
    return hash(queue) + hash(exchange or "")

Last update: 2023-11-13