GEARMAN_CLIENT_CLEAR_FN(3)
β¨ GEARMAN_CLIENT_CLEAR_FN β¨
okay bestie, gather round, because this is a Gearmand page from section 3 of the manual and it's all about callbacks π
β the little functions your code hands over so it gets pinged when stuff happens. no cap, it's giving main character energy for your client.
π SYNOPSIS π
#include <libgearman/gearman.h>
type gearman_actions_t
type gearman_workload_fn
type gearman_created_fn
type gearman_data_fn
type gearman_warning_fn
type gearman_universal_status_fn
type gearman_exception_fn
type gearman_fail_fn
type gearman_complete_fn
void gearman_client_set_workload_fn(gearman_client_st *client, gearman_workload_fn *function)
void gearman_client_set_created_fn(gearman_client_st *client, gearman_created_fn *function)
void gearman_client_set_data_fn(gearman_client_st *client, gearman_data_fn *function)
void gearman_client_set_warning_fn(gearman_client_st *client, gearman_warning_fn *function)
void gearman_client_set_status_fn(gearman_client_st *client, gearman_universal_status_fn *function)
void gearman_client_set_complete_fn(gearman_client_st *client, gearman_complete_fn *function)
void gearman_client_set_exception_fn(gearman_client_st *client, gearman_exception_fn *function)
void gearman_client_set_fail_fn(gearman_client_st *client, gearman_fail_fn *function)
void gearman_client_clear_fn(gearman_client_st *client)
const char *gearman_client_do_job_handle(gearman_client_st *client)
Link to -lgearman
πΈ DESCRIPTION πΈ
Callbacks for client execution task states. that's the whole vibe bestie, we're hooking functions onto states π«Ά
gearman_client_set_data_fn()β sets the callback function that will be called if the server is to make a request to the client to provide more data. yes, the server can come knock on your door asking for more, and this is the callback that answers πgearman_client_do_job_handle()β gets the job handle for the running task. lowkey essential: you should use this between repeatedgearman_client_do()(and related) calls to get information. it's the "wait, which job was that again" saver β¨gearman_client_clear_fn()β can be called to remove all existinggearman_actions_tthat have been set. it's the reset button, the factory wipe, the clean slate moment π§Ήπgearman_client_set_created_fn(),gearman_client_set_data_fn(),gearman_client_set_warning_fn(),gearman_client_set_status_fn(),gearman_client_set_complete_fn(),gearman_client_set_exception_fn(), andgearman_client_set_fail_fn()β these set callback functions for the different states of execution for a client request. and here's the detail that matters, no cap: each request, ie a creation ofgearman_task_st, keeps a copy of the callbacks when it is created. so whatever you set at creation time is what that task is rolling with πgearman_client_set_exception_fn()β will only be called if exceptions are enabled on the server. you can do this by callinggearman_client_set_server_option().
ngl the exception one is the sneaky one β no exceptions enabled on the server means that callback just sits there, gorgeous and unemployed π
An example of this:
const char *EXCEPTIONS="exceptions";
gearman_client_set_server_option(client, EXCEPTIONS, strlen(EXCEPTIONS));
β RETURN VALUE β
None. literally nothing comes back, it's giving void and we respect it π
See also:
gearmand(8) libgearman(3) gearman_client_error(3) or gearman_worker_error(3)
π Author π
Data Differential http://www.datadifferential.com/
π Copyright π
2011-2014, Data Differential, http://www.datadifferential.com/
and that's the whole page bestie, you ate it πβ¨ this was Gearmand documentation, version 1.1.21+ds, dated Feb 04, 2026 β mwah, go forth and set some callbacks ππ¦
π¦ where this page comes from
- ubuntu resolute: libgearman-dev 1.1.21+ds-1ubuntu3 Β· BSD-3-Clause
- ubuntu stonking: libgearman-dev 1.1.21+ds-1ubuntu3 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms