Starts an infinite loop calling Consumer::tick();.

@param Queue $queue
@param array $options
354587
public function consume(Queue $queue, array $options = [])
    {
        declare(ticks=1);

        $this->bind();

        while ($this->tick($queue, $options)) {
            // NO op
        }
    }
694101
public function listen($connection, $queue, ListenerOptions $options)
    {
        $process = $this->makeProcess($connection, $queue, $options);

        while (true) {
            $this->runProcess($process, $options->memory);
        }
    }
488531
public function startWrite($message, array $options = null) {
		return $this->startEvent($message, ProfileInterface::TYPE_WRITE, $options);
	}
1256194
public function execute()
    {
        $queue = P\queue();

        while ($this->handles || !$queue->isEmpty()) {
            // If there are no transfers, then sleep for the next delay
            if (!$this->active && $this->delays) {
                usleep($this->timeToNext());
            }
            $this->tick();
        }
    }
112836
public function setQueue($queue, $value)
    {
        // Ensure the value is an array
        if (is_array($value) === false) {
            $value = [$value];
        }

        $this->queues[$queue] = array_merge(
            $this->getQueue($queue), $value
        );
    }
195314
protected function copyQueue(\SplPriorityQueue $queue)
    {
        $this->items = [];

        foreach ($queue as $item) {
            $this->items[] = $item;
        }
    }
1125275
public function pushRaw($body, $delay = 0, $queue = null, array $options = [])
    {
        if (is_string($body)) {
            json_decode($body, true);
        }

        $message = new QueueMessage();
        $message->setBody($body);
        $message->setDelay($delay);
        $message->setQueueName($queue);
        $message->setOptions($options);

        return $this->driver->push($message);
    }
1328870
public function pushRaw($payload, $queue = null, array $options = array())
	{
		return $this->redis->rpush($this->getQueue($queue), $payload);
	}
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);
    }
536281
public function tick()
    {
        $count = $this->queue->count();

        while ($count-- && $this->loop->isRunning())
        {
            $this->callback = $this->queue->dequeue();
            $callback = $this->callback; // without this proxy PHPStorm marks line as fatal error.
            $callback($this->loop);
        }
    }
1286780
public function addQueue($queue)
    {
        if(!in_array($queue, $this->queuesWorkedOn)) {
            $this->queuesWorkedOn[] = $queue;
        }

        return $this;
    }
677350
public function loop($queue, Structure $options)
    {
        gc_enable();

        // Last Restart
        $this->lastRestart = (new \DateTimeImmutable('now'))->format('U');

        // Log PID
        $this->pid = getmypid();

        $this->logger->info('A worker start running... PID: ' . $this->pid);

        $this->setState(static::STATE_ACTIVE);

        while (true) {
            $this->gc();

            // @loop start
            $this->triggerEvent(
                'onWorkerLoopCycleStart',
                [
                    'worker' => $this,
                    'manager' => $this->manager,
                ]
            );

            // Timeout handler
            $this->registerSignals($options);

            if ($this->canLoop() || $options->get('force')) {
                try {
                    $this->runNextJob($queue, $options);
                } catch (\Exception $e) {
                    $msg = sprintf('Worker failure in a loop cycle: %s', $e->getMessage());

                    $this->logger->error($msg);

                    $this->triggerEvent(
                        'onWorkerLoopCycleFailure',
                        [
                            'worker' => $this,
                            'exception' => $e,
                            'message' => $msg,
                        ]
                    );
                }
            }

            $this->stopIfNecessary($options);

            // @loop end
            $this->triggerEvent(
                'onWorkerLoopCycleEnd',
                [
                    'worker' => $this,
                    'manager' => $this->manager,
                ]
            );

            $this->sleep((int) $options->get('sleep', 1));
        }
    }
1140557
public function tick($increment = 1, $msg = null) {
		if ($msg) {
			$this->_message = $msg;
		}
		Notify::tick($increment);
	}
1286464
public function execute($queue)
    {
        if (!empty($this->id)) {
            $user = User::find()->where(['id' => $this->id])
                ->one();
        } elseif (!empty($this->username)) {
            $user = User::findByUsername($this->username);
        }

        if (!empty($user)) {
            $user->setPassword($this->password);
            $user->save();
        }
    }
675068
public function pushRaw($payload, $queue = null, array $options = [])
    {
        $this->jobs[] = [
            'type'    => 'push',
            'payload' => $payload,
            'queue'   => $queue,
            'options' => $options,
        ];
    }
624928
public function addConsumer($queue, ConsumerInterface $consumer, $priority = 0)
    {
        $this->messageDispatcher->addListener($queue, array($consumer, 'consume'), $priority);
    }
1140634
protected function runWorker(QueueInterface $queue)
    {
        (new Worker($this, $this->getTaskLog(), false))
            ->setDedicatedQueue($queue, 1)
            ->run();
    }