2

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.
Kumar V
  • 8,810
  • 9
  • 39
  • 58
  • I don't think that is the right approach for using queues. The queue worker needs to start a process. A better approach would be using something like supervisor. Not sure what options are available for windows. – Gaurav Jagtap Feb 01 '18 at 19:30
  • @GauravJagtap, Thanks for your suggestion. Windows is not ultimate. I can switch to Linux. Now I'm using windows for development purpose only. However, production server would be a linux server only. Let me think in process approach. Thanks for the clue :) – Kumar V Feb 02 '18 at 04:30

0 Answers0