@param \Generated\Shared\Transfer\QueueSendMessageTransfer $queueSendMessageTransfer

@return \PhpAmqpLib\Channel\AMQPChannel[]
161020
protected function getChannels(QueueSendMessageTransfer $queueSendMessageTransfer)
    {
        if ($queueSendMessageTransfer->getStoreName()) {
            return $this->connectionManager->getChannelsByStoreName(
                $queueSendMessageTransfer->getStoreName(),
                $queueSendMessageTransfer->getLocale()
            );
        }

        if ($queueSendMessageTransfer->getQueuePoolName()) {
            return $this->connectionManager->getChannelsByQueuePoolName(
                $queueSendMessageTransfer->getQueuePoolName(),
                $queueSendMessageTransfer->getLocale()
            );
        }

        return [$this->connectionManager->getDefaultChannel()];
    }
56580
public static function fromAMQPMessage(AMQPMessage $message) {

        $envelope = new self();
        $envelope->app_id = $message->has('app_id') ? $message->get('app_id') : '';
        $envelope->body = $message->body;
        $envelope->content_encoding  = $message->has('content_encoding') ? $message->get('content_encoding') : '';
        $envelope->content_type = $message->has('content_type') ? $message->get('content_type') : '';
        $envelope->correlation_id = $message->has('correlation_id') ? $message->get('correlation_id') : '';
        $envelope->delivery_mode = $message->has('delivery_mode') ? $message->get('delivery_mode') : '';
        $envelope->delivery_tag = $message->has('delivery_tag') ? $message->get('delivery_tag') : '';
        $envelope->exchange_name = $message->has('exchange') ? $message->get('exchange') : '';
        $envelope->expiration = $message->has('expiration') ? $message->get('expiration') : '';
        $envelope->headers = $message->has('application_headers') ? $message->get('application_headers')->getNativeData() : '';
        $envelope->message_id = $message->has('message_id') ? $message->get('message_id') : '';
        $envelope->priority = $message->has('priority') ? $message->get('priority') : '';
        $envelope->reply_to = $message->has('reply_to') ? $message->get('reply_to') : '';
        $envelope->routing_key = $message->has('routing_key') ? $message->get('routing_key') : '';
        $envelope->timestamp = $message->has('timestamp') ? $message->get('timestamp') : '';
        $envelope->type = $message->has('type') ? $message->get('type') : '';
        $envelope->user_id = $message->has('user_id') ? $message->get('user_id') : '';
        $envelope->is_redelivery = $message->has('redelivered') ? $message->get('redelivered') : '';

        return $envelope;
    }
761485
protected function getQueryNames(array $methodTransferCollection, ClassNodeTransfer $classNodeTransfer): array
    {
        $queryNames = [];

        foreach ($methodTransferCollection as $methodTransfer) {
            $queryNames[] = $methodTransfer->getQueryNames();
        }

        $queryNames = array_merge(...$queryNames);
        $queryNames = array_unique($queryNames);
        $queryNames = array_filter($queryNames);

        return $this->getModuleNamesByQueryNames($queryNames, $classNodeTransfer);
    }
1179024
public function newAction(StockTransfer $stockTransfer)
    {
        $stocktransferitem = new StockTransferItem();
        $stocktransferitem->setStockTransfer($stockTransfer);
        $form = $this->createForm(new StockTransferItemType(), $stocktransferitem);

        return array(
            'stocktransferitem' => $stocktransferitem,
            'form' => $form->createView(),
        );
    }
935877
public static function fromAMQPMessage(AMQPMessage $AMQPMessage)
    {
        $msg = new Message(
            json_decode($AMQPMessage->body, true),
            $AMQPMessage->delivery_info['routing_key'],
            $AMQPMessage->get_properties()
        );
        $msg->setAMQPMessage($AMQPMessage);
        return $msg;

    }
379388
public function getDataSubArray(ComputopApiRequestTransfer $computopApiRequestTransfer): array
    {
        $dataSubArray = parent::getDataSubArray($computopApiRequestTransfer);
        $dataSubArray[ComputopApiConfig::EVENT_TOKEN] = ComputopApiConfig::EVENT_TOKEN_AUTHORIZE;
        $dataSubArray[ComputopApiConfig::CAPTURE] = ComputopApiConfig::CAPTURE_MANUAL;

        return $dataSubArray;
    }
495439
public function filterPaymentMethods(PaymentMethodsTransfer $paymentMethodsTransfer, QuoteTransfer $quoteTransfer): PaymentMethodsTransfer
    {
        $availableMethods = $this->getAvailablePaymentMethods($quoteTransfer);

        $result = new ArrayObject();

        foreach ($paymentMethodsTransfer->getMethods() as $paymentMethod) {
            if ($this->isPaymentMethodPayone($paymentMethod) && !$this->isAvailable($paymentMethod, $availableMethods)) {
                continue;
            }
            $result->append($paymentMethod);
        }
        $paymentMethodsTransfer->setMethods($result);

        return $paymentMethodsTransfer;
    }
