本文整理汇总了Python中pika.channel.Channel类的典型用法代码示例。如果您正苦于以下问题:Python Channel类的具体用法?Python Channel怎么用?Python Channel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Channel类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, connection, channel_number, transport=None):
# We need to do this before the channel is invoked and send_method is
# called
CallbackManager.instance().add(channel_number,
spec.Channel.OpenOk,
transport._on_rpc_complete)
Channel.__init__(self, connection, channel_number, None, transport)
self.basic_get_ = Channel.basic_get
示例2: __init__
def __init__(self, connection, channel_number, transport=None):
# We need to do this before the channel is invoked and send_method is
# called
connection.callbacks.add(channel_number, spec.Channel.OpenOk, transport._on_rpc_complete)
connection.callbacks.add(channel_number, spec.Channel.CloseOk, transport._on_rpc_complete)
Channel.__init__(self, connection, channel_number, None, transport)
self.basic_get_ = Channel.basic_get
self._consumers = {}
self.open()
示例3: _on_remote_close
def _on_remote_close(self, frame):
Channel._on_remote_close(self, frame)
raise AMQPChannelError(frame.method.reply_code,
frame.method.reply_text)
示例4: _open
def _open(self, frame):
Channel._open(self, frame)
self.transport.remove_reply(frame)
示例5: OnlyOneBasicGetTestCase
class OnlyOneBasicGetTestCase(unittest.TestCase):
def setUp(self):
self.channel = Channel(MagicMock(Connection)(), 0, None)
self.channel._state = Channel.OPEN
self.callback = MagicMock()
def test_two_basic_get_with_callback(self):
self.channel.basic_get('test-queue', self.callback)
self.channel._on_getok(MagicMock(Method)(), MagicMock(Header)(), '')
self.channel.basic_get('test-queue', self.callback)
self.channel._on_getok(MagicMock(Method)(), MagicMock(Header)(), '')
self.assertEqual(self.callback.call_count, 2)
def test_two_basic_get_without_callback(self):
self.channel.basic_get('test-queue', self.callback)
with self.assertRaises(DuplicateGetOkCallback):
self.channel.basic_get('test-queue', self.callback)
示例6: setUp
def setUp(self):
self.channel = Channel(MagicMock(Connection)(), 0, None)
self.channel._state = Channel.OPEN
self.callback = MagicMock()
示例7: exchange_delete
def exchange_delete(self, *args, **nargs):
return Channel.exchange_delete(self, *args, **nargs)
示例8: queue_delete
def queue_delete(self, *args, **nargs):
return Channel.queue_delete(self, *args, **nargs)
示例9: exchange_bind
def exchange_bind(self, *args, **nargs):
return Channel.exchange_bind(self, *args, **nargs)
示例10: queue_bind
def queue_bind(self, *args, **nargs):
return Channel.queue_bind(self, *args, **nargs)
示例11: queue_declare
def queue_declare(self, *args, **nargs):
return Channel.queue_declare(self, *args, **nargs)
示例12: __init__
def __init__(self, *args, **nargs):
Channel.__init__(self, *args, **nargs)
self.add_on_close_callback(self._my_on_close)