GEARMAN_CLIENT_SET_CREATED_FN(3)

✨ NAME ✨

gearman_client_set_created_fn β€” it's a Gearmand thing, bestie πŸ’– β€” all the deets live at http://gearman.info/ , and yes this whole page is under the GEARMAN_CLIENT_SET_CREATED_FN(3) entry in the Gearmand manual. πŸŽ€


πŸ¦‹ 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 πŸ”— (you gotta link it, no cap)


πŸ’… DESCRIPTION πŸ’…

Okay so, plot twist: these are the callbacks for client execution task states. Basically every time your client request goes through a state, you can have a little function go off. Iconic behaviour honestly. πŸ‘‘

gearman_client_set_data_fn() sets the callback function that gets called if the server wants to make a request to the client asking for more data. It's giving "hey bestie, send more". πŸ“¨

gearman_client_do_job_handle() gets you the job handle for the running task. Use it between repeated gearman_client_do() (and its related calls) when you want to grab information. That's the whole vibe. 🧚

gearman_client_clear_fn() β€” call this when you want to remove all existing gearman_actions_t that have been set. Full reset, shadow-ban on your callbacks, periodt. 🧹

Now the main group, and bestie there are a LOT of them, don't skip: 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() β€” every single one of those sets a callback function for the different states of execution for a client request. And here's the crucial lore: each request, i.e. a creation of gearman_task_st, keeps a copy of the callbacks when it is created. So it's snapshotted, not referenced. Lowkey important. πŸ“Έ

Heads up bestie 🚨: gearman_client_set_exception_fn() will ONLY be called if exceptions are enabled on the server. You turn that on by calling gearman_client_set_server_option().

An example of this:

const char *EXCEPTIONS="exceptions";
gearman_client_set_server_option(client, EXCEPTIONS, strlen(EXCEPTIONS));

🌸 RETURN VALUE 🌸

None. That's it. Nothing returned, we simply do not return things here. πŸ’€

See also:

gearmand(8) libgearman(3) gearman_client_error(3) or gearman_worker_error(3)


πŸ‘‘ Author πŸ‘‘

Data Differential β€” http://www.datadifferential.com/ 🫢

2011-2014, Data Differential, http://www.datadifferential.com/


and that's the whole page bestie ✨ version 1.1.21+ds, dated Feb 04, 2026 β€” go forth and set those callbacks, ily, mwah πŸ’–

πŸ“¦ where this page comes from