Table Of Contents

Support

You can obtain free community support for example through stackoverflow, or also through the Symfony2 mailing list.

If you think you found a bug, please create a ticket in the bug tracker.


Continuous Inspections

If you take code quality seriously, try out the new continuous inspection service.
scrutinizer-ci.com

GitHub

Usage

Creating Jobs

Creating jobs is super simple, you just need to persist an instance of Job:

<?php

$job = new Job('my-symfony2:command', array('some-args', 'or', '--options="foo"'));
$em->persist($job);
$em->flush($job);

Adding Dependencies Between Jobs

If you want to have a job run after another job finishes, you can also achieve this quite easily:

<?php

$job = new Job('a');
$dependentJob = new Job('b');
$dependentJob->addDependency($job);
$em->persist($job);
$em->persist($dependentJob);
$em->flush();

Schedule a Jobs

If you want to schedule a job :

<?php

$job = new Job('a');
$date = new DateTime();
$date->add(new DateInterval('PT30M'));
$job->setExecuteAfter($date);
$em->persist($job);
$em->flush();

Fine-grained Concurrency Control through Queues

If you would like to better control the concurrency of a specific job type, you can use queues:

<?php

$job = new Job('a', array(), true, "aCoolQueue");
$em->persist($job);
$em->flush();

Queues allow you to enforce stricter limits as to how many jobs are running per queue. By default, a queue the jobs per queue are not limited as such queues will have no effect. To define a limit for a queue, you can use the bundle’s configuration:

jms_job_queue:
    queue_options_defaults:
        max_concurrent_jobs: 3 # This limit applies to all queues (including the default queue).

    queue_options:
        foo:
            max_concurrent_jobs: 2 # This limit applies only to the "foo" queue.

Prioritizing Jobs

By default, all jobs are executed in the order in which they are scheduled (assuming they are in the same queue). If you would like to prioritize certain jobs in the same queue, you can set a priority:

$job = new Job('a', array(), true, Job::DEFAULT_QUEUE, Job::PRIORITY_HIGH);
$em->persist($job);
$em->flush();

The priority is a simple integer - the higher the number, the sooner a job is executed.