1GEARMAN_WORKER_DEFINE_FUNCTION(3)  Gearmand  GEARMAN_WORKER_DEFINE_FUNCTION(3)
2
3
4

NAME

6       gearman_worker_define_function  -  Gearmand Documentation, http://gear
7       man.info/
8

SYNOPSIS

10       #include <libgearman/gearman.h>
11
12       gearman_function_t
13
14       gearman_return_t                   gearman_worker_define_function(gear‐
15       man_worker_st *worker,  const  char *function_name,  const size_t func‐
16       tion_name_length,     const     gearman_function_t function,      const
17       uint32_t timeout, void *context)
18
19       gearman_function_fn
20
21       gearman_aggregator_fn
22
23       Link with -lgearman
24

DESCRIPTION

26       gearman_worker_define_function() defines functions for a worker.
27
28       The  interface is callback by design. When the server has a job for the
29       worker, gearman_function_fn is evoked with a gearman_job_st  represent‐
30       ing the job, and the context that was defined originally when the func‐
31       tion was defined.
32
33       Results   are   sent   back   to   the   client   by   invoking   gear‐
34       man_job_send_data().
35
36       If  the  client  specified  an reducer function, then the output of the
37       gearman_function_fn will be sent to that function. You  can  split  the
38       work  out  to  the reducer function by sending data multiple times with
39       gearman_job_send_data().
40
41       If any errors are detected then  the  entire  job  is  cancelled.   The
42       gearman_aggregator_fn  will  be  called  when all mapped jobs have com‐
43       pleted. The result of this function will be what  is  returned  to  the
44       client.
45
46       The callback function needs to return one of the following errors:
47
48       GEARMAN_SUCCESS
49
50       The function was successful.
51
52       GEARMAN_FAIL
53
54       An  error has occurred, the job we not processed, and the worker cannot
55       continue.
56
57       GEARMAN_ERROR
58
59       A transient error has occurred, like a network failure, and the job can
60       be restarted.
61
62       If a value other then the above are returned it is converted to a GEAR‐
63       MAN_FAIL and gearman_worker_work() returns GEARMAN_INVALID_ARGUMENT.
64
65       gearman_job_send_complete() and gearman_job_send_fail() cannot be  used
66       with any functions created with gearman_worker_define_function().
67

RETURN VALUE

69       gearman_return_t
70

HOME

72       To find out more information please check: http://gearman.info/
73

SEE ALSO

75       gearmand(8)   libgearman(3)   gearman_strerror(3)  gearman_client_error
76       gearman_client_execute_reduce
77

AUTHOR

79       Data Differential http://www.datadifferential.com/
80
82       2011-2014, Data Differential, http://www.datadifferential.com/
83
84
85
86
871.1.19.1                         Feb 18, 2020GEARMAN_WORKER_DEFINE_FUNCTION(3)
Impressum