samedi 3 octobre 2015

Call python gearman worker using laravel 5

I am using laravel 5. What I need is to call python gearman worker.

I have created a gearman worker in python. And I have created a gearman client in laravel 5.

I have directly added gearman client code in my controller like:

$client = new GearmanClient();
$client->addServer();
$job_data = array("func_name" => "searchTweets", "query" => "query_to_search");
$result = $client->doNormal("php_twitter_worker", json_decode($job_data));
if ($result) {
    print_r($result);
}

But it throws error :

Class 'App\Http\Controllers\GearmanClient' not found

I know what is the error because I don't have GearmanClient Class in Controllers. Actually I don't know how to use it.

After doing some R&D , I found a package using gearman in laravel5 but not getting how to use it as Gearman Client and how it make a call to my python gearman worker.

Any help on this ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire