List configured queues

Displays all configured queues, their type and the number of messages that are ready to be processed.

@return void
@throws Exception
439738
public function listCommand()
    {
        $rows = [];
        foreach ($this->queueConfigurations as $queueName => $queueConfiguration) {
            $queue = $this->queueManager->getQueue($queueName);
            try {
                $numberOfMessages = $queue->countReady();
            } catch (\Exception $e) {
                $numberOfMessages = '-';
            }
            $rows[] = [$queue->getName(), TypeHandling::getTypeForValue($queue), $numberOfMessages];
        }
        $this->output->outputTable($rows, ['Queue', 'Type', '# messages']);
    }
610567
def list(declared, undeclared):
    """"""
    queues = current_queues.queues.values()
    if declared:
        queues = filter(lambda queue: queue.exists, queues)
    elif undeclared:
        queues = filter(lambda queue: not queue.exists, queues)
    queue_names = [queue.routing_key for queue in queues]
    queue_names.sort()
    for queue in queue_names:
        click.secho(queue)
983313
public function processQueue()
    {
        if (!$this->getAllowMultipleRegistrations()) {
            throw new \Exception('Queuing only allowed when there are multiple registrations');
        }

        // find the best candidate
        while ($this->callQueue->count() > 0) {
            $registration = NULL;

            if (strcasecmp($this->getInvokeType(), Registration::FIRST_REGISTRATION) === 0) {
                $registration = $this->getNextFirstRegistration();
            } else if (strcasecmp($this->getInvokeType(), Registration::LAST_REGISTRATION) === 0) {
                $registration = $this->getNextLastRegistration();
            } else if (strcasecmp($this->getInvokeType(), Registration::RANDOM_REGISTRATION) === 0) {
                $registration = $this->getNextRandomRegistration();
            } else if (strcasecmp($this->getInvokeType(), Registration::ROUNDROBIN_REGISTRATION) === 0) {
                $registration = $this->getNextRoundRobinRegistration();
            } else if (strcasecmp($this->getInvokeType(), Registration::THRUWAY_REGISTRATION) === 0) {
                $registration = $this->getNextThruwayRegistration();
            }

            if ($registration === NULL) {
                break;
            }
            $call = $this->callQueue->dequeue();
            $registration->processCall($call);
        }
    }
438618
public function getQueues()
    {
        $informations = json_decode($this->query('GET', '/api/queues/'.$this->credentials['vhost']), true);
        $queues = array();
        foreach ($informations as $information) {
            $queues[] = $information['name'];
        }

        return $queues;
    }
331314
public function Index() {
      $this->Permission('Garden.Messages.Manage');
      $this->AddSideMenu('dashboard/message');
      $this->AddJsFile('jquery.autogrow.js');
      $this->AddJsFile('jquery.tablednd.js');
      $this->AddJsFile('jquery-ui.js');
      $this->AddJsFile('messages.js');
      $this->Title(T('Messages'));
         
      // Load all messages from the db
      $this->MessageData = $this->MessageModel->Get('Sort');
      $this->Render();
   }
444642
private function queueConfigs() {
        $config = $this->getConfig();
        if (!isset($config['schedulers'])) {
            yield $config;
            return;
        }

        foreach ($config['schedulers'] as $child_config) {
            yield mergeConfigOptions($config, $child_config);
        }
    }
569361
private function validateMessageType()
    {
        if (!in_array($this->config[self::CONFIG_TYPE], self::VALID_TYPES, true)) {
            throw new Exception(self::ERR_INVALID_TYPE);
        }

        if ($this->config[self::CONFIG_TYPE] === self::FILE && !$this->config[self::CONFIG_FILE]) {
            throw new Exception(self::ERR_INVALID_FILE);
        }
    }
1255278
public function indexQueuedItems()
    {
        $dispatcher = $this->getDispatcher();

        $log = $this->getLogger();
        $context = array('engine' => get_class($this->_searchEngine));
        $log->info('Indexing operation started', $context);

        try {

            // Ensure the schema object is populated. This routine will also
            // throw the SearchEvents::SCHEMA_ALTER event as well as detect
            // incompatible schemata.
            $this->getSchema();

            // Adds the search engine instance  as a subscriber only for the
            // duration of this indexing process.
            $dispatcher->addSubscriber($this->_searchEngine);

            $event = new SearchEngineEvent($this);
            $this->dispatchEvent(SearchEvents::SEARCH_ENGINE_PRE_INDEX, $event);

            // Consume messages from the queue that correspond with items that
            // are scheduled for indexing.
            $consumer = new QueueConsumer($this);
            foreach ($consumer as $message) {
                $context['item'] = $message->getBody();
                $log->debug('Consumed item scheduled for indexing from queue', $context);
                $this->indexQueuedItem($message);
            }

            unset($context['item']); // The item is no longer in context.
            $this->dispatchEvent(SearchEvents::SEARCH_ENGINE_POST_INDEX, $event);

            // The search engine should only listen to events throws during it's
            // own indexing operation.
            $dispatcher->removeSubscriber($this->_searchEngine);

        } catch (Exception $e) {
            // Make sure this service is removed as a subscriber. See above.
            $dispatcher->removeSubscriber($this->_searchEngine);
            throw $e;
        }

        $context['indexed'] = count($consumer);
        $log->info('Indexing operation completed', $context);
    }
