php artisan queue:work
is a simple command that listens to a queue and executes some jobs.
What's the whole concept?
You can run this simple command on the background and all jobs in queue will be executed.
But running a process (queue:work
) on the background is not always safe.
Why? because there is always the chance that the process may be terminated or stuck because of a memory leak.
In this case laravel recommends the use of a Supervisor .The supervisor is another process working like a service.It is responsible to check whether the process that php artisan queue:work
creates, works normally or it should be restarted.
This way php artisan queue:work
runs on the background but there is a mechanism (supervisor) which can restart the process in case something goes wrong