larave版本是5.8。我将使用redis的队列功能。根据文档,当我启动queue:work命令时,它无法成功执行。错误日志中有异常错误
环境:
config / queue.php
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => env('REDIS_QUEUE', 'sso'),
'retry_after' => 90,
'block_for' => null,
],
app / Jobs / 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);
}
}
routes / web.php
Route::get('test', function (){
$appid = '1854956778';
$a = \App\Jobs\LoginLog::dispatch($appid);
dd($a);
});
排队工作
php artisan queue:work --queue=sso
答案 0 :(得分:0)
错误的原因是该项目引入了php-enqueue / laravel-queue软件包。此软件包的0.9版本具有一个在升级后已修复的错误