Skip to content

Instantly share code, notes, and snippets.

@hjr3
Created August 20, 2011 21:35
Show Gist options
  • Save hjr3/1159694 to your computer and use it in GitHub Desktop.
Save hjr3/1159694 to your computer and use it in GitHub Desktop.
pecl/gearman client exception callback example
<?php
$gmc= new GearmanClient();
$gmc->addServer();
$gmc->setExceptionCallback(function(GearmanTask $task) {
$m = $task->data();
echo "Exception: {$m}\n";
return GEARMAN_WORK_EXCEPTION;
});
$gmc->addTask('test', 'workload');
$gmc->runTasks();
var_dump($gmc->returnCode());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment