skip to Main Content

I am very new to the laravel-queue concept ,our project has multiple databases based on each customer.i am implementing workflows by using queue-jobs ,all databases list we are maintaining in another database called secret_databases which will contain databaselist,jobs and failed_jobs tables.

databaselist table contains all databases which ever hold by customer or client,from this table i am connecting to the all databases that is working fine but while storing data in jobs table i modified queue column value from default to customvalue like(DatabaseName ~ modulename) it is also working fine.

Now when i run php artisan queue:work it’s not processing any jobs but data is there in table because it’s looking for default queue After researching i got to know i have to run following command

php artisan queue:work --queue_name

But in my case i could not able to run like this because total we have 400 databases and multiple module names,and in future many more databases can also be added so each time i could not able to run manually specifying queue_names .

i was looking for a solution how to run multiple jobs in all queue-names dynamically

2

Answers


  1. Based on the predefined expressions of the dynamic placement rule, dynamic queues are created automatically during runtime .

    YARN supports only one level of dynamic leaf queues. You can view the queue properties of the dynamically created leaf queues in the Dynamic Auto-Creation of Queue section of the Queue Properties. You can configure the dynamic leaf-queue properties by clicking on the Edit Child Queues option of its managed parent queue. The queue properties set at the managed parent queue level is applied to all of its leaf queues. For more information about setting properties for dynamic leaf queues, see Configure dynamic queue properties.

    Login or Signup to reply.
  2. I’ve done some research myself, and below are my notes and thoughts about this question (please look at it as an informative answer, not as the correct one).

    As you said:

    i modified queue column value from default to customvalue like(DatabaseName ~ modulename)

    Is there a good reason why would you do that? (maybe you have to make some measurements or generate some charts)

    If there is no reason why would you dispatch jobs to an undefined number of queues, listening to all possible queues doesn’t make sense because the reason to make queues is to separate the processing (connection vs queues) so you can set some queue priorities.


    If there is a good reason that motivates this approach you should note that restarting the queue each time a new database/module is created in your system by running:

    php artisan queue:work --queue=db1module1,db2module2
    

    appending the newly created database/module at the end, will set a priority for db1module1 over dbNmoduleN (the last added will have lower priority).


    Maybe restarting with the following command will solve the above problem, by creating parallel processes for each queue, but this means you will have an undefined number of processes running on your machine.

    php artisan queue:work --queue=db1module1 & php artisan queue:work --queue=db2module2
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search