381218
public function receive(QueueClientInterface $queue, $maxMessages = 1, ReceiveParametersInterface $params = null)
    {
        $messages = $queue->receive($maxMessages, $params);
        $lastResult = [];

        foreach ($messages as $message) {
            if ($message instanceof MessageInterface) {

                $lastResult = $this->process($message);

                if ($queue->canDeleteMessage()) {
                    $queue->delete($message);
                }
            }
            // TODO: else?
        }

        return $lastResult;
    }
996945
public function receiveMessages($queueName, $chunkSize = 100, array $options = [])
    {
        $this->channel->callbacks = [];

        /** @var \Generated\Shared\Transfer\RabbitMqConsumerOptionTransfer $rabbitMqOption */
        $rabbitMqOption = $options['rabbitmq'];

        $this->channel->basic_qos(null, $chunkSize, null);
        $consumerTag = $this->channel->basic_consume(
            $queueName,
            $rabbitMqOption->getConsumerTag(),
            $rabbitMqOption->getNoLocal(),
            $rabbitMqOption->getNoAck(),
            $rabbitMqOption->getConsumerExclusive(),
            $rabbitMqOption->getNoWait(),
            [$this, 'collectQueueMessages']
        );

        try {
            while (count($this->channel->callbacks)) {
                $this->channel->wait(null, false, self::DEFAULT_CONSUMER_TIMEOUT_SECONDS);
            }
        } catch (Throwable $e) {
            $this->channel->basic_cancel($consumerTag);
        }

        return $this->retrieveCollectedMessages();
    }
29468
protected function createQueueAndBind(RabbitMqOptionTransfer $queueOption, $exchangeQueueName)
    {
        $this->queueEstablishmentHelper->createQueue($this->channel, $queueOption);

        if ($queueOption->getRoutingKeys() === null) {
            return;
        }

        foreach ($queueOption->getRoutingKeys() as $routingKey) {
            $this->bindQueues($queueOption->getQueueName(), $exchangeQueueName, $routingKey);
        }
    }
1050011
protected function publishOnRoutingKey(QueueReceiveMessageTransfer $queueReceiveMessageTransfer): void
    {
        if ($queueReceiveMessageTransfer->getRoutingKey()) {
            $message = new AMQPMessage($queueReceiveMessageTransfer->getQueueMessage()->getBody());
            $this->channel->basic_publish($message, $queueReceiveMessageTransfer->getQueueName(), $queueReceiveMessageTransfer->getRoutingKey());
        }
    }
788331
public function pushToQueue($queue, $message)
    {
        $message = $message instanceof AMQPMessage
            ? $message
            : new AMQPMessage($message);

        $this->getChannel()->queue_declare($queue);
        $this->getChannel()->basic_publish($message, '', $queue);
    }
1048688
public function getAllMessages($callback)
    {

        $channel = $this->connection->channel();

        // Exchange setup
        $this->setupExchange($this->exchangeOptions['name'], $this->exchangeOptions['type'], $channel);

        foreach ($this->queueOptions as $queueOption) {
            // Queue setup
            list($channel, ) = $this->setupQueue($queueOption['name'], $channel);

            // Bind the queue to the exchange
            $channel->queue_bind($queueOption['name'], $this->exchangeOptions['name'], $queueOption['bindingKey']);
        }

        $this->channel = $channel;
        $data = [];
        while ($message = $this->channel->basic_get($queueOption['name'])) {
            if ($message->delivery_info) {
                $message->delivery_info['channel'] = $this->channel;
                $data[] = $message;
            }
        }

        call_user_func($callback, $data);
        $this->channel->close();
    }
771832
public function expandCustomerTransferWithProductListIds(CustomerTransfer $customerTransfer): CustomerTransfer
    {
        $customerTransfer->setCustomerProductListCollection(new CustomerProductListCollectionTransfer());

        $productListCollectionTransfer = $this->productListReader->getProductListCollectionByIdCustomerId(
            $customerTransfer
        );

        $this->addProductListsToCustomerTransfer($customerTransfer, $productListCollectionTransfer);

        return $customerTransfer;
    }
516027
public function sendMessage($queueName, QueueSendMessageTransfer $queueSendMessageTransfer)
    {
        $message = $this->createMessage($queueSendMessageTransfer);
        $publishChannels = $this->getChannels($queueSendMessageTransfer);
        $routingKey = $queueSendMessageTransfer->getRoutingKey();

        $this->publish($message, $queueName, $routingKey, $publishChannels);
    }
184868
protected function queueDeclareOk(\AMQP\Wire\Reader $args)
    {
        $queue = $args->readShortstr();
        $messageCount = $args->readLong();
        $consumerCount = $args->readLong();

        return array($queue, $messageCount, $consumerCount);
    }
712263
private function getMessageHeader(AMQPMessage $message, $header)
    {
        $headers = $message->has('application_headers') ? $message->get('application_headers') : [];

        return array_key_exists($header, $headers) ? $headers[$header] : null;
    }