This commit is contained in:
Oliver Davies 2018-02-27 08:59:28 +00:00
parent 295243d677
commit 6038656ba5
2 changed files with 15 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 KiB

View file

@ -26,9 +26,15 @@ $queuer = \Drupal::service('private_message_queue.queuer');
$queuer->queue($recipients, $message, $owner); $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 ## 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). 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 <queue-name>` 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 [0]: https://www.drupal.org/project/private_message
[1]: https://www.drupal.org/project/ultimate_cron [1]: https://www.drupal.org/project/ultimate_cron