Gearman bundle, Warszawa 2013 edition

1,370 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,370
On SlideShare
0
From Embeds
0
Number of Embeds
72
Actions
Shares
0
Downloads
7
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Gearman bundle, Warszawa 2013 edition

  1. 1. GearmanBundle SymfonyCon Warsaw Edition
  2. 2. @Mmoreram Bafactory, Barcelona
  3. 3. GearmanBundle Providing Gearman support on your SF2 projects
  4. 4. <?php namespace AcmeAcmeBundleWorkers; ! /** * My simple Acme Class */ class AcmeClass { /** * My simple acme class method */ public function action() { ! } }
  5. 5. <?php namespace AcmeAcmeBundleWorkers; ! use MmoreramGearmanBundleDriverGearman; ! /** * @GearmanWork(name=“myworker”) */ class AcmeClass { /** * @GearmanJob */ public function action(GearmanJob $job) { // Do some stuff } }
  6. 6. $ php app/console gearman:workers:list ! @Worker: AcmeAcmeBundleWorkersAcmeClass callablename: myworker Jobs: - #1 name: action callablename: myworker~action
  7. 7. $ php app/console gearman:worker:execute myworker
  8. 8. Supervisord WorkerWorker Worker Worker Worker Worker
  9. 9. $this ->getContainer() ->get(‘gearman') ->doJob(‘myworker’, ‘value’);
  10. 10. <?php namespace AcmeAcmeBundleWorkers; ! use MmoreramGearmanBundleDriverGearman; ! /** * @GearmanWork(name=“myworker”) */ class AcmeClass { /** * @GearmanJob */ public function action(GearmanJob $job) { $workload = $job->workload(); } }
  11. 11. Dependencies? W AAS (Worker as a service) –Concept invented by me, like a boss…
  12. 12. <?php namespace AcmeAcmeBundleWorkers; ! use MmoreramGearmanBundleDriverGearman; ! /** * @GearmanWork(name=“myworker”, service=“worker.myworker”) */ class AcmeClass { /** * @GearmanJob */ public function action(GearmanJob $job) { $workload = $job->workload(); } }
  13. 13. <?php namespace AcmeAcmeBundleWorkers; ! use SymfonyComponentDependencyInjectionContainerAwareInterface; use MmoreramGearmanBundleDriverGearman; ! /** * @GearmanWork(name=“myworker”, service=“worker.myworker”) */ class AcmeClass instanceof ContainerAwareInterface { /** * @GearmanJob */ public function action(GearmanJob $job) { $workload = $job->workload(); } }
  14. 14. What else? Many features available for developers Improving day by day all code, adding features and resolving issues 50 daily downloads ( Not as popular as Symfony packages… ) Platinum medal on SensioLabs Insight
  15. 15. I encourage you to use Queues And that you use GearmanBundle :)
  16. 16. Moltes Gràcies, Thanks!

×