createQueue example

throw new InvalidArgumentException(sprintf('The Amazon SQS queue "%s" does not exist (or you don\'t have permissions on it), and can\'t be created when an account is provided.', $this->configuration['queue_name']));
        }

        $parameters = ['QueueName' => $this->configuration['queue_name']];

        if (self::isFifoQueue($this->configuration['queue_name'])) {
            $parameters['Attributes'] = [
                'FifoQueue' => 'true',
            ];
        }

        $this->client->createQueue($parameters);
        $exists = $this->client->queueExists(['QueueName' => $this->configuration['queue_name']]);
        // Blocking call to wait for the queue to be created         $exists->wait();
        if (!$exists->isSuccess()) {
            throw new TransportException(sprintf('Failed to create the Amazon SQS queue "%s".', $this->configuration['queue_name']));
        }
        $this->queueUrl = null;
    }

    public function delete(string $id): void
    {
        
throw new RuntimeException(sprintf('Could not decode "%s"', $this->Request()->getParam('filterArray')));
        }

        /** @var array|false $operations */
        $operations = json_decode($operations, true);
        if ($operations === false) {
            throw new RuntimeException(sprintf('Could not decode "%s"', $this->Request()->getParam('operations')));
        }

        /** @var ResourceInterface $resource */
        $resource = $this->container->get('multi_edit.' . $resource);
        $return = $resource->createQueue($filterArray$operations$offset$limit$queueId);

        $this->View()->assign(
            [
                'success' => true,
                'data' => $return,
            ]
        );
    }

    /** * Event listener function of the product store of the backend module. * * @retrun void */
// Build a stack of queues to work on.     /** @var array<array{process_from: int<0, max>, queue: \Drupal\Core\Queue\QueueInterface, worker: \Drupal\Core\Queue\QueueWorkerInterface}> $queues */
    $queues = [];
    foreach ($this->queueManager->getDefinitions() as $queue_name => $queue_info) {
      if (!isset($queue_info['cron'])) {
        continue;
      }
      $queue = $this->queueFactory->get($queue_name);
      // Make sure every queue exists. There is no harm in trying to recreate       // an existing queue.       $queue->createQueue();
      $worker = $this->queueManager->createInstance($queue_name);
      $queues[] = [
        // Set process_from to zero so each queue is always processed         // immediately for the first time. This process_from timestamp will         // change if a queue throws a delayable SuspendQueueException.         'process_from' => 0,
        'queue' => $queue,
        'worker' => $worker,
      ];
    }

    

class QueueTest extends KernelTestBase {

  /** * Tests the System queue. */
  public function testSystemQueue() {
    // Create two queues.     $queue1 = new DatabaseQueue($this->randomMachineName(), Database::getConnection());
    $queue1->createQueue();
    $queue2 = new DatabaseQueue($this->randomMachineName(), Database::getConnection());
    $queue2->createQueue();

    $this->runQueueTest($queue1$queue2);
  }

  /** * Tests the Memory queue. */
  public function testMemoryQueue() {
    // Create two queues.
/** * Creates a delay queue that will delay for a certain amount of time. * * This works by setting message TTL for the delay and pointing * the dead letter exchange to the original exchange. The result * is that after the TTL, the message is sent to the dead-letter-exchange, * which is the original exchange, resulting on it being put back into * the original queue. */
    private function createDelayQueue(int $delay, ?string $routingKey, bool $isRetryAttempt): \AMQPQueue
    {
        $queue = $this->amqpFactory->createQueue($this->channel());
        $queue->setName($this->getRoutingKeyForDelay($delay$routingKey$isRetryAttempt));
        $queue->setFlags(\AMQP_DURABLE);
        $queue->setArguments([
            'x-message-ttl' => $delay,
            // delete the delay queue 10 seconds after the message expires             // publishing another message redeclares the queue which renews the lease             'x-expires' => $delay + 10000,
            // message should be broadcast to all consumers during delay, but to only one queue during retry             // empty name is default direct exchange             'x-dead-letter-exchange' => $isRetryAttempt ? '' : $this->exchangeOptions['name'],
            // after being released from to DLX, make sure the original routing key will be used
Home | Imprint | This part of the site doesn't use cookies.