本文整理汇总了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)
示例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)
示例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')
示例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'}")
示例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')
示例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)
示例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'")