當前位置: 首頁>>代碼示例>>Python>>正文


Python BaseConnection._adapter_connect方法代碼示例

本文整理匯總了Python中pika.adapters.base_connection.BaseConnection._adapter_connect方法的典型用法代碼示例。如果您正苦於以下問題:Python BaseConnection._adapter_connect方法的具體用法?Python BaseConnection._adapter_connect怎麽用?Python BaseConnection._adapter_connect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pika.adapters.base_connection.BaseConnection的用法示例。


在下文中一共展示了BaseConnection._adapter_connect方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _adapter_connect

# 需要導入模塊: from pika.adapters.base_connection import BaseConnection [as 別名]
# 或者: from pika.adapters.base_connection.BaseConnection import _adapter_connect [as 別名]
    def _adapter_connect(self):
        """
        Connect to the given host and port
        """
        # Setup our ioloop
        if self.ioloop is None:
            self.ioloop = self._default_ioloop

        # Setup a periodic callbacks
        if self._pc is None:
            self._pc = ioloop.PeriodicCallback(self._manage_event_state,
                                               self.callback_interval,
                                               self.ioloop)

        try:
            # Connect to RabbitMQ and start polling
            BaseConnection._adapter_connect(self)
            self.start_poller()

            # Let everyone know we're connected
            self._on_connected()
        except AMQPConnectionError, e:
            # If we don't have RS just raise the exception
            if isinstance(self.reconnection, NullReconnectionStrategy):
                raise e
            # Trying to reconnect
            self.reconnection.on_connection_closed(self)
開發者ID:bergundy,項目名稱:pika,代碼行數:29,代碼來源:tornado_connection.py

示例2: _adapter_connect

# 需要導入模塊: from pika.adapters.base_connection import BaseConnection [as 別名]
# 或者: from pika.adapters.base_connection.BaseConnection import _adapter_connect [as 別名]
 def _adapter_connect(self):
     # Connect (blockignly!) to the server
     BaseConnection._adapter_connect(self)
     self.event_state |= WRITE
     # Setup the IOLoop
     self.ioloop = IOLoop(self.notifiers)
     # Let everyone know we're connected
     self._on_connected()
開發者ID:inean,項目名稱:pika,代碼行數:10,代碼來源:pyside_connection.py

示例3: _adapter_connect

# 需要導入模塊: from pika.adapters.base_connection import BaseConnection [as 別名]
# 或者: from pika.adapters.base_connection.BaseConnection import _adapter_connect [as 別名]
    def _adapter_connect(self, host, port):
        # Connect (blockignly!) to the server
        BaseConnection._adapter_connect(self, host, port)
        # Pnce that's done, create an I/O loop by adapting the Twisted reactor
        self.ioloop = IOLoopReactorAdapter(self, reactor)
        # Set the I/O events we're waiting for (see IOLoopReactorAdapter
        # docstrings for why it's OK to pass None as the file descriptor)
        self.ioloop.update_handler(None, self.event_state)

        # Let everyone know we're connected
        self._on_connected()
開發者ID:bartekgorny,項目名稱:pika,代碼行數:13,代碼來源:twisted_connection.py

示例4: _adapter_connect

# 需要導入模塊: from pika.adapters.base_connection import BaseConnection [as 別名]
# 或者: from pika.adapters.base_connection.BaseConnection import _adapter_connect [as 別名]
    def _adapter_connect(self, host, port):
        """
        Connect to the given host and port
        """
        BaseConnection._adapter_connect(self, host, port)

        # Setup our and start our IOLoop and Poller
        self.ioloop = IOLoop.instance()
        self.ioloop.fileno = self.socket.fileno()
        self.ioloop.start_poller(self._handle_events, self.event_state)

        # Let everyone know we're connected
        self._on_connected()
開發者ID:samuel,項目名稱:pika,代碼行數:15,代碼來源:select_connection.py

示例5: _adapter_connect

# 需要導入模塊: from pika.adapters.base_connection import BaseConnection [as 別名]
# 或者: from pika.adapters.base_connection.BaseConnection import _adapter_connect [as 別名]
    def _adapter_connect(self, host, port):
        """
        Connect to the given host and port
        """
        BaseConnection._adapter_connect(self, host, port)

        # Setup our ioloop
        self.ioloop = IOLoop.instance()

        # Add the ioloop handler for the event state
        self.ioloop.add_handler(self.socket.fileno(),
                                self._handle_events,
                                self.event_state)

        # Let everyone know we're connected
        self._on_connected()
開發者ID:arbeit,項目名稱:openquake-packages,代碼行數:18,代碼來源:tornado_connection.py

示例6: _adapter_connect

# 需要導入模塊: from pika.adapters.base_connection import BaseConnection [as 別名]
# 或者: from pika.adapters.base_connection.BaseConnection import _adapter_connect [as 別名]
    def _adapter_connect(self, host, port):
        """
        Connect to the given host and port
        """
        BaseConnection._adapter_connect(self, host, port)

        # Setup our ioloop - only if we didn't already have one.
        if self.tornado_loop:
            self.ioloop = self.tornado_loop
        else:
            self.ioloop = IOLoop.instance()

        # Add the ioloop handler for the event state
        self.ioloop.add_handler(self.socket.fileno(),
                                self._handle_events,
                                self.event_state)

        # Let everyone know we're connected
        self._on_connected()
開發者ID:kaze,項目名稱:paasmaker,代碼行數:21,代碼來源:tornado_connection.py

示例7: _adapter_connect

# 需要導入模塊: from pika.adapters.base_connection import BaseConnection [as 別名]
# 或者: from pika.adapters.base_connection.BaseConnection import _adapter_connect [as 別名]
    def _adapter_connect(self):
        """
        Connect to the given host and port
        """
        BaseConnection._adapter_connect(self)

        # Setup our ioloop
        self.ioloop = IOLoop.instance()

        # Setup a periodic callbacks
        _pc = ioloop.PeriodicCallback(self._manage_event_state,
                                      0.25,
                                      self.ioloop)
        _pc.start()

        # Add the ioloop handler for the event state
        self.ioloop.add_handler(self.socket.fileno(),
                                self._handle_events,
                                self.event_state)

        # Let everyone know we're connected
        self._on_connected()
開發者ID:curlup,項目名稱:pika,代碼行數:24,代碼來源:tornado_connection.py


注:本文中的pika.adapters.base_connection.BaseConnection._adapter_connect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。