GEARMAN_CLIENT_CLEAR_FN(3)

✨ GEARMAN_CLIENT_CLEAR_FN ✨

okay bestie, gather round, because this is a Gearmand page from section 3 of the manual and it's all about callbacks πŸ’… β€” the little functions your code hands over so it gets pinged when stuff happens. no cap, it's giving main character energy for your client.


πŸŽ€ 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


🌸 DESCRIPTION 🌸

Callbacks for client execution task states. that's the whole vibe bestie, we're hooking functions onto states 🫢

  • gearman_client_set_data_fn() β€” sets the callback function that will be called if the server is to make a request to the client to provide more data. yes, the server can come knock on your door asking for more, and this is the callback that answers πŸ’–
  • gearman_client_do_job_handle() β€” gets the job handle for the running task. lowkey essential: you should use this between repeated gearman_client_do() (and related) calls to get information. it's the "wait, which job was that again" saver ✨
  • gearman_client_clear_fn() β€” can be called to remove all existing gearman_actions_t that have been set. it's the reset button, the factory wipe, the clean slate moment πŸ§ΉπŸ’…
  • 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 callback functions for the different states of execution for a client request. and here's the detail that matters, no cap: each request, ie a creation of gearman_task_st, keeps a copy of the callbacks when it is created. so whatever you set at creation time is what that task is rolling with πŸ‘‘
  • gearman_client_set_exception_fn() β€” will only be called if exceptions are enabled on the server. you can do this by calling gearman_client_set_server_option().
ngl the exception one is the sneaky one β€” no exceptions enabled on the server means that callback just sits there, gorgeous and unemployed 😭

An example of this:

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

⭐ RETURN VALUE ⭐

None. literally nothing comes back, it's giving void and we respect it πŸ™ˆ

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, you ate it πŸ“βœ¨ this was Gearmand documentation, version 1.1.21+ds, dated Feb 04, 2026 β€” mwah, go forth and set some callbacks πŸ’–πŸ¦‹

πŸ“¦ where this page comes from