You can easily install JMSJobQueueBundle with composer. Just run:
composer require olaldennis/job-queue-bundle
Next you need to update your bundles.php
file, and register the new bundle. If you are in Symfony 4 and above the bundle will automatically be registered using Symfony Flex:
Have your bin/console
use JMSJobQueueBundle's Application
:
Finally, run make migration and migrations migrate:
If you also want to use the webinterface where you can view the outputs, and exception stack traces for your jobs, you need to add the following to your
routing.yml
:
Then, update your dependencies using
And add the JMSDiExtraBundle and JMSAopBundle to your config/bundles.php:
Typically, you would also want to add some access control restrictions for these actions. If you are using JMSSecurityExtraBundle
this could look like this:
This will require the user to have the role ROLE_ADMIN
if he wants to access any action from this bundle.
For this bundle to work, make sure that you run at least one instance of the console command jms-job-queue:run
(you can run as many as needed to process your events or guarantee high availability).
Below, is a sample configuration that you can use with supervisord: