jeudi 12 septembre 2019

How to toggle laravel queue from running or not

I just made my own maintenance mode called ApplicationMaintenanceMode extend CheckForMaintenanceMode.

class ApplicationMaintenanceMode extends CheckForMaintenanceMode
{
    ....
}

And also extend Application class

use Illuminate\Foundation\Application as App;
class Application extends App
{
    ....
    ....
    public function isApplicationDownForMaintenance()
    {
        //code
    }
}

Then, i also create my own DownCommand like the original

class DownCommand extends Command
{    
    protected $signature = 'app_down {--message= : The message for the maintenance mode. }
                 {--retry= : The number of seconds after which the request may be retried.}
                 {--only=* : Routes to be include from maintenance mode.}
                 {--type=* : Type of maintenance mode.}
                 {--except=* : Routes to be exclude from maintenance mode.}
                 {--version_allow= : Application Version allowed.}
                 {--lock_queue=false : Application Queue need to run or not.}
                 {--allow=* : IP or networks allowed to access the application while in maintenance mode.}';
}

As you can see --lock_queue where i want to toggle the queue worker can be running or not. The purpose is where the original Maintenance mode, its stop all the queues. what i want to achieve is where i want the queue can be easily toggle to run or not while in maintenance mode.

Is there any way to do it? should i overwrite the QueueManager and Worker class?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2NZM4XA
via IFTTT

Aucun commentaire:

Enregistrer un commentaire