How does the queue system work in Drupal?

How does the queue system work in Drupal?

The queue system allows placing items in a queue and processing them later. The system tries to ensure that only one consumer can process an item. Before a queue can be used it needs to be created by DrupalQueueInterface::createQueue ().

Can a queue be used more than once?

Queue operations. As described in the processing section, regardless of the queue being reliable or not, the processing code should be aware that an item might be handed over for processing more than once (because the processing code might time out before it finishes).

When do I delete an item in Drupal?

When finished processing, the item needs to be deleted by calling DrupalQueueInterface::deleteItem (). If the consumer dies, the item will be made available again by the DrupalQueueInterface implementation once the lease expires. Another consumer will then be able to receive it when calling DrupalQueueInterface::claimItem ().

What happens when a consumer dies in Drupal?

If the consumer dies, the item will be made available again by the DrupalQueueInterface implementation once the lease expires. Another consumer will then be able to receive it when calling DrupalQueueInterface::claimItem (). Due to this, the processing code should be aware that an item might be handed over for processing more than once.

What’s the difference between promise queue and job queue?

Promise then calls on fulfilled promises place jobs in the promise queue, which get executed with higher priority than timer call backs. The promise queue only becomes empty after console.log(3) has been executed, which allows the timer call back to execute.

What are the two types of queue operations?

Queue operations. There are two kinds of queue backends available: reliable, which preserves the order of messages and guarantees that every item will be executed at least once. The non-reliable kind only does a best effort to preserve order in messages and to execute them at least once but there is a small chance that some items get lost.