phpday 2027 - Call for Papers

GearmanClient::setStatusCallback

(PECL gearman >= 0.5.0)

GearmanClient::setStatusCallback — Set a callback for collecting task status

説明

public function GearmanClient::setStatusCallback(callable $callback): bool

Sets a callback function used for getting updated status information from a worker.

注意:

このコールバックは、このメソッドを呼び出した後に追加されたタスク(例: GearmanClient::addTask() を呼び出して追加されたタスク)に対してのみ実行されます。

パラメータ

callback

呼び出す関数またはメソッド。有効な Gearmanの値 を返す必要があります。

return 文が存在しない場合、デフォルトで GEARMAN_SUCCESS が返されます。

function callback(GearmanTask $task, mixed $context): int
task

このコールバックが呼び出されるタスク。

context

GearmanClient::addTask() (または同等のメソッド) に context として渡されたもの。

戻り値

成功した場合に true を、失敗した場合に false を返します。

参考

User Contributed Notes

There are no user contributed notes for this page.
Adding new notes is disabled. Please see the links in the Found A Problem? section.
To Top