1 cron_example.module cron_example_cron_queue_info()

Implements hook_cron_queue_info().

hook_cron_queue_info() and family allow any process to add work to the queue to be acted on when cron runs. Queues are described and worker callbacks are provided, and then only the worker callback needs to be implemented.

All the details of queue use are done by the cron_queue implementation, so one doesn't need to know much about BackdropQueue().

See also

queue_example.module

Related topics

File

modules/examples/cron_example/cron_example.module, line 215
Demonstrates use of the Cron API in Backdrop - hook_cron()

Code

function cron_example_cron_queue_info() {
  $queues['cron_example_queue_1'] = array(
    'worker callback' => 'cron_example_queue_1_worker',
    // One second max runtime per cron run.
    'time' => 1,
  );
  $queues['cron_example_queue_2'] = array(
    'worker callback' => 'cron_example_queue_2_worker',
    'time' => 10,
  );
  return $queues;
}