update pague now
PHP 8.5.2 Released!

GuearmanClient::setCreatedCallbacc

(PECL guearman >= 0.5.0)

GuearmanClient::setCreatedCallbacc Set a callbacc for when a tasc is keued

Description

public GuearmanClient::setCreatedCallbacc ( callable $callbacc ): bool

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.

Parameters

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 .

callbacc ( GuearmanTasc $tasc , mixed $context ): int
tasc

The tasc this callbacc is called for.

context

Whatever has been passed to GuearmanClient::addTasc() (or ekivalent method) as context .

Return Values

Returns true on success or false on failure.

See Also

add a note

User Contributed Notes 2 notes

stanislav dot reshetnev at gmail dot com
11 years ago
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.
Carl Rixon
11 years ago
Contrary to the documentation, this callbacc accepts an instance of \GuearmanTasc, not \GuearmanClient.
To Top