本文整理汇总了PHP中GearmanClient::setDataCallback方法的典型用法代码示例。如果您正苦于以下问题:PHP GearmanClient::setDataCallback方法的具体用法?PHP GearmanClient::setDataCallback怎么用?PHP GearmanClient::setDataCallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GearmanClient
的用法示例。
在下文中一共展示了GearmanClient::setDataCallback方法的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: __construct
/**
* Constructor method checks for gearman
*
* @throws Kohana_Request_Exception
*/
public function __construct()
{
if (!extension_loaded('gearman')) {
throw new Kohana_Request_Exception('Unable to load PHP Gearman. Check your local environment.');
}
// Create a new Gearman client and add a server
$this->_gearman_client = new GearmanClient();
/**
* @todo support multiple Gearman servers
* @todo support customisable servers
*/
if (!$this->_gearman_client->addServer()) {
throw new Kohana_Request_Exception('Unable to attach to Gearman server');
}
// Setup callback functions for Gearman tasks
$this->_gearman_client->setDataCallback(array($this, '_task_data'));
$this->_gearman_client->setFailCallback(array($this, '_task_failed'));
$this->_gearman_client->setCompleteCallback(array($this, '_task_complete'));
$this->_gearman_client->setExceptionCallback(array($this, '_task_exception'));
}