larave版本是5.8。我将使用redis的queue函数。根据文档,当我启动queue:work命令时,它无法成功执行。错误日志有异常错误
环境:
拉维5.8
第7.2.21页
第5.0.5节
配置/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);
}
}
路由/web.php
Route::get('test', function (){
$appid = '1854956778';
$a = \App\Jobs\LoginLog::dispatch($appid);
dd($a);
});
Postman 测验
redis监视器
排队工作
php artisan queue:work --queue=sso
错误日志
1条答案
按热度按时间wfveoks01#
错误的原因是项目引入了php enqueue/laravel queue包。此软件包的0.9版本有一个在升级后修复的错误