Count messages in queue.

@param string $queue

@return int
344101
public function _countMessage($queue)
    {
        list($queue, $messageCount) = $this->getChannel()->queue_declare($queue, true);
        return $messageCount;
    }
1260481
private function getMessageLineCount($message)
    {
        $messageLength = FormatterHelper::strlenWithoutDecoration($this->output->getFormatter(), $message);

        return ceil($messageLength / $this->getTerminalWidth());
    }
817702
public function count($type = null)
    {
        if ($type) {
            return count($this->get($type));
        }

        $count = 0;
        foreach ($this->get() as $type => $messages) {
            $count += count($messages);
        }
        return $count;
    }
931463
public function size($queue = null)
    {
        $queue = $this->getQueue($queue);

        return $this->getConnection()->eval(
            LuaScripts::size(), 3, $queue, $queue.':delayed', $queue.':reserved'
        );
    }
627482
public function getUnreadMessagesCount($uid)
	{
		if (!$uid)
		{
			return 0;
		}

		$r = $this->getTableName();
		$m = Message::blank()->getTableName();
		$s = Seen::blank()->getTableName();

		$entries = Message::blank()
			->join($r, $m . '.id', $r . '.mid', 'inner')
			->whereEquals($r . '.uid', $uid)
			->where($r . '.state', '!=', 2)
			->whereRaw($m . ".id NOT IN (SELECT s.mid FROM `" . $s . "` AS s WHERE s.uid=" . $uid . ")");

		return $entries->total();
	}
536193
public function isFailedCountOk($queue)
    {
        if ($queue->alert_failed_jobs_greater_than < 1) {
            return true;
        }

        if ($this->getFailedJobsCount($queue) <= $queue->alert_failed_jobs_greater_than) {
            if ($this->eye->status()->isSick('queue_failed_jobs_'.$queue->id)) {
                $this->eye->notifier()->alert(new FailedCountOk(['queue' => $queue, 'failed_job_count' => $this->getFailedJobsCount($queue)]));
            }

            $this->eye->status()->setHealthy('queue_failed_jobs_'.$queue->id);

            return true;
        }

        if ($this->eye->status()->isHealthy('queue_failed_jobs_'.$queue->id)) {
            $this->eye->notifier()->alert(new FailedCountExceeded(['queue' => $queue, 'failed_job_count' => $this->getFailedJobsCount($queue)]));
        }

        $this->eye->status()->setSick('queue_failed_jobs_'.$queue->id);

        return false;
    }
1181299
public function countClientMessages($client)
    {
        return array_sum(array_map(function (Stack $stack) {
            return $this->countStackMessages($stack);
        }, $this->getClientRootStacks($client)));
    }
75351
public function countMessages($mailbox)
    {
        if ($this->selected === $mailbox && isset($this->data['EXISTS'])) {
            return $this->data['EXISTS'];
        }

        // Check internal cache
        $cache = $this->data['STATUS:'.$mailbox];
        if (!empty($cache) && isset($cache['MESSAGES'])) {
            return (int) $cache['MESSAGES'];
        }

        // Try STATUS (should be faster than SELECT)
        $counts = $this->status($mailbox);
        if (is_array($counts)) {
            return (int) $counts['MESSAGES'];
        }

        return false;
    }
559010
public function subscribe($queue)
    {
        if ($this->currentEnvelope) {
            throw new \RuntimeException('Don\'t be greedy and process the message you already have!');
        }

        $this->queue = $this->manager->getQueue((string) $queue);
    }
73828
public function isWaitTimeOk($queue)
    {
        if ($queue->alert_wait_time_greater_than < 1) {
            return true;
        }

        if ($queue->current_wait_time <= $queue->alert_wait_time_greater_than) {
            if ($this->eye->status()->isSick('queue_wait_time_'.$queue->id)) {
                $this->eye->notifier()->alert(new WaitOk(['queue' => $queue]));
            }

            $this->eye->status()->setHealthy('queue_wait_time_'.$queue->id);

            return true;
        }

        if ($this->eye->status()->isHealthy('queue_wait_time_'.$queue->id)) {
            $this->eye->notifier()->alert(new WaitLong(['queue' => $queue]));
        }

        $this->eye->status()->setSick('queue_wait_time_'.$queue->id);

        return false;
    }
1267271
public function getMessagesCount($uid, $filters=array())
	{
		if (!$uid)
		{
			return 0;
		}

		$entries = $this->buildQuery($uid, $filters);

		return $entries->total();
	}
1192419
public function total($domain)
	{
		$messages = $this->session->get($this->key($domain), array());

		return count($messages);
	}
687307
public function count(string $column = '*'): int
    {
        $select = clone $this;

        //To be escaped in compiler
        $select->columns = ["COUNT({$column})"];
        $select->ordering = [];
        $select->grouping = [];

        $st = $select->run();
        try {
            return (int)$st->fetchColumn();
        } finally {
            $st->close();
        }
    }
606446
private function hasRunningJobInQueue($queue)
    {
        $running = $this->configurationManager->findByQueueAndState($queue, JobState::STATE_RUNNING);

        return null !== $running;
    }
48706
public function getMessagesTotalCountOnQueue($queue)
    {
        try {
            return $this->queue->statsTube($queue)['total-jobs'];
        } catch (ConnectionException $ex) {
            \PHPUnit\Framework\Assert::fail("queue [$queue] not found");
        }
    }
234603
public function getMessagesCurrentCountOnQueue($queue)
    {
        try {
            return $this->queue->statsTube($queue)['current-jobs-ready'];
        } catch (ConnectionException $e) {
            \PHPUnit\Framework\Assert::fail("queue [$queue] not found");
        }
    }
389995
public function queue($queue = null)
    {
        return $this->mailer->queue($this->view, $this->data, $this->prepareCallback(), $queue);
    }