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, the number of jobs per queue is not limited as such queues will have no effect (jobs would just be processed in the order that they were created in). 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).
                               # So each queue may only process 3 jobs simultaneously.

    queue_options:
        foo:
            max_concurrent_jobs: 2 # This limit applies only to the "foo" queue.
Note: Queue settings apply for each instance of the jms-job-queue:run command separately. There is no way to specify a global limit for all instances.

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.