简体   繁体   English

如何使用pheanstalk从laravel中的保留作业中获取作业数据?

[英]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. 我正在开发一项功能,该功能需要检查beantalkd队列中的作业状态。 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. ->useTube('..')仅在put()消息放入队列时使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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