shonm/resque-bundle

Symfony2 bundle for Resque via php-resque

Installs: 5 568

Dependents: 0

Suggesters: 0

Security: 0

Stars: 12

Watchers: 2

Forks: 6

Open Issues: 0

Type:symfony-bundle

dev-master 2013-04-29 16:51 UTC

README

Create a Job

// src/Acme/ResqueBundle/Job/TestJob.php
namespace Acme\ResqueBundle\Job;

class HelloWorldJob
{
    public function perform ()
    {
        fwrite(STDOUT, "Hello " . $this->args['hello'] . "!\n");
    }
}

Post your Job

$container->get('resque')->add('Acme\ResqueBundle\Job\HelloWorldJob', 'queuename', array('hello' => 'world'));

Hire a Worker

app/console resque:worker:start queuename

Party!

Best Practices

  1. Jobs should be small and simple
  2. Workers should be idempotent and transactional
  3. Design for concurrency - use connection pooling

Development & Testing

$ composer install --dev
$ bin/phpunit