本文整理汇总了Python中celery.app.amqp.Queues类的典型用法代码示例。如果您正苦于以下问题:Python Queues类的具体用法?Python Queues怎么用?Python Queues使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Queues类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_with_ha_policy_compat
def test_with_ha_policy_compat(self):
q = Queues(ha_policy="all")
q.add("bar")
assert q["bar"].queue_arguments == {"x-ha-policy": "all"}
示例2: test_alias
def test_alias(self):
q = Queues()
q.add(Queue('foo', alias='barfoo'))
self.assertIs(q['barfoo'], q['foo'])
示例3: test_add
def test_add(self):
q = Queues()
q.add('foo', exchange='ex', routing_key='rk')
self.assertIn('foo', q)
self.assertIsInstance(q['foo'], Queue)
self.assertEqual(q['foo'].routing_key, 'rk')
示例4: test_select_add
def test_select_add(self):
q = Queues()
q.select(['foo', 'bar'])
q.select_add('baz')
self.assertItemsEqual(keys(q._consume_from), ['foo', 'bar', 'baz'])
示例5: test_with_ha_policy_compat
def test_with_ha_policy_compat(self):
q = Queues(ha_policy='all')
q.add('bar')
self.assertEqual(q['bar'].queue_arguments, {'x-ha-policy': 'all'})
示例6: test_add_default_exchange
def test_add_default_exchange(self):
ex = Exchange('fff', 'fanout')
q = Queues(default_exchange=ex)
q.add(Queue('foo'))
assert q['foo'].exchange.name == 'fff'
示例7: test_with_max_priority
def test_with_max_priority(self, queues_kwargs, qname, q, expected):
queues = Queues(**queues_kwargs)
queues.add(q)
assert queues[qname].queue_arguments == expected
示例8: test_add_default_exchange
def test_add_default_exchange(self):
ex = Exchange("fff", "fanout")
q = Queues(default_exchange=ex)
q.add(Queue("foo"))
self.assertEqual(q["foo"].exchange, ex)
示例9: test_select_remove
def test_select_remove(self):
q = Queues()
q.select_subset(["foo", "bar"])
q.select_remove("bar")
self.assertItemsEqual(keys(q._consume_from), ["foo"])
示例10: test_deselect
def test_deselect(self):
q = Queues()
q.select(["foo", "bar"])
q.deselect("bar")
self.assertItemsEqual(keys(q._consume_from), ["foo"])
示例11: test_add
def test_add(self):
q = Queues()
q.add("foo", exchange="ex", routing_key="rk")
assert "foo" in q
assert isinstance(q["foo"], Queue)
assert q["foo"].routing_key == "rk"
示例12: test_alias
def test_alias(self):
q = Queues()
q.add(Queue("foo", alias="barfoo"))
assert q["barfoo"] is q["foo"]
示例13: test_add_default_exchange
def test_add_default_exchange(self):
ex = Exchange("fff", "fanout")
q = Queues(default_exchange=ex)
q.add(Queue("foo"))
assert q["foo"].exchange.name == ""
示例14: test_deselect
def test_deselect(self):
q = Queues()
q.select(['foo', 'bar'])
q.deselect('bar')
assert sorted(keys(q._consume_from)) == ['foo']
示例15: test_with_ha_policy
def test_with_ha_policy(self):
qn = Queues(ha_policy=None, create_missing=False)
qn.add("xyz")
self.assertIsNone(qn["xyz"].queue_arguments)
qn.add("xyx", queue_arguments={"x-foo": "bar"})
self.assertEqual(qn["xyx"].queue_arguments, {"x-foo": "bar"})
q = Queues(ha_policy="all", create_missing=False)
q.add(Queue("foo"))
self.assertEqual(q["foo"].queue_arguments, {"x-ha-policy": "all"})
qq = Queue("xyx2", queue_arguments={"x-foo": "bari"})
q.add(qq)
self.assertEqual(q["xyx2"].queue_arguments, {"x-ha-policy": "all", "x-foo": "bari"})
q2 = Queues(ha_policy=["A", "B", "C"], create_missing=False)
q2.add(Queue("foo"))
self.assertEqual(q2["foo"].queue_arguments, {"x-ha-policy": "nodes", "x-ha-policy-params": ["A", "B", "C"]})