You are here

Example: Queue in Examples for Developers 8

Same name and namespace in other branches
  1. 7 queue_example/queue_example.module \queue_example
  2. 3.x modules/queue_example/queue_example.module \queue_example

Demonstrating the Queue API

The Queue API provides a traditional FIFO (first-in-first-out) queue, but also provides the concepts of:

  • "Creating" a queued item, which means inserting it into a queue.
  • "Claiming" a queued item, which essentially means requesting the next item from the queue and holding a lock on that item for a specified period of time.
  • "Releasing" an item, which means giving up a claim but leaving the item in the queue.
  • "Deleting" an item, which means finally removing it from the queue.

This example demonstrates only basic queue functionality, and will use the default queue implementation, which is SystemQueue, managed using persistent database storage.

Further resources include the limited Queue operations documentation. More:

Batch vs Queue Presentation slides by John VanDyk session video.

Parent topics

File

queue_example/queue_example.module, line 8
Demonstrates use of the Queue API in Drupal.

Classes

Namesort descending Location Description
QueueExampleTest queue_example/tests/src/Functional/QueueExampleTest.php Tests that our queue_example functions properly.