I am pretty new to Symfony 2 and brand new to Gearman. I am looking for a bundle to integrate Symfony 2 with Gearman.
mmoreramerino's bundle seems to be the most popular bundle according to packagist. Unfortunately something seems to be broken, the autoloader does not find the bundle.
Fatal error: Class 'Mmoreramerino\GearmanBundle\MmoreramerinoGearmanBundle' not found in ...
I tried switching to "dev-development" as I got from the issues that it was fixed in this branch, but it did not work for me as well.
Question: How can I install this bundle using Symfony 2.1.x? Question 2: Are there any working & documented alternatives?
Edit In case someone else comes across this question: Here is how I got it up and running!
- Install gearman, libgearman, the PECL extension for PHP (use recent versions!)
- check that gearman shows up in phpinfo() (both cli and webserver version)
- start gearmand in terminal 1 using "gearmand --verbose INFO" (you will see workers & clients connect to gearman - or not ;-))
- start in terminal 2 reverse_worker.php from the gearman php extension example directory
- start in terminal 3 reverse_client.php from the gearman php extension example directory
- If this is working, you are ready for Symfony: install mmoreramerino/GearmanBundle using "dev-development"
- copy dev.base.yml from the bundle to app/config/gearman/dev.yml
- Now add TestWorker.php to your bundle as outlined in the documentation
- enable the testWorker by using the console script "php app/console gearman:job:execute MmoreramerinoGearmanBundleWorkerstestWorker~test"
now you are able to send jobs to the listening testWorker in a Symfony controller (or somewhere else in Symfony). I had to specify the server though I am using the default host/port.
$gearman = $this->get('gearman');
$gearman->setServer('127.0.0.1',4730);
$gearman->doNormalJob('MmoreramerinoGearmanBundleWorkerstestWorker~test');