I'm creating 5 queues named q1, q2..q5 each have a job to execute. To run all 5 jobs simultaneously, placed each job in different queues.
with use of artisan command, I can run each queue in separate consoles
php artisan queue:work --queue:q1
php artisan queue:work --queue:q2
..
..
php artisan queue:work --queue:q5
I got success with above command in console. But now i need to execute above commands in coding without using console.
So i tried with below code to execute.
\Illuminate\Support\Facades\Artisan::call("queue:work", ["--queue" => "q1"]);
\Illuminate\Support\Facades\Artisan::call("queue:work", ["--queue" => "q2"]);
..
..
\Illuminate\Support\Facades\Artisan::call("queue:work", ["--queue" => "q5"]);
But the problem is now that q2 is picked only after q1 is completed which means queues executed sequentially but not in parallel.
I used sync
option for queue driver. This also executes q1 at first and then picks the q2 only after q1 is completed.
My technical configuration is.
Queue drive: database
Os: windows
Laravel version: 5.5, Lumen 5.4
Mysql Database.