當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。