Did you ever want a queue that only accepts unique items? This module provides a way of doing that. If you try to insert a duplicated item in the queue, the item is ignored.

// $data can be anything.
$data = ['Lorem', 'ipsum'];
$queue_name = 'your_queue_name';
$queue = \Drupal::service('queue')->get($queue_name);
$queue->createItem($data);
// This will insert a duplicate, and will return FALSE.
if ($queue->createItem($data) === FALSE) {
 // The item was a duplicate, respond appropriately.
}

Usage

In order for your queue to use the Queue Unique you need to update your settings.php file:

$settings['queue_service_your_queue_name'] = 'queue_unique.database';
Supporting organizations:
Development and maintenance

Project information

Releases

4.0.0 Stable release covered by the Drupal Security Team released 18 April 2025
Works with Drupal: ^10.2 || ^11

Drupal 11 support and require 10.2+

Install:

Development version: 4.x-dev updated 18 Apr 2025 at 20:42 UTC

3.0.2 Stable release covered by the Drupal Security Team released 31 May 2023
Works with Drupal: ^8.7.7 || ^9 || ^10
Install:

Development version: 3.x-dev updated 31 May 2023 at 08:23 UTC