当前位置: 首页>>代码示例>>Python>>正文


Python amqp.Queues类代码示例

本文整理汇总了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"}
开发者ID:bryson,项目名称:celery,代码行数:4,代码来源:test_amqp.py

示例2: test_alias

 def test_alias(self):
     q = Queues()
     q.add(Queue('foo', alias='barfoo'))
     self.assertIs(q['barfoo'], q['foo'])
开发者ID:277800076,项目名称:celery,代码行数:4,代码来源:test_amqp.py

示例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')
开发者ID:277800076,项目名称:celery,代码行数:6,代码来源:test_amqp.py

示例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'])
开发者ID:277800076,项目名称:celery,代码行数:5,代码来源:test_amqp.py

示例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'})
开发者ID:277800076,项目名称:celery,代码行数:4,代码来源:test_amqp.py

示例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'
开发者ID:atombrella,项目名称:celery,代码行数:5,代码来源:test_amqp.py

示例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
开发者ID:atombrella,项目名称:celery,代码行数:4,代码来源:test_amqp.py

示例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)
开发者ID:nimrodm,项目名称:celery,代码行数:5,代码来源:test_amqp.py

示例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"])
开发者ID:slyons,项目名称:celery,代码行数:5,代码来源:test_amqp.py

示例10: test_deselect

 def test_deselect(self):
     q = Queues()
     q.select(["foo", "bar"])
     q.deselect("bar")
     self.assertItemsEqual(keys(q._consume_from), ["foo"])
开发者ID:nimrodm,项目名称:celery,代码行数:5,代码来源:test_amqp.py

示例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"
开发者ID:bryson,项目名称:celery,代码行数:6,代码来源:test_amqp.py

示例12: test_alias

 def test_alias(self):
     q = Queues()
     q.add(Queue("foo", alias="barfoo"))
     assert q["barfoo"] is q["foo"]
开发者ID:bryson,项目名称:celery,代码行数:4,代码来源:test_amqp.py

示例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 == ""
开发者ID:bryson,项目名称:celery,代码行数:5,代码来源:test_amqp.py

示例14: test_deselect

 def test_deselect(self):
     q = Queues()
     q.select(['foo', 'bar'])
     q.deselect('bar')
     assert sorted(keys(q._consume_from)) == ['foo']
开发者ID:atombrella,项目名称:celery,代码行数:5,代码来源:test_amqp.py

示例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"]})
开发者ID:nimrodm,项目名称:celery,代码行数:19,代码来源:test_amqp.py


注:本文中的celery.app.amqp.Queues类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。