Php Gearman后台作业状态回调

Php Gearman后台作业状态回调,php,gearman,Php,Gearman,我正在处理Gearman的背景任务 如果您在中阅读代码示例,您将看到以下注释: /* Poll the server to see when those background jobs finish; */ /* a better method would be to use event callbacks */ 这些事件回调到底是什么 我尝试了以下方法: $client->setCreatedCallback(function(GearmanTask $task){ }

我正在处理Gearman的背景任务

如果您在中阅读代码示例,您将看到以下注释:

/* 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()添加任务时,它们都不会触发


谢谢。

后台任务之所以称为此类任务,是因为它们允许提交它们的客户端取消阻止并断开连接。他们没有向客户端开放通信渠道,因此您不会得到任何状态更新。 如果要检查后台作业的状态,请使用GearmanClient::jobStatus。 见和