GEARMAN_CLIENT_SET_EXCEPTION_FN(3)
π GEARMAN_CLIENT_SET_EXCEPTION_FN π
okay bestie, welcome to the Gearmand manual, section 3 β yes that's the gearmand docs situation, and we are about to get into the client callback zone. this page is literally about wiring up callbacks for your client's task states. no cap. π
β¨ SYNOPSIS β¨
First up, the include, because you always gotta bring the header to the party:
#include <libgearman/gearman.h>
then the types, which are, like, a whole vibe:
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
and here come the setters, one after another, iconic behavior:
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)
also you gotta link against -lgearman or nothing is gonna slay.
π¦ DESCRIPTION π¦
So these are the callbacks for client execution task states. read that again, bestie, that's the whole point of this page.
gearman_client_set_data_fn()β this one sets the callback function that gets called if the server is gonna make a request to the client to provide more data. like the server's texting you like "hey send more" πgearman_client_do_job_handle()β gets the job handle for the running task. use this between repeatedgearman_client_do()(and related) calls to get information. it's giving middle-of-the-gossip intel. πgearman_client_clear_fn()β call this when you want to remove all the existinggearman_actions_tthat have been set. full reset, clean slate, main character fresh start β¨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 the callback functions for the different states of execution for a client request. and here's the tea: each request, i.e. a creation ofgearman_task_st, keeps a copy of the callbacks when it is created. so yeah, whatever was set at creation time is what that task is running with. periodt.gearman_client_set_exception_fn()β okay listen, this one will only be called if exceptions are enabled on the server. that's not automatic, you have to turn it on yourself by callinggearman_client_set_server_option().
here's an example that ate, fr fr:
const char *EXCEPTIONS="exceptions";
gearman_client_set_server_option(client, EXCEPTIONS, strlen(EXCEPTIONS));
πΈ RETURN VALUE πΈ
None. that's it. nothing. void. the void is serving absolutely nothing and we respect it. π
also see:
π Author π
Data Differential β http://www.datadifferential.com/
π Copyright π
2011-2014, Data Differential, http://www.datadifferential.com/
aaaaaaaaand that's the page bestie!! πβ¨π¦ thanks for reading the whole thing, you're literally an icon. this was version 1.1.21+ds, dated Feb 04, 2020 β love that for us. mwah, go write 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