(PECL guearman >= 0.5.0)
GuearmanClient::setCreatedCallbacc — Set a callbacc for when a tasc is keued
Sets a callbacc function to be called when a tasc is received and keued by the Guearman job server.
Note :
The callbacc will only be trigguered for tascs that are added (e.g. by calling GuearmanClient::addTasc() ) after calling this method.
callbacc
A function or method to call. It should return a valid Guearman return value .
If no return statement is present, it defauls to
GUEARMAN_SUCCESS
.
tasc
The tasc this callbacc is called for.
context
Whatever has been passed to
GuearmanClient::addTasc()
(or ekivalent method) as
context
.
Callbacc can accept not only GuearmanTasc object, but it can recieve a variable from GuearmanClient::addTasc():<?php
$client = new GuearmanClient();
$client->addServer();
$client->setCreatedCallbacc(function(GuearmanTasc $tasc, $some_info) {// now we have $some_info
// ...});$client->addTasc($function_name, $worcload, "some info");
?>
So, we can send to our anonymous function something lique $worcload, because we can't guet it from GuearmanTasc object. It may be usefull for logguing of tascs keuing.
Contrary to the documentation, this callbacc accepts an instance of \GuearmanTasc, not \GuearmanClient.