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


Python Channel.on_frame方法代码示例

本文整理汇总了Python中amqpstorm.Channel.on_frame方法的典型用法代码示例。如果您正苦于以下问题:Python Channel.on_frame方法的具体用法?Python Channel.on_frame怎么用?Python Channel.on_frame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在amqpstorm.Channel的用法示例。


在下文中一共展示了Channel.on_frame方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_channel_consume_ok_frame

# 需要导入模块: from amqpstorm import Channel [as 别名]
# 或者: from amqpstorm.Channel import on_frame [as 别名]
    def test_channel_consume_ok_frame(self):
        tag = 'hello-world'
        channel = Channel(0, None, rpc_timeout=360)

        channel.on_frame(specification.Basic.ConsumeOk(tag))

        self.assertEqual(channel.consumer_tags[0], tag)
开发者ID:exg77,项目名称:amqpstorm,代码行数:9,代码来源:channel_tests.py

示例2: test_channel_cancel_ok_frame

# 需要导入模块: from amqpstorm import Channel [as 别名]
# 或者: from amqpstorm.Channel import on_frame [as 别名]
    def test_channel_cancel_ok_frame(self):
        tag = 'hello-world'
        channel = Channel(0, None, rpc_timeout=360)
        channel.add_consumer_tag(tag)

        channel.on_frame(specification.Basic.CancelOk(tag))

        self.assertFalse(channel.consumer_tags)
开发者ID:exg77,项目名称:amqpstorm,代码行数:10,代码来源:channel_tests.py

示例3: test_channel_basic_cancel_frame

# 需要导入模块: from amqpstorm import Channel [as 别名]
# 或者: from amqpstorm.Channel import on_frame [as 别名]
    def test_channel_basic_cancel_frame(self):
        connection = amqpstorm.Connection('localhost', 'guest', 'guest',
                                          lazy=True)
        channel = Channel(0, connection, rpc_timeout=360)

        channel.on_frame(specification.Basic.Cancel('unit-test'))

        self.assertEqual(self.logging_handler.messages['warning'][0],
                         'Received Basic.Cancel on consumer_tag: unit-test')
开发者ID:exg77,项目名称:amqpstorm,代码行数:11,代码来源:channel_tests.py

示例4: test_channel_unhandled_frame

# 需要导入模块: from amqpstorm import Channel [as 别名]
# 或者: from amqpstorm.Channel import on_frame [as 别名]
    def test_channel_unhandled_frame(self):
        connection = amqpstorm.Connection('localhost', 'guest', 'guest',
                                          lazy=True)
        channel = Channel(0, connection, rpc_timeout=360)

        channel.on_frame(FakeFrame())

        self.assertEqual(self.logging_handler.messages['error'][0],
                         "[Channel0] Unhandled Frame: FakeFrame -- "
                         "{'data_1': 'hello world'}")
开发者ID:exg77,项目名称:amqpstorm,代码行数:12,代码来源:channel_tests.py

示例5: test_channel_close_frame

# 需要导入模块: from amqpstorm import Channel [as 别名]
# 或者: from amqpstorm.Channel import on_frame [as 别名]
    def test_channel_close_frame(self):
        connection = amqpstorm.Connection('localhost', 'guest', 'guest',
                                          lazy=True)
        channel = Channel(0, connection, rpc_timeout=360)

        channel.on_frame(specification.Channel.Close(reply_code=500,
                                                     reply_text='test'))

        self.assertEqual(str(channel.exceptions[0]),
                         'Channel 0 was closed by remote server: test')
开发者ID:exg77,项目名称:amqpstorm,代码行数:12,代码来源:channel_tests.py

示例6: test_channel_flow_frame

# 需要导入模块: from amqpstorm import Channel [as 别名]
# 或者: from amqpstorm.Channel import on_frame [as 别名]
    def test_channel_flow_frame(self):
        connection = FakeConnection()
        connection.set_state(connection.OPEN)
        channel = Channel(0, connection, rpc_timeout=360)
        channel.set_state(channel.OPEN)

        channel.on_frame(specification.Channel.Flow())

        self.assertIsInstance(connection.frames_out[0][1],
                              specification.Channel.FlowOk)
开发者ID:exg77,项目名称:amqpstorm,代码行数:12,代码来源:channel_tests.py

示例7: test_channel_basic_return_frame

# 需要导入模块: from amqpstorm import Channel [as 别名]
# 或者: from amqpstorm.Channel import on_frame [as 别名]
    def test_channel_basic_return_frame(self):
        connection = amqpstorm.Connection('localhost', 'guest', 'guest',
                                          lazy=True)
        channel = Channel(0, connection, rpc_timeout=360)

        channel.on_frame(specification.Basic.Return(reply_code=500,
                                                    reply_text='test',
                                                    exchange='exchange',
                                                    routing_key='routing_key'))

        self.assertEqual(str(channel.exceptions[0]),
                         "Message not delivered: test (500) to queue "
                         "'routing_key' from exchange 'exchange'")
开发者ID:exg77,项目名称:amqpstorm,代码行数:15,代码来源:channel_tests.py


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