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 repeated gearman_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 existing gearman_actions_t that 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(), and gearman_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 of gearman_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 calling gearman_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/

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