Basic Gearman client and worker, submitting tasks
GearmanClient::addOptions
Gearman
PHP Manual

# La classe GearmanClient

## Introduction

Représente une classe pour se connecter à un serveur de tâches Gearman et lui soumettre des requêtes pour appliquer des fonctions sur les données fournies. La fonction appliquée doit faire partie de celles référencées par un agent Gearman et les données traitées restent opaques du point de vue du serveur de tâches.

## Synopsis de la classe

GearmanClient
GearmanClient {
/* Méthodes */
public bool addOptions ( int `$options` )
public bool addServer ([ string `$host` = 127.0.0.1 [, int `$port` = 4730 ]] )
public bool addServers ([ string `$servers` = 127.0.0.1:4730 ] )
public GearmanTask addTask ( string `$function_name` , string `$workload` [, mixed `&$context` [, string `$unique` ]] )
public GearmanTask addTaskBackground ( string `$function_name` , string `$workload` [, mixed `&$context` [, string `$unique` ]] )
public GearmanTask addTaskHigh ( string `$function_name` , string `$workload` [, mixed `&$context` [, string `$unique` ]] )
public GearmanTask addTaskHighBackground ( string `$function_name` , string `$workload` [, mixed `&$context` [, string `$unique` ]] )
public GearmanTask addTaskLow ( string `$function_name` , string `$workload` [, mixed `&$context` [, string `$unique` ]] )
public GearmanTask addTaskLowBackground ( string `$function_name` , string `$workload` [, mixed `&$context` [, string `$unique` ]] )
public GearmanTask addTaskStatus ( string `$job_handle` [, string `&$context` ] )
public bool clearCallbacks ( void )
public GearmanClient clone ( void )
__construct ( void )
public string context ( void )
public string data ( void )
public string do ( string `$function_name` , string `$workload` [, string `$unique` ] )
public string doBackground ( string `$function_name` , string `$workload` [, string `$unique` ] )
public string doHigh ( string `$function_name` , string `$workload` [, string `$unique` ] )
public string doHighBackground ( string `$function_name` , string `$workload` [, string `$unique` ] )
public string doJobHandle ( void )
public string doLow ( string `$function_name` , string `$workload` [, string `$unique` ] )
public string doLowBackground ( string `$function_name` , string `$workload` [, string `$unique` ] )
public array doStatus ( void )
public bool echo ( string `$workload` )
public string error ( void )
public int getErrno ( void )
public array jobStatus ( string `$job_handle` )
public bool removeOptions ( int `$options` )
public int returnCode ( void )
public bool runTasks ( void )
public void setClientCallback ( callback `$callback` )
public bool setCompleteCallback ( callback `$callback` )
public bool setContext ( string `$context` )
public bool setCreatedCallback ( string `$callback` )
public bool setData ( string `$data` )
public bool setDataCallback ( callback `$callback` )
public bool setExceptionCallback ( callback `$callback` )
public bool setFailCallback ( callback `$callback` )
public bool setOptions ( int `$options` )
public bool setStatusCallback ( callback `$callback` )
public bool setTimeout ( int `$timeout` )
public bool setWarningCallback ( callback `$callback` )
public bool setWorkloadCallback ( callback `$callback` )
public int timeout ( void )
}

## Sommaire

- GearmanClient::addOptions — Ajoute des options au client
- GearmanClient::addServer — Ajoute un serveur de tâches au client
- GearmanClient::addServers — Ajoute une liste de serveurs de tâches au client
- GearmanClient::addTask — Add a task to be run in parallel
- GearmanClient::addTaskBackground — Add a background task to be run in parallel
- GearmanClient::addTaskHigh — Ajoute une tâche de forte priorité à effectuer en parallèle
- GearmanClient::addTaskHighBackground — Ajoute une tâche de fond de forte priorité à effectuer en parallèle
- GearmanClient::addTaskLow — Ajoute une tâche de faible priorité à effectuer en parallèle
- GearmanClient::addTaskLowBackground — Ajoute une tâche de fond de faible priorité à effectuer en parallèle
- GearmanClient::addTaskStatus — Ajoute une tâche pour obtenir le statut
- GearmanClient::clearCallbacks — Clear all task callback functions
- GearmanClient::clone — Create a copy of a GearmanClient object
- GearmanClient::__construct — Crée une instance GearmanClient
- GearmanClient::context — Get the application context
- GearmanClient::data — Get the application data (deprecated)
- GearmanClient::do — Run a single task and return a result
- GearmanClient::doBackground — Run a task in the background
- GearmanClient::doHigh — Run a single high priority task
- GearmanClient::doHighBackground — Run a high priority task in the background
- GearmanClient::doJobHandle — Get the job handle for the running task
- GearmanClient::doLow — Run a single low priority task
- GearmanClient::doLowBackground — Run a low priority task in the background
- GearmanClient::doStatus — Get the status for the running task
- GearmanClient::echo — Send data to all job servers to see if they echo it back
- GearmanClient::error — Returns an error string for the last error encountered.
- GearmanClient::getErrno — Get an errno value
- GearmanClient::jobStatus — Get the status of a background job
- GearmanClient::removeOptions — Remove client options
- GearmanClient::returnCode — Get the last Gearman return code
- GearmanClient::runTasks — Run a list of tasks in parallel
- GearmanClient::setClientCallback — Callback function when there is a data packet for a task (deprecated)
- GearmanClient::setCompleteCallback — Set a function to be called on task completion
- GearmanClient::setContext — Set application context
- GearmanClient::setCreatedCallback — Set a callback for when a task is queued
- GearmanClient::setData — Set application data (deprecated)
- GearmanClient::setDataCallback — Callback function when there is a data packet for a task
- GearmanClient::setExceptionCallback — Set a callback for worker exceptions
- GearmanClient::setFailCallback — Set callback for job failure
- GearmanClient::setOptions — Set client options
- GearmanClient::setStatusCallback — Set a callback for collecting task status
- GearmanClient::setTimeout — Set socket I/O activity timeout
- GearmanClient::setWarningCallback — Set a callback for worker warnings
- GearmanClient::setWorkloadCallback — Set a callback for accepting incremental data updates
- GearmanClient::timeout — Get current socket I/O activity timeout value

Basic Gearman client and worker, submitting tasks
GearmanClient::addOptions
Gearman
PHP Manual