GEARMAN_CLIENT_SET_DATA_FN(3)
π GEARMAN_CLIENT_SET_DATA_FN π
okay bestie, welcome to the Gearmand manual, section 3 β meaning it's a library-function page, iykyk. yes this page is named after gearman_client_set_data_fn but it's actually giving the whole callback-gang β¨
πΈ NAME πΈ
gearman_client_set_data_fn β that's the star of the show, but the docs here live at http://gearman.info/ π«Ά
β¨ SYNOPSIS β¨
First up, the includes, because you always gotta bring the right header to the function party:
#include <libgearman/gearman.h>
the types, bestie (yes all of them) π
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
the functions π
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 β that's the librarian you're checking out, don't forget to link her. π
π¦ DESCRIPTION π¦
So. These are callbacks for client execution task states. Basically: your client is doing a job, the job goes through ~vibes~ (states), and you get to plant a little function to run at each one. cute, right?
gearman_client_set_data_fn()β sets the callback that gets called when the server hits up the client like "bestie, give me more data pls". it's giving main character energy the way your code gets pulled back in for more. πgearman_client_do_job_handle()β gets the job handle for the running task. the important thing: call this between repeatedgearman_client_do()(and related) calls when you want to get info. it's a between-the-calls girlie, not a during-the-call one. β¨gearman_client_clear_fn()β call this to remove all the existinggearman_actions_tthat have been set. full reset, fresh start, glow-up moment π
okay so now the big group chat: 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(), and gearman_client_set_fail_fn() all set callback functions for the different states of execution for a client request. and here's the tea: each request β ie a creation of gearman_task_st β keeps a copy of the callbacks when it is created. so past-you's callback choices get snapshotted, no takebacksies π«°
gearman_client_set_exception_fn() only gets called if exceptions are enabled on the server. and how do you do that? by calling gearman_client_set_server_option(). yes, that's the whole ritual.
An example of this:
const char *EXCEPTIONS="exceptions";
gearman_client_set_server_option(client, EXCEPTIONS, strlen(EXCEPTIONS));
slay. that's it. that's the example. π§
π RETURN VALUE π
None. nothing. void energy. the functions simply do the thing and hand you back zero receipts. π
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/
okay that's the whole page, bestie, you ate it up π so this was version 1.1.21+ds, dated Feb 04, 2026, from the Gearmand corner of the universe β go forth and set those callbacks, no cap πβ¨π
π¦ 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