NAME

Protocol::Gearman::Client - implement a Gearman client

DESCRIPTION

A base class that implements a complete Gearman client. This abstract class still requires the implementation methods as documented in Protocol::Gearman::Base, 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 Protocol::Gearman::Client::Connection.

METHODS

$client->submit_job( %args ) ==> $result

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;

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 )

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>