示例#1
0
    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)
示例#2
0
    def _adapter_connect(self):
        """
        Connect to the given host and port
        """
        # Setup our ioloop
        if self.ioloop is None:
            self.ioloop = IOLoop.instance()

        # 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)
示例#3
0
 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()
示例#4
0
    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()
示例#5
0
    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()
示例#6
0
    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()
示例#7
0
    def _adapter_connect(self):
        """
        Connect to the given host and port
        """
        BaseConnection._adapter_connect(self)

        # Setup the IOLoop
        self.ioloop = IOLoop(self._manage_event_state)

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

        # Let everyone know we're connected
        self._on_connected()
示例#8
0
    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()
    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()
示例#10
0
    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()
示例#11
0
    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()