dt246813579 2015-08-11 12:21 采纳率: 0%
浏览 78

Laravel无法排队工作

I repeatedly receive the following error when I try to push a job onto my Laravel Queue:

Argument 1 passed to Illuminate\Queue\Jobs\Job::resolveAndFire() must be of the type array, null given, called in /home/vagrant/Code/project/vendor/laravel/framework/src/Illuminate/Queue/Jobs/BeanstalkdJob.php on line 53 and defined

I have no clue what is going wrong but I'm guessing it's something to do with the fact I haven't used the SerializesModel Trait? When I try to use Serializes model, I just get an undefined property $directory error.

The job class is:

/**
 * Class StoreFile
 * @package App\Jobs
 */
class StoreFile extends Job implements SelfHandling, ShouldQueue
{
    use InteractsWithQueue;

    /**
     * @param string $directory
     * @param string $filename
     * @param UploadedFile $file
     */
    public function __construct($directory, $filename, $file)
    {
        $this->directory = $directory;
        $this->filename = $filename;
        $this->file = $file;
    }

    /**
     * @param FileSystem $storage
     * @return boolean
     */
    public function handle(FileSystem $storage)
    {
        $path = $this->directory . $this->filename;
        $storage->disk('s3')->put($path, $this->file);

        return true;
    }
}

UPDATE I queue the job from another class using this:

$this->dispatch(new StoreFile($directory, rawurlencode($filename), file_get_contents($evidence)));

Where $evidence is an UploadedFile. I'm certain that all the variables are set as if I remove the ShouldQueue/InteractsWithQueue the job executes fine

  • 写回答

1条回答 默认 最新

  • dopnpoh056622 2015-11-16 19:09
    关注

    The error can be solved easy. Check: may be you added manualy test message to queue. So, this message can broke your code, because has another structure.

    评论

报告相同问题?

悬赏问题

  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?