Protocol::Gearman::Client - implement a Gearman client
A base class that implements a complete Gearman client. This abstract class still requires the implementation methods as documented in Protocol::Gearman, but otherwise provides a full set of behaviour useful to Gearman clients.
As it is based on Future it is suitable for both synchronous and asynchronous use. When backed by an implementation capable of performing asynchronously, this object fully supports asynchronous Gearman communication. When backed by a synchronous implementation, it will still yield
Future instances but the limitations of the synchronous implementation may limit how much concurrency and asynchronous behaviour can be acheived.
A simple concrete implementation suitable for synchronous use can be found in Net::Gearman::Client.
Requests that the Gearman server enable the named option for this connection.
The following options are defined by Gearman:
Enables the use of the
WORK_EXCEPTIONpacket; meaning the client is happy to receive them.
Submits a job request to the Gearman server, and returns a future that will eventually yield the result of the job or its failure.
Takes the following required arguments:
- func => STRING
The name of the function to call
- arg => STRING
An opaque bytestring containing the argument data for the function. Its exact format should be specified by the registered function.
Takes the following optional arguments;
- background => BOOL
If true, the job is submitted as a background request. Such a request will not yield any status or completion information from the server. Once submitted the server will not communicate about it further. In this case, the returned future will complete with an empty result as soon as the job is accepted by the server.
- priority => "high" | "low" | ""
Alters the job priority on the server. If present, must be either
"low"or the empty string.
- on_data => CODE
Invoked on receipt of more incremental data from the worker.
$on_data->( $data )
- on_warning => CODE
Invoked on receipt of a warning from the worker.
$on_warning->( $warning )
- on_status => CODE
Invoked on a status update from the worker.
$on_status->( $numerator, $denominator )
Paul Evans <firstname.lastname@example.org>