开发者

Passing a return to specify the result of a callback function on the GearmanWorker

I am trying to pass some data or an identifier of the result of the operation like 'true' or 'false'. For now I can only think of the return code of the task based on the callback for complete and failed. Can开发者_JAVA百科 you give some ideas on how to pass data to the result.


I have figured out this one. What I did is that I include a setCompleteCallback on the client and a sendComplete on the the worker. A serialized data sent through sendComplete can be received by the registered callback using setComplete.

At worker:
$client->setCompleteCallback('onComplete');
function onComplete($job){
...
}
At client:
$worker->sendComplete('This is the data!');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