8.5.x Drupal.php Drupal::queue($name, $reliable = FALSE)
8.0.x Drupal.php Drupal::queue($name, $reliable = FALSE)
8.1.x Drupal.php Drupal::queue($name, $reliable = FALSE)
8.2.x Drupal.php Drupal::queue($name, $reliable = FALSE)
8.3.x Drupal.php Drupal::queue($name, $reliable = FALSE)
8.4.x Drupal.php Drupal::queue($name, $reliable = FALSE)
8.6.x Drupal.php Drupal::queue($name, $reliable = FALSE)

Returns a queue for the given queue name.

The following values can be set in your settings.php file's $settings array to define which services are used for queues:

  • queue_reliable_service_$name: The container service to use for the reliable queue $name.
  • queue_service_$name: The container service to use for the queue $name.
  • queue_default: The container service to use by default for queues without overrides. This defaults to 'queue.database'.

Parameters

string $name: The name of the queue to work with.

bool $reliable: (optional) TRUE if the ordering of items and guaranteeing every item executes at least once is important, FALSE if scalability is the main concern. Defaults to FALSE.

Return value

\Drupal\Core\Queue\QueueInterface The queue object for a given name.

File

core/lib/Drupal.php, line 381
Contains \Drupal.

Class

Drupal
Static Service Container wrapper.

Code

public static function queue($name, $reliable = FALSE) {
  return static::getContainer()
    ->get('queue')
    ->get($name, $reliable);
}