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!
- Jobs should be small and simple
- Workers should be idempotent and transactional
- Design for concurrency - use connection pooling
$ composer install --dev
$ bin/phpunit