Protocol::Gearman::Client - implement a Gearman client
Protocol::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.
Future
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:
exceptions
Enables the use of the WORK_EXCEPTION packet; meaning the client is happy to receive them.
WORK_EXCEPTION
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:
The name of the function to call
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;
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.
Alters the job priority on the server. If present, must be either "high", "low" or the empty string.
"high"
"low"
Invoked on receipt of more incremental data from the worker.
$on_data->( $data )
Invoked on receipt of a warning from the worker.
$on_warning->( $warning )
Invoked on a status update from the worker.
$on_status->( $numerator, $denominator )
Paul Evans <leonerd@leonerd.org.uk>
To install Protocol::Gearman, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Protocol::Gearman
CPAN shell
perl -MCPAN -e shell install Protocol::Gearman
For more information on module installation, please visit the detailed CPAN module installation guide.