本文整理汇总了Python中kombu.Exchange.revive方法的典型用法代码示例。如果您正苦于以下问题:Python Exchange.revive方法的具体用法?Python Exchange.revive怎么用?Python Exchange.revive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kombu.Exchange
的用法示例。
在下文中一共展示了Exchange.revive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_revive
# 需要导入模块: from kombu import Exchange [as 别名]
# 或者: from kombu.Exchange import revive [as 别名]
def test_revive(self):
exchange = Exchange('foo', 'direct')
conn = get_conn()
chan = conn.channel()
# reviving unbound channel is a noop.
exchange.revive(chan)
self.assertFalse(exchange.is_bound)
self.assertIsNone(exchange._channel)
bound = exchange.bind(chan)
self.assertTrue(bound.is_bound)
self.assertIs(bound.channel, chan)
chan2 = conn.channel()
bound.revive(chan2)
self.assertTrue(bound.is_bound)
self.assertIs(bound._channel, chan2)
示例2: test_revive
# 需要导入模块: from kombu import Exchange [as 别名]
# 或者: from kombu.Exchange import revive [as 别名]
def test_revive(self):
exchange = Exchange('foo', 'direct')
conn = get_conn()
chan = conn.channel()
# reviving unbound channel is a noop.
exchange.revive(chan)
assert not exchange.is_bound
assert exchange._channel is None
bound = exchange.bind(chan)
assert bound.is_bound
assert bound.channel is chan
chan2 = conn.channel()
bound.revive(chan2)
assert bound.is_bound
assert bound._channel is chan2