简体   繁体   中英

How to get job data from reserved jobs in laravel using pheanstalk?

I am working on a feature where I need to check the job status in beanstalkd queues. I have tried a few things but I am not getting the jobs that are reserved for queues other than the default queue

$pheanstalk = \Illuminate\Support\Facades\Queue::getPheanstalk();
$pheanstalk->useTube('import-live');
$pheanstalk->watch('import-live');
while ($job = $pheanstalk->reserve(0)) {
    var_dump(json_decode($job->getData(), true));
}

This is what I have tried. But I still get the data for the default queue. Anyone has any idea on how to get the data for the import-live queue as well? Or any other queues I have running in my system. Basically I want to get the data on all the queues in the system.

First of all - make sure that there are jobs in the other queues.

Then, if you don't want to get jobs from the 'default' queue for a particular run, you can ignore a it.

$job = $pheanstalk
    ->watch('import-live')
    ->watch('import-other')
    ->ignore('default')
    ->reserve();

->useTube('..') is only used when put() -ing messages into a queue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM