Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Obtaining status of a task(Beanstalk)

Hello community! Please tell me. How can I get status of the task of its identifier?

I get ID:

$id = $queue->put(array('createJob' => mt_rand(1,5)));

And?



1.0k
Accepted
answer

Problem solved. Phalcon have special class for this task, but in documentation i not found this: https://github.com/phalcon/cphalcon/blob/2.1.x/phalcon/queue/beanstalk/job.zep



37.9k

Hey

You can see documents Beanstalk at https://docs.phalconphp.com/en/latest/api/Phalcon_Queue_Beanstalk.html, Also you can use example my code to see ID

    $job = $this->queue->reserve();
    $message = $job->getBody();
edited Mar '16

One note for Beanstalk / Phalcon implementation.

If you're using reserve() method, it's better to call connect() on each iteration:

//Calling method connect() on a shared MessageBroker instance is the fastest approach
$this->messageBroker->connect();

W/o this, your loop gets slow (it seems that the class is trying to find previous connection).