note 116024 added to gearmanclient.setcreatedcallback

From: Date: Thu, 30 Oct 2014 16:07:13 +0000
Subject: note 116024 added to gearmanclient.setcreatedcallback
Groups: php.notes 
Request: Send a blank email to php-notes+get-200752@lists.php.net to get a copy of this message
Callback can accept not only GearmanTask object, but it can recieve a variable from GearmanClient::addTask(): <?php $client = new GearmanClient(); $client->addServer(); $client->setCreatedCallback(function(GearmanTask $task, $some_info) { // now we have $some_info // ... }); $client->addTask($function_name, $workload, "some info"); ?> So, we can send to our anonymous function something like $workload, because we can't get it from GearmanTask object. It may be usefull for logging of tasks queuing. ---- Server IP: 72.52.91.14 Probable Submitter: 80.251.133.198 ---- Manual Page -- http://php.net/manual/en/gearmanclient.setcreatedcallback.php Edit -- https://master.php.net/note/edit/116024 Del: integrated -- https://master.php.net/note/delete/116024/integrated Del: useless -- https://master.php.net/note/delete/116024/useless Del: bad code -- https://master.php.net/note/delete/116024/bad+code Del: spam -- https://master.php.net/note/delete/116024/spam Del: non-english -- https://master.php.net/note/delete/116024/non-english Del: in docs -- https://master.php.net/note/delete/116024/in+docs Del: other reasons-- https://master.php.net/note/delete/116024 Reject -- https://master.php.net/note/reject/116024 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#200752) next »