當前位置: 首頁>>代碼示例>>PHP>>正文


PHP GearmanClient::setStatusCallback方法代碼示例

本文整理匯總了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;
 }
開發者ID:jamset,項目名稱:gearman-conveyor,代碼行數:9,代碼來源:BaseGearmanClient.php

示例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'));
 }
開發者ID:eduardtrandafir,項目名稱:gearman-bundle,代碼行數:18,代碼來源:GearmanCallbacksDispatcher.php

示例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";
}
?>
 
開發者ID:huberyhe,項目名稱:scripts,代碼行數:28,代碼來源:GearmanClient.php


注:本文中的GearmanClient::setStatusCallback方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。