猿问

当我使用laravel5.8的redis队列功能时,无法正常使用

larave版本是5.8。我准备用redis的队列功能。根据文档,当我启动 queue: work 命令时,它无法成功执行。错误日志有异常错误

环境:

  • laravel5.8

  • php7.2.21

  • redis5.0.5

配置/queue.php

'redis' => [

            'driver' => 'redis',

            'connection' => 'default',

            'queue' => env('REDIS_QUEUE', 'sso'),

            'retry_after' => 90,

            'block_for' => null,

        ],

应用程序/工作/LoginLog.php


<?php


namespace App\Jobs;


use Illuminate\Bus\Queueable;

use Illuminate\Queue\SerializesModels;

use Illuminate\Queue\InteractsWithQueue;

use Illuminate\Contracts\Queue\ShouldQueue;

use Illuminate\Foundation\Bus\Dispatchable;

use Illuminate\Support\Facades\Log;


class LoginLog implements ShouldQueue

{

    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;


    protected $data;

    /**

     * Create a new job instance.

     *

     * @return void

     */

    public function __construct($appId)

    {

        $this->data = $appId;

    }


    /**

     * Execute the job.

     *

     * @return void

     */

    public function handle()

    {

        Log::info('job handle...',$this->data);

    }

}


路线/web.php


Route::get('test', function (){

    $appid = '1854956778';

    $a = \App\Jobs\LoginLog::dispatch($appid);

    dd($a);

});

邮递员测试

婷婷同学_
浏览 362回答 1
1回答

森林海

错误原因是项目引入了php-enqueue/laravel-queue包。这个包的0.9版本有一个bug,升级后修复了
随时随地看视频慕课网APP
我要回答