Skip to content

Instantly share code, notes, and snippets.

@pcambra
Created October 18, 2018 09:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcambra/4979c15b4856a8ada4866d97ac4820ff to your computer and use it in GitHub Desktop.
Save pcambra/4979c15b4856a8ada4866d97ac4820ff to your computer and use it in GitHub Desktop.
Drupal 8: Process a queue programmatically
$queue_factory = \Drupal::service('queue');
$queue_manager = \Drupal::service('plugin.manager.queue_worker');
$queue_worker = $queue_manager->createInstance('queue_name');
$queue = $queue_factory->get('queue_name');
$item = $queue->claimItem();
$queue_worker->processItem($item->data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment