Queue (Beanstalk)

Hi. I'm having trouble/difficulty learning about queue/beanstalk. I have a task that is called via cli (every x times) or via web (admin panel) and this task should only add a process to queue. Task: (convert .mkv to .mp4).

namespace Tasks;

use Phalcon\CLI\Task;
use Phalcon\Queue\Beanstalk;

class titlesTask extends Task

    public function convertAction(){
        $queue = new Beanstalk( [ 'host' => '', 'port' => '80', "persistent" => true, ] );
        $queue->put( [ 'processTitle' => ['/path/to/file.mkv', '/path/to/output.mp4'], ]);


    public function processTitle($inputFile, $outputFile){

        shell_exec("ffmpeg -i {$inputFile} -vcodec copy -acodec copy {$outputFile}");

        // this will add that file to DB;
        $this->console->handle(["task" => "title", "action" => "import", "params" => [$outputFile]]);


    public function listenAction(){

        $queue = new Beanstalk( [ 'host' => '', 'port' => '80', "persistent" => true,] );
        while ($queue->statsTube('processTitle')["current-jobs-ready"] > 0 && ($job = $queue->reserve())) {
             $message = $job->getBody();


        echo 'No Videos to Proccess';



I also want to have a terminal window opened to see how the process is going. (php cli titles listen)


sine predis died ( even tho its still working ), i think this is what people are using these days


its a big topic, i personally spend a lot of time making it working floweslly