diff --git a/assets/images/blog/private-message-queue.png b/assets/images/blog/private-message-queue.png new file mode 100644 index 00000000..815af133 Binary files /dev/null and b/assets/images/blog/private-message-queue.png differ diff --git a/source/_posts/2018-02-27-queuing-private-messages-in-drupal-8.md b/source/_posts/2018-02-27-queuing-private-messages-in-drupal-8.md index 8eda5d03..7656709f 100644 --- a/source/_posts/2018-02-27-queuing-private-messages-in-drupal-8.md +++ b/source/_posts/2018-02-27-queuing-private-messages-in-drupal-8.md @@ -26,9 +26,15 @@ $queuer = \Drupal::service('private_message_queue.queuer'); $queuer->queue($recipients, $message, $owner); ``` -These three pieces of data are then saved as part of the queued item. +These three pieces of data are then saved as part of the queued item. You can see these by checking the "queue" table in the database or by running `drush queue-list`. -Add screenshot of queue. +![](/assets/images/blog/private-message-queue.png) + +``` +$ drush queue-list +Queue Items Class +private_message_queue 19 Drupal\Core\Queue\DatabaseQueue +``` ## Processing the Queue @@ -38,5 +44,12 @@ It uses the `PrivateMessageThread` class from the Private Message module to find The queue is processed on each cron run, so I recommend adding a module like [Ultimate Cron][1] so that you can process the queued items frequently (e.g. every 15 minutes) and run the heavier tasks like checking for updates etc less frequently (e.g. once a day). +You can also process the queue manually with Drush using the `drush queue-run ` command - e.g. `drush queue-run private_message_queue`. + +``` +$ drush queue-run private_message_queue +Processed 19 items from the private_message_queue queue in 3.34 sec. +``` + [0]: https://www.drupal.org/project/private_message [1]: https://www.drupal.org/project/ultimate_cron