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;
//Add GUID into the queue so we can work with it on cron
$queue = DrupalQueue::get('custom_application_guid_queue');
$queue->createQueue();
$queue->createItem($guid_to_enqueue);
}
I then have
function custom_application_cron_queue_info() {
$queues[ 'custom_application_guid_queue' ] = array(
'worker callback' => '_custom_application_guid_item',
'time' => 30,
);
watchdog('custom_application_ques_on_cron', '<pre>' . print_r($queues, TRUE) . '</pre>');
return $queues;
}
I think the problem is when I try and use the callback. I am not sure how to iterate over my data that is in the queue. I know it is in the queue using Drush and if I use Watchdog() with $guid_to_enqueue I can see the right value in the variable.
function _custom_application_guid_item($queues) {
foreach($queues as $quid_item) {
watchdog('custom_application_guid_item_foreach', $quid_item);
}
}
Any help with figuring out what I am doing wrong here is greatly appreciated. I have also tried getting the number of items in the queue but nothing is getting that far in my code.
I will add that I will rarely have more than two items in the queue if that changes anything.
Thanks, Josh