Questions tagged [queue]

Use it for the Drupal API that provides a means for storing items into a processing queue.

Filter by
Sorted by
Tagged with
2 votes
2 answers
1k views

Loading a queue?

How can I use Drush to pass data into a Drupal Queue? function hook_cron_queue_info() { $queues['my_queue_name'] = array( 'worker callback' => '_my_queue_callback', // This is the callback ...
2 votes
2 answers
394 views

Abstract Base Class versus Service with Queue API

I'm trying to figure out the best way to structure a custom module that uses the Queue API in D8. I'm new to D8 and a bit rusty with OOP so forgive me if I'm breaking some recommended design pattern ...
0 votes
1 answer
381 views

How to create queue for email sending

I am using PepiPost mail service and I created custom mail system class for integrating PepiPost service. I can successfully send email from Drupal site. If a connection timeout 504 occurs during ...
3 votes
1 answer
682 views

Sorting a view on a taxonomy term with entityqueue

I'm trying to use an entity queue on a taxonomy to create a new sort order for an existing view. But I'm having trouble configuring it. I've created a dummy website with a fantasy role-playing game ...
3 votes
5 answers
2k views

How to prevent adding of duplicate item to Drupal Queue?

I am using Drupal Queue (Class DrupalQueue) to store items (a simple objects). How can I check if there is already the same object in the queue before adding a new one ?
2 votes
1 answer
163 views

getPluginDefinition custom QueueWorker empty after upgrade

I've got a custom queue worker that used to work fine in Drupal 9, but stopped working after the upgrade to Drupal 10. I've narrowed it down to the getPluginDefinition method not returning anything. ...
0 votes
0 answers
53 views

How to trigger contrib module service function by route from my modules QueueWorker plugin processItem() function

I'm working on a custom module that creates a queue for a contributed module "the streaming module" to be specific where my module is called streaming_transcode_queue. In my module I have a ...
0 votes
1 answer
136 views

How can I delete an item depending on the processing result?

I have a queue that is processed while cron run. processItem($data) checks some requirements. How can I delete an item when some requirements are not met? Can I update an item (the $data array) and &...
2 votes
1 answer
343 views

How to create a QueueWorker and run it without cron

Can someone please help me with an example on how to create a QueueWorker class, add items, and run it inside hook_ENTITY_TYPE_presave() or anywhere in a module file? Basically, what I want is adding ...
7 votes
3 answers
600 views

How can I run the inbuilt Drush 10.x commands as user #1?

I have a Drupal Queue worker class that fetches the Entity objects from Drupal to index to Elasticsearch. The following command is causing the lesser documents to show up in Elasticsearch since by ...
3 votes
4 answers
7k views

How to check if an item exists in a Queue?

While inserting items in a Queue how can I check if the item I am trying to insert is already present in the Queue?
2 votes
0 answers
75 views

Variations created with a queue worker sluggishly slow

The site my team is currently building is meant to import a list of all available trips for a travel booking agency. The method we settled for (for now) can be summarized as such : A daily cron job ...
4 votes
2 answers
2k views

How to process more than one item from queue in each run?

I have set up a queue using this code. function custom_logger_cron_queue_info() { $queues['custom_logger'] = array( 'worker callback' => 'custom_logger_import', 'time' => 60, ); ...
1 vote
0 answers
215 views

Queue API - Run a function after a queue has finished?

I have created a custom queue that imports entities from an external api. During each queue item process I want to save the id of the created/updated entity, and at the end of the queue I want to use ...
1 vote
0 answers
291 views

How to execute migration in queue through cron run?

I am migrating some nodes from an API. The API only accepts 60 requests per minute. So it means if 60 items are imported in a minute, all other items will not be imported because the API will return ...
0 votes
0 answers
124 views

EntitySubqueue save() only working with die() following it

I am trying to add an item to a sub-queue automatically on save. And for some reason, it only works if I include die() afterwards. This adds the new node to the queue function ...
0 votes
1 answer
333 views

How to get the base URL of a site in Queue API?

I am trying to get the base url of the drupal 8 website in a queue process but I am getting http://default as the base url. What am I missing here? public function testUrl() { global $base_url; ...
4 votes
0 answers
947 views

Using multiple keys on multi row db_merge?

I am using db_merge (mysql) for getting jobs into my queues. I therefore have each task only once (the job is quite intensive and many things can trigger the task to be queued, so want to avoid ...
4 votes
1 answer
2k views

How to run a cron queue programmatically?

I have created a cron queue like given below. function mymodule_cron_queue_info() { $queues['aggregator_feeds'] = array( 'worker callback' => 'aggregator_refresh', 'time' => 60, ); ...
-1 votes
1 answer
214 views

Why is my custom webform handler, when called via cron, doesn't load and email attachments?

I created a custom webform handler that on postSave adds webform id to the queue: public function postSave(WebformSubmissionInterface $webform_submission, $update = TRUE) { $item = array( '...
1 vote
2 answers
1k views

How to process single queue item using QueueWorker on cron runs?

For each cron run, I would like to be able to process only 1 item in my queue using QueueWorker. At the moment it seems to me that Drupal keep processing items until it reaches the time parameter for ...
2 votes
0 answers
1k views

How can I have a single QueueWorker run on cron for multiple Queues?

I have a site in which I associate multiple Config Entities with a single Queue ie. example_queue (using the default QueueInterface). My Config Entities produce records that are processed as queue ...
12 votes
4 answers
21k views

How do I clear or delete a queue?

I scheduled a big queue with VBO, but I changed my mind. How can I delete it? I don't seem to find any UI/interface to manage queues. Do I have to delete it in the database?
2 votes
1 answer
82 views

How to resave all user accounts on a schedule?

I want to re-save all user accounts on my site weekly because I wrote some code in hook_user_presave() that I want to update every week. Specifically, my hook_user_presave() code updates the values of ...
2 votes
1 answer
763 views

How do I create a derivative?

I would like to create a queue derivative, where I can use a single QueueWorker class to process multiple queues, but I am not able to achieve it. Any help would be greatly appreciated. The module ...
2 votes
0 answers
175 views

How to schedule content every Wednesday at 18.00 (6 PM)?

Looking for something which was easy in Drupal 7, but can't find it or can't get it to work in Drupal 8. import feed do not publish content immediately run a rule that sets the content to publish ...
1 vote
1 answer
430 views

Job queue – dealing with stuck records

I have a cron job that gets stuck because I have a loop claiming items from the queue that ends on numberOfItems() == 0, which never happens because one of the queue items is stuck and cannot be ...
0 votes
0 answers
681 views

How To Get Item_id value in ProcessItem function

I developed a custom module which will process my items in queue. I have some custom table and custom action buttons to Process queue items. When i click on "Process Queue" button it will call the ...
2 votes
1 answer
447 views

Exception in worker callback prevents queue item from being removed

I have created a Drupal 7 module that utilizes hook_cron() and hook_cron_queue_info() to process some data, as well as use the module Ultimate Cron to handle scheduling when each runs. hook_cron() is ...
0 votes
1 answer
307 views

Queue Implementation for third party api

In my website I have a form and which submits data to third party website. that api is available some time and not available some time. I need to create a queue mechanism to insert failed api calls ...
7 votes
2 answers
9k views

Running a queue worker without using cron tasks

I implemented hook_queue_info() with the following code. function ecc_general_queue_info() { $queues = array(); $queues['adding_checklist'] = array( 'worker callback' => '...
4 votes
2 answers
3k views

Get cron to process QueueWorker items at a specific time

I have a Plugin\QueueWorker that creates a queue of emails to send from nodes that are created/updated throughout the day. I've defined a processItem() method, as well as an arbitrary function (let's ...
0 votes
3 answers
241 views

Create a Term Queue on views

I have a views showing some selected terms of a vocabulary. The Views block is created using Taxonomy Terms as content(show). It showing order by the terms tree. But my client want to sort it as their ...
0 votes
1 answer
138 views

Plugin Derivatives For Queue and Migration Plugins

I've created a custom Content Entity and a custom Content Entity Type, basically I'm mirroring the Node module but the purpose of this is to have external data to be synced with this setup(not using ...
32 votes
5 answers
17k views

Do I need a cron task for processing a queue?

I've got a task that takes about 45 minutes to complete and needs to happen every day (synching users to several external database, etc). To handle the work, I've set up a cron queue with ...
1 vote
1 answer
65 views

Test a settings form that displays a queue

I'm trying to write a test on a settings form. The module uses a queue, and the settings form displays the items in the queue like so: When I extend the test class from WebTestBase I get: Drupal\...
0 votes
1 answer
211 views

Determine Next Item in DrupalQueue for Drupal 7

I am trying to figure out how Drupal pulls what will be the next item to be processed in the queue for Drupal 7. I have looked at SystemQueue::claimItem and I am missing something. I have a queue ...
3 votes
1 answer
94 views

How to troubleshoot my VBO operation which freezes at 50% every time?

I have written custom code that creates a new action for Views Bulk Operations (VBO). I am trying to run the action and it gets stuck at "Prepared 46748 out of 46766". If I run the same action with ...
2 votes
3 answers
4k views

When should I "send mail by queue" with the SMTP module?

On the SMTP module configuration page at /admin/config/system/smtp, it offers the option to Send mail by queue (Mails will be sent by drupal queue api.). When would I want to check this box? What ...
1 vote
2 answers
2k views

Auto add nodes on save to a queue using entityqueue

I am using entity queue module, Created a queue with a name ABC. I want to add nodes automatically to this queue for a specific content type while creating new nodes. Is there a way to do this?
0 votes
1 answer
526 views

Using Drupal Queue

I think I am close to getting a queue to work with the Drupal 7 Queue API. I have some code that returns a value to me that I want to retrieve on cron. function ...{ $guid_to_enqueue = $guid; /...
1 vote
2 answers
2k views

Drupal queue processing at cron run

I use ultimate cron to fill in a queue with some nids. To add the items in the queue, I use something like: $queue = DrupalQueue::get('my_queue'); foreach($urls as $nid=>$url){ sleep(1); $...
0 votes
1 answer
312 views

Ultimate Cron. Invoke a cron from a cron. Set a cron enabled status to TRUE till its queue gets empty. Then set it to FALSE

I am using Ultimate Cron for running individual cron runs and I see Ultimate Cron provide hook_cronapi() to create own cron task runs and provide enabled key as either TRUE or FALSE. My objective is ...
3 votes
1 answer
93 views

How to detect insertion of new item(s) into Drupal's queue?

I need to trigger some code when new items are added to Drupal's queue system. My question, how to do that? How to capture that event? Further details I have created a custom views bulk operation ...
0 votes
1 answer
1k views

How to manage by cron a long-running queue of very many items

I'm creating a File Checker module that verifies files managed by Drupal actually exist at the uri where Drupal believes they are. It places an item in a queue for each file entity. As there could be ...
0 votes
1 answer
155 views

Revisions revert unexpectedly

I have a really horrible intermittent bug where a collection of nodes will reset to a previous revision. Here is an image of the revisions tab on the node: There are three unusual aspects: The '...
0 votes
1 answer
125 views

hook_cron_queue_info stopped

I'm trying to use Drupal Queue and Cron to execute a task. In the following example I: select all the users create an item in the queue for each of them define the function that has to be run for ...
0 votes
1 answer
517 views

Insert task to Queue only if unique

I wanted a way to only insert items into the Queue when it was not already added. I want to have a large queue and work my way through it, simply adding as required. Previously I was deleting the ...
1 vote
0 answers
66 views

How should I use the Queue Runner module?

I would like to run tasks in sequence (commerce product feed before commerce node feed). I think the Queue Runner module could do the job. However, I can't find sufficient examples of how to implement ...
0 votes
2 answers
311 views

Trying to update node using node_save() produces integrity constraint exception

This is the first time I've tried to do this so I may be missing something really obvious. I'm developing a module which uses hook_node_insert() to catch the creation of a node, and puts the node into ...