236661
public function getQueues()
    {
        $queueNames = [];
        $queues = $this->queue->listQueues(['QueueNamePrefix' => ''])->get('QueueUrls');
        foreach ($queues as $queue) {
            $tokens = explode('/', $queue);
            $queueNames[] = $tokens[sizeof($tokens) - 1];
        }
        return $queueNames;
    }
539483
protected function executeQueue()
    {
        foreach ($this->queueActions as $key => $action) {
            if (self::QUEUE_ACTION_PERSIST === $action) {
                $this->doPersist($this->queueManagerNames[$key], $this->queueModels[$key], $this->queueIds[$key]);
            } else {
                $this->manager->getPool()->getManager($this->queueManagerNames[$key])->remove($this->queueModels[$key]);
            }
        }

        $this->cleanQueue();
    }
175919
public function socketPerform()
    {
        if ($this->count() == 0) {
            throw new Exception('Cannot perform if there are no requests in queue.');
        }

        $notRunning = $this->getRequestsNotRunning();
        do {
            /**
             * Apply cURL options to new requests
             */
            foreach ($notRunning as $request) {
                $this->getDefaultOptions()->applyTo($request);
                $request->getOptions()->applyTo($request);
                curl_multi_add_handle($this->mh, $request->getHandle());
                $this->running[$request->getUID()] = $request;
            }

            $runningHandles = null;
            do {
                // http://curl.haxx.se/libcurl/c/curl_multi_perform.html
                // If an added handle fails very quickly, it may never be counted as a running_handle.
                $mrc = curl_multi_exec($this->mh, $runningHandles);
            } while ($mrc === CURLM_CALL_MULTI_PERFORM);

            if ($runningHandles < count($this->running)) {
                $this->read();
            }

            $notRunning = $this->getRequestsNotRunning();
        } while (count($notRunning) > 0);
        // Why the loop? New requests might be added at runtime on 'complete' event.
        // So we need to attach them to curl_multi handle immediately.

        return $this->count() > 0;
    }
668580
protected function queueDeclare()
    {
        if (null !== $this->queueOptions['name']) {
            list($queueName, $msgCount, $consumerCount) = $this->getChannel()->queue_declare($this->queueOptions['name'], $this->queueOptions['passive'],
                $this->queueOptions['durable'], $this->queueOptions['exclusive'],
                $this->queueOptions['auto_delete'], $this->queueOptions['nowait'],
                $this->queueOptions['arguments'], $this->queueOptions['ticket']);
            if (isset($this->queueOptions['routing_keys']) && count($this->queueOptions['routing_keys']) > 0) {
                foreach ($this->queueOptions['routing_keys'] as $routingKey) {
                    $this->getChannel()->queue_bind($queueName, $this->exchangeOptions['name'], $routingKey);
                }
            } else {
                $this->getChannel()->queue_bind($queueName, $this->exchangeOptions['name'], $this->routingKey);
            }

            $this->queueStats = array(
                'message_count' => $msgCount,
                'consumer_count' => $consumerCount
            );

            $this->queueDeclared = true;
        }
    }
1192017
private void displayQueueList() throws IOException {
    JobQueueInfo[] queues = jc.getQueues();
    for (JobQueueInfo queue : queues) {
      String schedInfo = queue.getSchedulingInfo();
      if(schedInfo.trim().equals("")){
        schedInfo = "N/A";
      }
      System.out.printf("Queue Name : %s \n", queue.getQueueName());
      System.out.printf("Scheduling Info : %s \n",queue.getSchedulingInfo());
    }
  }
522504
public function flush()
    {
        if (!$this->getClient()->flush()) {
            throw new \Exception($this->getClient()->getResultMessage(), $this->getClient()->getResultCode());
        }
    }
1139350
public function process()
    {
        foreach ($this->tierConfiguration->listTierConfigs(['status' => 'pending']) as $tierConfig) {
            $this->dispatchTierConfig($tierConfig);
        }

        foreach ($this->fulfillment->listRequests(['status' => 'pending']) as $request) {
            $this->dispatch($request);
        }
    }
930096
public function index() {
        $this->Prg->commonProcess();
        $conds = $this->IvaResponsabilidad->parseCriteria( $this->Prg->parsedParams() );
        $this->Paginator->settings['conditions'] = $conds;
        $this->IvaResponsabilidad->recursive = 0;
        $ivaResponsabilidades = $this->Paginator->paginate('IvaResponsabilidad');
        $this->set('ivaResponsabilidades',$ivaResponsabilidades);
    }
347117
public function getMessageQueue()
	{
		// For empty queue, if messages exists in the session, enqueue them.
		if (!count($this->_messageQueue))
		{
			$session = JFactory::getSession();
			$sessionQueue = $session->get('application.queue');

			if (count($sessionQueue))
			{
				$this->_messageQueue = $sessionQueue;
				$session->set('application.queue', null);
			}
		}

		return $this->_messageQueue;
	}