Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试传递一些数据或操作结果的标识符,例如“true”或“false”。目前我只能根据完成和失败的回调来考虑任务的返回码。您能否就如何将数据传递给结果提供一些想法。
我已经弄清楚了这一点。我所做的是在客户端上包含一个 setCompleteCallback,在工作人员上包含一个 sendComplete。通过 sendComplete 发送的序列化数据可以被注册的回调使用 setComplete 接收。
在工人: $client->setCompleteCallback('onComplete'); 函数 onComplete($job){ ... } 在客户端: $worker->sendComplete('这是数据!');