You are here

function hook_mob_queue_queue_item_processed in Drush Queue Handling 7

A queue item has been processed.

Modules are notified after an item has been processed. If the item processing failed (the worker function raised an exception), the $exception parameter will be the raised Exception object.

Parameters

string $queue_name: The queue name.

$item: The processed item object. @see DrupalQueueInterface::claimItem

$exception: If the item's processing failed, the Exception object. Otherwise, it will be NULL.

1 invocation of hook_mob_queue_queue_item_processed()
drush_mob_queue_mob_exe_queue in ./mob_queue.drush.inc
Run the queued job.

File

./mob_queue.api.php, line 99
Hooks provided by the Drush Queue Handling module.

Code

function hook_mob_queue_queue_item_processed($queue_name, $item, $exception) {
  $watchdog_vars = array(
    '@item-id' => $item->item_id,
    '@queue-name' => $queue_name,
  );
  if (is_null($exception)) {
    $msg = 'Successfully processed item @item-id from @queue-name queue.';
    $severity = WATCHDOG_INFO;
  }
  else {
    $msg = 'Item @item-id from @queue-name queue raised an exception: @exception-message';
    $severity = WATCHDOG_ERROR;
    $watchdog_vars['@exception-message'] = $exception
      ->getMessage();
  }
  watchdog('mymodule', $msg, $watchdog_vars, $severity);
}