kombu.transport.virtual.exchange

Implementations of the standard exchanges defined by the AMQ protocol (excluding the headers exchange).

Direct

class kombu.transport.virtual.exchange.DirectExchange(channel)[source]

The direct exchange routes based on exact routing keys.

deliver(message, exchange, routing_key, **kwargs)[source]
lookup(table, exchange, routing_key, default)[source]
type = 'direct'

Topic

class kombu.transport.virtual.exchange.TopicExchange(channel)[source]

The topic exchange routes messages based on words separated by dots, using wildcard characters * (any single word), and # (one or more words).

deliver(message, exchange, routing_key, **kwargs)[source]
key_to_pattern(rkey)[source]

Get the corresponding regex for any routing key.

lookup(table, exchange, routing_key, default)[source]
prepare_bind(queue, exchange, routing_key, arguments)[source]
type = 'topic'
wildcards = {'#': '.*?', '*': '.*?[^\\.]'}

map of wildcard to regex conversions

Fanout

class kombu.transport.virtual.exchange.FanoutExchange(channel)[source]

The fanout exchange implements broadcast messaging by delivering copies of all messages to all queues bound to the exchange.

To support fanout the virtual channel needs to store the table as shared state. This requires that the Channel.supports_fanout attribute is set to true, and the Channel._queue_bind and Channel.get_table methods are implemented. See the redis backend for an example implementation of these methods.

deliver(message, exchange, routing_key, **kwargs)[source]
lookup(table, exchange, routing_key, default)[source]
type = 'fanout'

Interface

class kombu.transport.virtual.exchange.ExchangeType(channel)[source]

Implements the specifics for an exchange type.

Parameters:channel – AMQ Channel
equivalent(prev, exchange, type, durable, auto_delete, arguments)[source]

Return true if prev and exchange is equivalent.

lookup(table, exchange, routing_key, default)[source]

Lookup all queues matching routing_key in exchange.

Returns:default if no queues matched.
prepare_bind(queue, exchange, routing_key, arguments)[source]

Return tuple of (routing_key, regex, queue) to be stored for bindings to this exchange.

type = None