Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8174231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:23:59+00:00 2026-06-06T22:23:59+00:00

I did check the example reverse_client_cb with the reverse_worker as a worker. The worker

  • 0

I did check the example reverse_client_cb with the reverse_worker as a worker.
The worker is getting called and executed but not a single callback ( complete,fail,etc) is getting called in the client.

Below is a sample worker and client that I wrote to check the same, but, same problem.
Is there any configuration that’s need to be done in gearman or in the way the worker and clients are executed?

sampleworker.cc

void* myfunc(gearman_job_st *job, void *data,size_t *size,gearman_return_t *ret)
{
    printf("\nmyfunc called\n");

    *ret=GEARMAN_SUCCESS;
    char *result=(char*)calloc(30,sizeof(char));
    strcpy(result,"work completed");
    *size=30;
    return result;
}

int main(int args,char* argv[])
{
   gearman_worker_st worker;

   gearman_worker_create(&worker);
   gearman_worker_add_server(&worker,"localhost",0);

   gearman_return_t ret =     gearman_worker_add_function(&worker,"sample",0,myfunc,NULL);

   while(1) gearman_worker_work(&worker);

   gearman_worker_free(&worker);
   return 0;
}

sampleclient.cc

static gearman_return_t complete(gearman_task_st *task)
{
     printf("Completed: %s %.*s\n", gearman_task_job_handle(task),
     (int)gearman_task_data_size(task), (char *)gearman_task_data(task));
     return GEARMAN_SUCCESS;
}

static gearman_return_t fail(gearman_task_st *task)
{
    printf("Failed: %s\n", gearman_task_job_handle(task));
    return GEARMAN_SUCCESS;
}

 int main(int args,char* argv[])
{
        gearman_client_st client;
    gearman_return_t ret;

    gearman_client_create(&client);
    gearman_client_add_server(&client,"localhost",0);

    gearman_task_st task,*task2;
    gearman_client_add_task(&client,&task,NULL,"sample",NULL,argv[1],(size_t)strlen(argv[1]),&ret);

    gearman_client_set_complete_fn(&client, &complete);
    gearman_client_set_fail_fn(&client, &fail);

    gearman_client_run_tasks(&client);  

    gearman_client_free(&client);
    return 0;
  }

usage

./sampleworker
./sampleclient Hello

“myfunc called” getting printed and the client is also waiting till the worker completes the job. But nothing is printed from complete or fail functions

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T22:24:01+00:00Added an answer on June 6, 2026 at 10:24 pm

    got it.

    I removed the following libs which was installed and now I’m getting all the callbacks.

    libgearman-client-async-perl – Asynchronous client for gearman distributed job system

    libgearman-client-perl – Client for gearman distributed job system.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I did not create the database I'm working with, but I would like to
I was having a look around but I did not seem to find the
I have been looking for this pattern for some time but still did not
How would I check if the user did not come from the same website?
Check this example: $('button').bind('click focus', function() { // Did I click or focus? });
I did a quick search on how to check whether Internet is available or
I want to check for user inactivity in my application. I did a little
Did you ever have the following situation: you need to store information, but a
Did about 30 minutes worth of searching, found lots of relevant info, but none
Did I not get enough sleep or what? This following code var frame=document.getElementById(viewer); frame.width=100;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.