def __connect(self): try: logger.debug("creating amqp connection") self.conn = timeout_call(self.amqp_timeout, amqp.Connection, host=self.amqp_host_port, userid=self.amqp_user, password=self.amqp_password, virtual_host=self.amqp_virtual_host) self.conn.transport.sock.settimeout(self.amqp_timeout) except Exception: logger.exception('Error connecting to rabbitmq.') self.conn = None
def get(self, no_ack=False): return timeout_call(self.amqp_timeout, self.ch.basic_get, self.amqp_queue, no_ack)