How to use Phalcon\Queue\Beanstalk?


//Connect to the queue
$queue = new Phalcon\Queue\Beanstalk(array(
    'host' => ''

//Insert the job in the queue
$queue->put(array('processVideo' => 4871));

processVideo is name of job? What mean 4871? Where processVideo should be defined?


processVideo is just a key to store it in your queue. You can name it whatever you want. 4871 is the id of the video. A simple example would be if you have a table in database that holds information about video files that needs to be processed:

Table columns id, file_path, is_processed

When you upload a video file, you store the information in your video table, with flag is_processed = 0 , then you add the file to the queue

$video = new VideoModel();

// $video->getId() will give you the id (in the above example 4871)
$queue->put(array('processVideo' => $video->getId()));