GEARMAN_CLIENT_SET_COMPLETE_FN(3)

πŸ‘‘ GEARMAN_CLIENT_SET_COMPLETE_FN β€” Gearmand Documentation ✨

okay bestie, welcome to the Gearmand docs, straight from http://gearman.info/ πŸ’– pull up a chair, hydrate, and let's get into how you hand Gearman your callback functions.


🌸 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)

and fr, don't forget to link against -lgearman 🫢 (that's the whole point of the game)


πŸ¦‹ DESCRIPTION πŸ¦‹

so these are the callbacks for client execution task states πŸ’… like, if your task is a whole main character, these are the moments in her arc that you get to narrate.

  • gearman_client_set_data_fn() β€” this one sets the callback function that gets called if the server wants to make a request to the client asking for more data. yes, the server can just... come back and ask for seconds. iconic behavior honestly.
  • gearman_client_do_job_handle() β€” ngl the manpage typo'd this as "gest", but bestie it gets the job handle for the running task πŸ”₯ use it in between repeated gearman_client_do() (and related) calls when you want to pull information out. lowkey essential.
  • gearman_client_clear_fn() β€” call this to yeet every single existing gearman_actions_t that's been set. clean slate, new era ✨

now for the big one. 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 of a client request πŸ’– and here's the detail you need to remember: each request β€” meaning each creation of a gearman_task_st β€” keeps its own copy of the callbacks at the moment it's created. so like, snapshots. it's giving commitment issues but in a helpful way.

🚨 important!! gearman_client_set_exception_fn() will only be called if exceptions are enabled on the server. no server-side exceptions = your callback is just sitting there, ignored, staring at the wall 😭 you turn them on by calling gearman_client_set_server_option().

here's the vibe, code and all:

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

periodt. that's the whole ritual πŸ’…


⭐ RETURN VALUE ⭐

None. that's it, that's the section, we love a low-effort return value king πŸ‘‘

see also:


πŸŽ€ Author πŸŽ€

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

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


and that's the whole page bestie πŸ’œ this lil' baddie shipped as version 1.1.21+ds, dated Feb 04, 2026, brought to you by the GEARMAN_CLIENT_SET_COMPLETE_FN(3) girlies in the Gearmand manual. go set some callbacks, you absolute queen πŸ‘‘βœ¨πŸ¦‹

πŸ“¦ where this page comes from