I implemented hook_queue_info()
with the following code.
function ecc_general_queue_info() {
$queues = array();
$queues['adding_checklist'] = array(
'worker callback' => '_ecc_general_apply_queue',
'time' => 60,
);
return $queues;
}
I create items for the queue with the following code.
$queue_factory = \Drupal::service('queue');
$queue = $queue_factory->get('adding_checklist');
$queue->createItem([$node, 'insert']);
The callback function is the following.
function _ecc_general_apply_queue($item) {
// Some code here.
}
I want to run this callback for each item in the queue. How can I process the queue to execute its worker callback for each item?
I don't want to use cron tasks for processing the queue.
hook_entity_update
and successfully called my callback function inside of that hook. Now I want to run this callback function byQueue
, so that I want to run this function for each item in the queue.hook_general_queue_info
doesn't seem to exist. If you need to run your queue not with cron, then you need to code your own way of running the queue. There could be any number of ways to do this, but looking at how cron runs through queues would be a start. There might be some queue runner modules that fit your use case.