One more wrapper for jms/job-queue-bundle

Installs: 18 730

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 1

Open Issues: 0


dev-master / 3.0.x-dev 2017-07-11 16:44 UTC

This package is auto-updated.

Last update: 2022-04-29 00:40:59 UTC


One more wrapper for jms/job-queue-bundle. Global aim is working with multi-server architecture of you project. For example, cache:clear command needs to run for all your server. In this case job queue means server.

$manager = $container->get('octava_bundle_job_queue.manager');
$job = new Job('cache:clear');

$jobs = $manager->broadcast($job); //create job for all queues
$jobs = $manager->distinct($job); //create job for a default queue 



You can easily install OctavaJobQueueBundle with composer. Just add the following to your composer.jsonfile:

// composer.json
    // ...
    "require": {
        // ...
        "jms/job-queue-bundle": "^2.0-@dev",
        "octava/job-queue-bundle": "3.0.x-dev"

Put your server list as list of queue and define a default_queue.

    default_queue: web-server1

        web-server1: ~
        web-server2: ~
        web-server3: ~

    default_queue: '%default_queue%' #web-server1

Then, you can install the new dependencies by running composer’s update command from the directory where your composer.json file is located:

composer update jms/job-queue-bundle octava/job-queue-bundle

Now, Composer will automatically download all required files, and install them for you. Next you need to update your AppKernel.php file, and register the new bundle:


// in AppKernel::registerBundles()
$bundles = array(
    // ...
    new JMS\JobQueueBundle\JMSJobQueueBundle(),
    new Octava\Bundle\JobQueueBundle\OctavaJobQueueBundle(),
    // ...

Have your app/console use JMSJobQueueBundle’s Application:

// use Symfony\Bundle\FrameworkBundle\Console\Application;
use JMS\JobQueueBundle\Console\Application;

Finally, use the console command ocatava-job-queue:run for job execution.