The larave version is 5.8. I am going to use the queue function of redis. According to the documentation, when I start the queue: work command, it cannot be successfully executed. The error log has an abnormal error
env:
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);
});
queue work
php artisan queue:work --queue=sso
The cause of the error is that the project introduced the php-enqueue / laravel-queue package. The 0.9 version of this package has a bug that was fixed after the upgrade
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.