本文整理匯總了PHP中GearmanClient::setStatusCallback方法的典型用法代碼示例。如果您正苦於以下問題:PHP GearmanClient::setStatusCallback方法的具體用法?PHP GearmanClient::setStatusCallback怎麽用?PHP GearmanClient::setStatusCallback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GearmanClient
的用法示例。
在下文中一共展示了GearmanClient::setStatusCallback方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: initCallbacks
public function initCallbacks()
{
$this->client->setStatusCallback([$this, 'handleStatus']);
$this->client->setDataCallback([$this, 'handleData']);
$this->client->setCompleteCallback([$this, 'handleComplete']);
$this->client->setFailCallback([$this, 'handleFail']);
$this->client->setWarningCallback([$this, 'handleWarning']);
return null;
}
示例2: assignTaskCallbacks
/**
* Assign all GearmanClient callbacks as Symfony2 events
*
* @param \GearmanClient $gearmanClient Gearman client
*
* @return GearmanCallbacksDispatcher self Object
*/
public function assignTaskCallbacks(\GearmanClient $gearmanClient)
{
$gearmanClient->setCompleteCallback(array($this, 'assignCompleteCallback'));
$gearmanClient->setFailCallback(array($this, 'assignFailCallback'));
$gearmanClient->setDataCallback(array($this, 'assignDataCallback'));
$gearmanClient->setCreatedCallback(array($this, 'assignCreatedCallback'));
$gearmanClient->setExceptionCallback(array($this, 'assignExceptionCallback'));
$gearmanClient->setStatusCallback(array($this, 'assignStatusCallback'));
$gearmanClient->setWarningCallback(array($this, 'assignWarningCallback'));
$gearmanClient->setWorkloadCallback(array($this, 'assignWorkloadCallback'));
}
示例3: reverse_status
<?php
# The client script
# create our gearman client
$gmc = new GearmanClient();
# add the default job server
$gmc->addServer();
# set a couple of callbacks so we can track progress
$gmc->setCompleteCallback("reverse_complete");
$gmc->setStatusCallback("reverse_status");
# add a task for the "reverse" function
$task = $gmc->addTask("reverse", "Hello World!", null, "1");
# add another task, but this one to run in the background
$task = $gmc->addTaskBackground("reverse", "!dlroW olleH", null, "2");
if (!$gmc->runTasks()) {
echo "ERROR " . $gmc->error() . "\n";
exit;
}
echo "DONE\n";
function reverse_status($task)
{
echo "STATUS: " . $task->unique() . ", " . $task->jobHandle() . " - " . $task->taskNumerator() . "/" . $task->taskDenominator() . "\n";
}
function reverse_complete($task)
{
echo "COMPLETE: " . $task->unique() . ", " . $task->data() . "\n";
}
?>