我正在处理 Gearman 的后台任务。
如果您在http://www.php.net/manual/en/gearmanclient.addtaskstatus.php阅读代码示例,您将看到以下注释:
/* Poll the server to see when those background jobs finish; */
/* a better method would be to use event callbacks */
这些事件回调到底是什么?
我尝试了以下方法:
$client->setCreatedCallback(function(GearmanTask $task){
});
$client->setExceptionCallback(function(GearmanTask $task){
});
$client->setFailCallback(function(GearmanTask $task){
});
但是当使用 $client->doBackground() 添加任务时,它们都不会触发。
谢谢。