Creates a subscription to the given $queue, allowing to receive messages from it.

@param string $queue Queue to subscribe
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);
    }
248731
public function handleSayCommand(Event $event, Queue $queue)
    {
        $params = $event->getCustomParams();
        if (count($params) < 2) {
            $this->handleSayHelp($event, $queue);
        } else {
            $channels = array_shift($params);
            $queue->ircPrivmsg($channels, implode(' ', $params));
        }
    }
1343821
public function getQueue($queue)
    {
        $queue = $queue ?: $this->default;

        return filter_var($queue, FILTER_VALIDATE_URL) === false
                        ? rtrim($this->prefix, '/').'/'.$queue : $queue;
    }
1046658
public function encodeMessage($message, $queue)
    {
        $messageFactory = $this->getMessageFactory();

        if (!$this->messageFactory->accepts($message)) {
            throw new Exception\RuntimeException(
                sprintf(
                    '%s does not accept message of type "%s"',
                    get_class($messageFactory),
                    (is_object($message) ? get_class($message) : gettype($message))
                )
            );
        }

        return new BernardDefaultMessage(
            $queue,
            array(
                self::MESSAGE_CLASS_KEY => get_class($message),
                self::MESSAGE_KEY => $this->getMessageFactory()->toArray($message),
            )
        );
    }
1126707
def subscribe_to_queue(consumer_class)
      queue = channel.queue(consumer_class.queue_name, durable: true,
        arguments: { 'x-ha-policy' => 'all' })

      queue.subscribe(manual_ack: true) do |delivery_info, properties, message|
        process_message(consumer_class, delivery_info, properties, message)
      end

      logger.info "Subscribed #{consumer_class} to #{consumer_class.queue_name}"
    end
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
        );
    }
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();
        }
    }
1006167
public function subscribeQueueEvents(QueueManager $queue)
    {
        $queue->looping(function () {
            // Flush any and all events that were possibly generated by queue jobs
            Integration::flushEvents();

            // We have added a scope when a job starts processing
            Hub::getCurrent()->popScope();
        });

        foreach (static::$queueEventHandlerMap as $eventName => $handler) {
            $this->events->listen($eventName, [$this, $handler]);
        }
    }
319845
public function send(QueueClientInterface $queue, $message, SendParametersInterface $params = null)
    {
        $queue->send($message, $params);
    }
609854
public function get($queue, $noAck = false): Observable
    {
        $promise = $this->channel->get($queue, $noAck);

        return Observable::fromPromise($promise)
            ->map(function (BaseMessage $message) {
                return new Message($this->channel, $message);
            });
    }
690837
public function unserialize($queue)
    {
        foreach (unserialize($queue) as $item) {
            $this->insert($item['data'], $item['priority']);
        }
    }
291112
public function setQueueOptions(array $options = [], $queue = self::PRIORITY_NORM)
    {
        msg_set_queue($this->queues[$queue], $options);
    }
1137098
public function push($queue, $item)
    {
        // Add the queue to the list of queues
        $this->getClient()->sadd($this->getKey(self::QUEUES_KEY), $queue);

        // Add the job to the specified queue
        $this->getClient()->rpush($this->getKey(self::QUEUE_KEY . $queue), json_encode($item));
    }
955401
public function queueOn($queue)
    {
        return $this->mailer->queueOn($queue, $this->view, $this->data, $this->prepareCallback());
    }
291239
public function pop($queue = null)
    {
        $queue = $this->getQueue($queue);

        $response = $this->sqs->receiveMessage(
            array('QueueUrl' => $queue, 'AttributeNames' => array('ApproximateReceiveCount'))
        );

        if (count($response['Messages']) > 0)
        {
            return new SqsJob($this->container, $this->sqs, $queue, $response['Messages'][0]);
        }
    }
901149
public function send(QueueInterface $queue, Message $message)
    {
        $headers = $message->getHeaders();
        $properties = $message->getProperties();

        $headers['content_type'] = $message->getContentType();

        $transportMessage = $this->createTransportMessage();
        $transportMessage->setBody($message->getBody());
        $transportMessage->setHeaders($headers);
        $transportMessage->setProperties($properties);

        $transportMessage->setMessageId($message->getMessageId());
        $transportMessage->setTimestamp($message->getTimestamp());

        if ($message->getDelay()) {
            $transportMessage->setDelay($message->getDelay());
        }

        if ($message->getPriority()) {
            $this->setMessagePriority($transportMessage, $message->getPriority());
        }

        if ($message->getExpire()) {
            throw new \InvalidArgumentException('Expire is not supported by the transport');
        }

        $this->session->createProducer()->send($queue, $transportMessage);
    }
1273484
public function set(string $data, string $queue = 'default')
    {
        return $this->rabbit->publish($data, $queue);
    }