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 function for each queue item.
    'time' => 25, // This is the max run time per cron run in seconds.
  return $queues;

function module_name_load_queue($item) {
  $queue = DrupalQueue::get('my_queue_name');

My ultimate goal is to pre-process data using a few bash scripts and then pass the end result to module_name_load_queue($item); using Drush.

Is this possible? If so, how do I go about this?

2 Answers 2


Yes We can use drush queue run to initiate a queue

Example :

SLEEP=${2} #Make the sleep time as configurable
while true
   drush5 --uri=${1} queue-run <Your QUEUE NAME> #${1} Domain URI
   sleep ${SLEEP}
  • I'm looking to load (fill) a queue using drush rather than start a queue. Thank you though as this will be useful in the next step.
    – Citricguy
    Mar 10, 2014 at 23:13

The most common practice is to create a custom cron job that populates the queue. Failing that you could use drush ev "my_callback()" to accomplish this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.