octava / job-queue-bundle
One more wrapper for jms/job-queue-bundle
Installs: 25 005
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 0
Type:bundle
Requires
- doctrine/collections: ^1.3
- jms/job-queue-bundle: ^2.0-@dev
- sonata-project/admin-bundle: ^3.9
This package is auto-updated.
Last update: 2024-11-29 04:57:43 UTC
README
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 or $jobs = $manager->distinct($job); //create job for a default queue $manager->flush($jobs);
Installation
You can easily install OctavaJobQueueBundle with composer. Just add the following to your composer.json
file:
// 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.
#parameters.yml parameters: #... default_queue: web-server1 #config.yml jms_job_queue: queue_options: web-server1: ~ web-server2: ~ web-server3: ~ octava_job_queue: 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:
<?php // 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.