code: def reconnect(self):
          
          parsed = urlparse.urlparse(self.amqp_url)
          port = parsed.port or 5672
          self.connection = amqp.Connection(host="%s:%s" % (parsed.hostname, port),
                                            userid=parsed.username or 'guest',
                                            password=parsed.password or 'guest',
                                            virtual_host=unquote(
                                                parsed.path.lstrip('/') or '%2F'))
          self.channel = self.connection.channel()
          try:
              self.channel.queue_declare(self.name)
          except amqp.exceptions.PreconditionFailed:
              pass
docs: Reconnect to rabbitmq server