Drop all the messages from a queue.

        Parameters:
          queue_name(str): The queue to flush.
341324
def flush(self, queue_name):
        
        for name in (queue_name, dq_name(queue_name), xq_name(queue_name)):
            self.channel.queue_purge(name)
882952
def pop(self, queue_name):
        
        cls = self.__class__
        queue = cls.queues.get(queue_name, [])

        if queue:
            task_id = queue.pop(0)
            return cls.task_data.pop(task_id, None)
658138
def reset_queues(queues):
    """"""
    for queue in queues:
        with queue.mutex:
            queue._put = queue._pebble_old_method
        delattr(queue, '_pebble_old_method')
        delattr(queue, '_pebble_lock')
1351954
def clear_queue(self, queue_type=None, queue_id=None, purge_all=False):
        
        if queue_id is None or not is_valid_identifier(queue_id):
            raise BadArgumentException('`queue_id` has an invalid value.')

        if queue_type is None or not is_valid_identifier(queue_type):
            raise BadArgumentException('`queue_type` has an invalid value.')

        response = {
            'status': 'Failure',
            'message': 'No queued calls found'
            }
        # remove from the primary sorted set
        primary_set = '{}:{}'.format(self._key_prefix, queue_type)
        queued_status = self._r.zrem(primary_set, queue_id)
        if queued_status:
            response.update({'status': 'Success', 
                    'message': 'Successfully removed all queued calls'})
        # do a full cleanup of reources
        # although this is not necessary as we don't remove resources 
        # while dequeue operation
        job_queue_list = '{}:{}:{}'.format(self._key_prefix, queue_type, queue_id)
        if queued_status and purge_all:
            job_list = self._r.lrange(job_queue_list, 0, -1)
            pipe = self._r.pipeline()
            # clear the payload data for job_uuid
            for job_uuid in job_list:
                if job_uuid is None:
                    continue
                payload_set = '{}:payload'.format(self._key_prefix)
                job_payload_key = '{}:{}:{}'.format(queue_type, queue_id, job_uuid)
                pipe.hdel(payload_set, job_payload_key)
            # clear jobrequest interval
            interval_set = '{}:interval'.format(self._key_prefix)
            job_interval_key = '{}:{}'.format(queue_type, queue_id)
            pipe.hdel(interval_set, job_interval_key)
            # clear job_queue_list
            pipe.delete(job_queue_list)
            pipe.execute()
            response.update({'status': 'Success', 
                    'message': 'Successfully removed all queued calls and purged related resources'})
        else:
            # always delete the job queue list
            self._r.delete(job_queue_list)
        return response
322390
protected void clearMessageQueue() {
    MessageTuple tuple = null;
    while ((tuple = messageQueue.poll()) != null) {
      Message msg = tuple.getMessage();
      if (msg.getType() == MessageType.DISCONNECTED) {
        this.transport.clear(msg.getDisconnected().getServerId());
      } else if (msg.getType() == MessageType.SHUT_DOWN) {
        throw new LeftCluster("Shutdown Zab.");
      }
    }
  }
603229
def do_clearqueue(self, line):
        """"""
        self._split_args(line, 0, 0)
        self._command_processor.get_operation_queue().clear()
        self._print_info_if_verbose("All operations in the write queue were cleared")
726895
def flush(self, safe=None):
		''' '''
		result = None
		for index, op in enumerate(self.queue):
			try:
				result = op.execute()
			except:
				self.clear_queue()
				self.clear_cache()
				raise
		self.clear_queue()
		return result
1239479
def clear_messages(self, queue_name, timeout=None):
        '''
        
        '''
        _validate_not_none('queue_name', queue_name)
        request = HTTPRequest()
        request.method = 'DELETE'
        request.host_locations = self._get_host_locations()
        request.path = _get_path(queue_name, True)
        request.query = {'timeout': _int_to_str(timeout)}
        self._perform_request(request)
234727
def clear(self):
        """"""
        url = "queues/%s/messages" % self.name
        result = self.client.delete(url = url,
                                    body = json.dumps({}),
                                    headers={'Content-Type': 'application/json'})

        return result['body']
493811
def dump_queue(self, *names):
        
        conn = redis.StrictRedis(connection_pool=self.pool)
        for name in names:
            if name == 'worker':
                logger.debug('last worker: ' + conn.get(self._key_worker()))
            elif name == 'available':
                logger.debug('available: ' +
                             str(conn.zrevrange(self._key_available(), 0, -1,
                                                withscores=True)))
            elif name == 'priorities':
                logger.debug('priorities: ' +
                             str(conn.hgetall(self._key_priorities())))
            elif name == 'expiration':
                logger.debug('expiration: ' +
                             str(conn.zrevrange(self._key_expiration(), 0, -1,
                                                withscores=True)))
            elif name == 'workers':
                logger.debug('workers: ' +
                             str(conn.hgetall(self._key_workers())))
            elif name.startswith('reservations_'):
                item = name[len('reservations_'):]
                logger.debug('reservations for ' + item + ': ' +
                             str(conn.smembers(self._key_reservations(item))))
1190224
def _drop_server(self, server, message):
        
        try:
            self._active_servers.remove(server)
        except ValueError:
            pass
        else:
            heapq.heappush(self._inactive_servers, (time(), server, message))
            logger.warning("Removed server %s from active pool", server)

        # if this is the last server raise exception, otherwise try next
        if not self._active_servers:
            raise ConnectionError(
                ("No more Servers available, "
                 "exception from last server: %s") % message)
407079
private void dropTemporaryQueues()
    {
        synchronized (temporaryQueues)
		{
	        Iterator<String> remainingQueues = temporaryQueues.iterator();
	        while (remainingQueues.hasNext())
	        {
	            String queueName = remainingQueues.next();
	            try
	            {
	                deleteTemporaryQueue(queueName);
	            }
	            catch (JMSException e)
	            {
	            	ErrorTools.log(e, log);
	            }
	        }
		}
    }
536075
function clear(): void {
        $queue = $this->queue;
        $this->queue = array();
        
        while($item = \array_shift($queue)) {
            unset($item);
        }
    }
977444
def RemoveFromQueue(self, addr):
        
        if addr in self.connection_queue:
            self.connection_queue.remove(addr)
1219764
def queue_purge(self, queue, **kwargs):
        """"""
        qsize = mqueue.qsize()
        mqueue.queue.clear()
        return qsize
1098528
def drop_all(self, **kwargs):
        
        conn = self.__get_conn__(**kwargs)
        conn.update_query("DROP ALL")
        self.loaded = []
        self.loaded_times = {}
847629
function purgeADQueue (channel, connectionName, options, messages) {
  const name = options.uniqueName || options.name;
  return new Promise(function (resolve, reject) {
    const messageCount = messages.messages.length;
    if (messageCount > 0) {
      log.info(`Purge operation for queue '${options.name}' on '${connectionName}' is waiting for resolution on ${messageCount} messages`);
      messages.once('empty', function () {
        channel.purgeQueue(name)
          .then(
            result => resolve(result.messageCount),
            reject
          );
      });
    } else {
      channel.purgeQueue(name)
        .then(
          result => resolve(result.messageCount),
          reject
        );
    }
  });
}