kombu.transport.virtual.exchange

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

copyright:
  1. 2009 - 2012 by Ask Solem.
license:

BSD, see LICENSE for more details.

Direct

class kombu.transport.virtual.exchange.DirectExchange(channel)

The direct exchange routes based on exact routing keys.

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

Topic

class kombu.transport.virtual.exchange.TopicExchange(channel)

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)
key_to_pattern(rkey)

Get the corresponding regex for any routing key.

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

map of wildcard to regex conversions

Fanout

class kombu.transport.virtual.exchange.FanoutExchange(channel)

The fanout exchange implements broadcast messaging by delivering copies of all messages to all queues bound the 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)
lookup(table, exchange, routing_key, default)
type = 'fanout'

Interface

class kombu.transport.virtual.exchange.ExchangeType(channel)

Implements the specifics for an exchange type.

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

Returns true if prev and exchange is equivalent.

lookup(table, exchange, routing_key, default)

Lookup all queues matching routing_key in exchange.

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

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

type = None

Table Of Contents

Previous topic

kombu.transport.virtual

Next topic

kombu.transport.virtual.scheduling

This Page