This document is for Kombu's development version, which can be significantly different from previous releases. Get the stable docs here: 5.0.
虚拟AMQ交换实施- kombu.transport.virtual.exchange
¶
虚拟AMQ交换。
由AMQ协议定义的标准交换的实现(不包括 headers 交易所)。
直接¶
主题¶
- class kombu.transport.virtual.exchange.TopicExchange(channel)[源代码]¶
话题交流。
这个 topic Exchange使用通配符根据由点分隔的单词来路由消息
*
(任何单个单词),以及#
(一个或多个单词)。- lookup(table, exchange, routing_key, default)[源代码]¶
查找所有匹配的队列 routing_key 在……里面 exchange 。
- 返回:
str
- 返回类型:
queue name, or 'default' if no queues matched.
- prepare_bind(queue, exchange, routing_key, arguments)[源代码]¶
准备队列绑定。
- 返回:
Tuple[str, Pattern, str] --为绑定到此交换而存储。
- 返回类型:
的 (routing_key, regex, queue)
- type = 'topic'¶
- wildcards = {'#': '.*?', '*': '.*?[^\\.]'}¶
通配符到正则表达式转换的映射
扇出¶
- class kombu.transport.virtual.exchange.FanoutExchange(channel)[源代码]¶
扇出交易所。
这个 fanout Exchange通过将所有邮件的副本传递到绑定到Exchange的所有队列来实现广播消息传递。
为了支持扇出,虚拟通道需要将表存储为共享状态。这就要求 Channel.supports_fanout 属性设置为True,并且 Channel._queue_bind 和 Channel.get_table 方法被实现。
- lookup(table, exchange, routing_key, default)[源代码]¶
查找所有匹配的队列 routing_key 在……里面 exchange 。
- 返回:
str
- 返回类型:
queue name, or 'default' if no queues matched.
- type = 'fanout'¶
接口¶
- class kombu.transport.virtual.exchange.ExchangeType(channel)[源代码]¶
用于交换的基类。
实现交换类型的细节。
论点:¶
Channel(Channel):AMQ Channel。
- equivalent(prev, exchange, type, durable, auto_delete, arguments)[源代码]¶
如果满足以下条件,则返回True prev 和 exchange 是等同的。
- lookup(table, exchange, routing_key, default)[源代码]¶
查找所有匹配的队列 routing_key 在……里面 exchange 。
- 返回:
str
- 返回类型:
queue name, or 'default' if no queues matched.
- prepare_bind(queue, exchange, routing_key, arguments)[源代码]¶
准备队列绑定。
- 返回:
Tuple[str, Pattern, str] --为绑定到此交换而存储。
- 返回类型:
的 (routing_key, regex, queue)
- type = None¶