我在 Laravel 5.7 上遇到了 Jobs 和 QUEUE 的问题,
该作业正在处理但未进入队列,我在数据库中也看不到任何内容 - 但是,我提到的增益是作业发生时没有问题,但范围是在队列中,拜托。
.env
QUEUE_DRIVER=database
工作
class CreateApplication implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $value;
protected $value1;
protected $value2;
protected $value3;
public $tries = 5;
public function __construct($value, $value1, $value2, $value3)
{
$this->value = $value;
$this->value1 = $value1;
$this->value2 = $value2;
$this->value3 = $value4;
}
public function handle()
{
$url = 'https://somewhere';
$client = new \GuzzleHttp\Client;
$response = $client->post($url, [
'form_params' => [
'session' => $this->value,
'appid' => $this->value1,
'env' => $this->value2,
'nodes' => $this->value3
]
]);
$response = json_decode($response->getBody(), true);
return $response;
}
}
控制器
use App\Jobs\CreateApplication;
...
CreateApplication::dispatch($value, $value1, $value2, $value3)->onQueue('processing');
终端
php artisan queue:listen
php artisan queue:table
php artisan queue:failed-table
Migrating: 2018_09_12_182619_create_jobs_table
Migrated: 2018_09_12_182619_create_jobs_table
Migrating: 2018_09_12_191537_create_failed_jobs_table
Migrated: 2018_09_12_191537_create_failed_jobs_table
经过几次尝试,两个表上都没有数据库中的数据。
请问有什么建议吗?