Top Banner
GearmanBundle SymfonyCon Warsaw Edition
16

Gearman bundle, Warszawa 2013 edition

Jan 13, 2015

Download

Technology

Marc Morera

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Gearman bundle, Warszawa 2013 edition

GearmanBundleSymfonyCon Warsaw Edition

Page 2: Gearman bundle, Warszawa 2013 edition

Bafactory, Barcelona

@Mmoreram

Page 3: Gearman bundle, Warszawa 2013 edition

GearmanBundleProviding Gearman support on your SF2 projects

Page 4: Gearman bundle, Warszawa 2013 edition

<?php namespace Acme\AcmeBundle\Workers; !/** * My simple Acme Class */ class AcmeClass { /** * My simple acme class method */ public function action() { ! } }

Page 5: Gearman bundle, Warszawa 2013 edition

<?php namespace Acme\AcmeBundle\Workers; !use Mmoreram\GearmanBundle\Driver\Gearman; !/** * @Gearman\Work(name=“myworker”) */ class AcmeClass { /** * @Gearman\Job */ public function action(\GearmanJob $job) { // Do some stuff } }

Page 6: Gearman bundle, Warszawa 2013 edition

$ php app/console gearman:workers:list ! @Worker: Acme\AcmeBundle\Workers\AcmeClass callablename: myworker Jobs: - #1 name: action callablename: myworker~action

Page 7: Gearman bundle, Warszawa 2013 edition

$ php app/console gearman:worker:execute myworker

Page 8: Gearman bundle, Warszawa 2013 edition

Supervisord

WorkerWorkerWorkerWorkerWorkerWorker

Page 9: Gearman bundle, Warszawa 2013 edition

$this ->getContainer() ->get(‘gearman') ->doJob(‘myworker’, ‘value’);

Page 10: Gearman bundle, Warszawa 2013 edition

<?php namespace Acme\AcmeBundle\Workers; !use Mmoreram\GearmanBundle\Driver\Gearman; !/** * @Gearman\Work(name=“myworker”) */ class AcmeClass { /** * @Gearman\Job */ public function action(\GearmanJob $job) { $workload = $job->workload(); } }

Page 11: Gearman bundle, Warszawa 2013 edition

–Concept invented by me, like a boss…

Dependencies? WAAS

(Worker as a service)

Page 12: Gearman bundle, Warszawa 2013 edition

<?php namespace Acme\AcmeBundle\Workers; !use Mmoreram\GearmanBundle\Driver\Gearman; !/** * @Gearman\Work(name=“myworker”, service=“worker.myworker”) */ class AcmeClass { /** * @Gearman\Job */ public function action(\GearmanJob $job) { $workload = $job->workload(); } }

Page 13: Gearman bundle, Warszawa 2013 edition

<?php namespace Acme\AcmeBundle\Workers; !use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Mmoreram\GearmanBundle\Driver\Gearman; !/** * @Gearman\Work(name=“myworker”, service=“worker.myworker”) */ class AcmeClass instanceof ContainerAwareInterface { /** * @Gearman\Job */ public function action(\GearmanJob $job) { $workload = $job->workload(); } }

Page 14: Gearman bundle, Warszawa 2013 edition

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

Page 15: Gearman bundle, Warszawa 2013 edition

And that you use GearmanBundle :)

I encourage you to use Queues

Page 16: Gearman bundle, Warszawa 2013 edition

Moltes Gràcies, Thanks!