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


Python channel.Channel类代码示例

本文整理汇总了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
开发者ID:bkjones,项目名称:pika,代码行数:9,代码来源:blocking_connection.py

示例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()
开发者ID:garfee,项目名称:pika,代码行数:10,代码来源:blocking_connection.py

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

示例4: _open

 def _open(self, frame):
     Channel._open(self, frame)
     self.transport.remove_reply(frame)
开发者ID:KnightBaron,项目名称:pika,代码行数:3,代码来源:blocking_connection.py

示例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)
开发者ID:carlosefr,项目名称:pika,代码行数:17,代码来源:enforce_one_basicget_test.py

示例6: setUp

 def setUp(self):
     self.channel = Channel(MagicMock(Connection)(), 0, None)
     self.channel._state = Channel.OPEN
     self.callback = MagicMock()
开发者ID:carlosefr,项目名称:pika,代码行数:4,代码来源:enforce_one_basicget_test.py

示例7: exchange_delete

 def exchange_delete(self, *args, **nargs):
     return Channel.exchange_delete(self, *args, **nargs)
开发者ID:fat-crocodile,项目名称:heap,代码行数:2,代码来源:sync_connection.py

示例8: queue_delete

 def queue_delete(self, *args, **nargs):
     return Channel.queue_delete(self, *args, **nargs)
开发者ID:fat-crocodile,项目名称:heap,代码行数:2,代码来源:sync_connection.py

示例9: exchange_bind

 def exchange_bind(self, *args, **nargs):
     return Channel.exchange_bind(self, *args, **nargs)
开发者ID:fat-crocodile,项目名称:heap,代码行数:2,代码来源:sync_connection.py

示例10: queue_bind

 def queue_bind(self, *args, **nargs):
     return Channel.queue_bind(self, *args, **nargs)
开发者ID:fat-crocodile,项目名称:heap,代码行数:2,代码来源:sync_connection.py

示例11: queue_declare

 def queue_declare(self, *args, **nargs):
     return Channel.queue_declare(self, *args, **nargs)
开发者ID:fat-crocodile,项目名称:heap,代码行数:2,代码来源:sync_connection.py

示例12: __init__

 def __init__(self, *args, **nargs):
     Channel.__init__(self, *args, **nargs)
     self.add_on_close_callback(self._my_on_close)
开发者ID:fat-crocodile,项目名称:heap,代码行数:3,代码来源:sync_connection.py


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