Back

Run php artisan:queue as symfony process


I try to run

php artisan queue:work

as a symfony process so i made a class and in this class i have a variable :

/**
 * @var Process
 */
private static $jobWorkerProcess; 

and after in a public static method i do :

if (!isset(self::$jobWorkerProcess))
    {
        self::$jobWorkerProcess = new Process('php artisan queue:work &', base_path());
        self::$jobWorkerProcess->setTimeout(0);
        self::$jobWorkerProcess->start();
    }

i also created a public static method to get process log :

public static function getQueueWorkerLog()
{
    if (isset(self::$jobWorkerProcess))
        return self::$jobWorkerProcess->getProcess()->getOutput();
    else
        return 'jobWorkerProcess is null';
}

but getQueueWorkerLog() return 'jobWorkerProcess is null'.

It is possible to create the queue worker through symfony process?

Thanks for reply.


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us