I have this code on my controller.
// Queue job, Send notification
ExportCsvJob::dispatch(json_encode($exportdata))
->onConnection('database')
->onQueue('default');
.env file
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
config/queue.php
return [
'default' => env('QUEUE_DRIVER', 'sync'),
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'retry_after' => 90,
],
'sqs' => [
'driver' => 'sqs',
'key' => 'your-public-key',
'secret' => 'your-secret-key',
'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id',
'queue' => 'your-queue-name',
'region' => 'us-east-1',
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => 'default',
'retry_after' => 90,
],
],
'failed' => [
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
but when running php artisan queue:work --timeout=3600
never do anything,
I have this two records in jobs table
+-----+-----------------+------------------------------------------------------------------------------------------------------+----------+-------------+--------------+------------+
| id | queue | payload | attempts | reserved_at | available_at | created_at |
+-----+-----------------+------------------------------------------------------------------------------------------------------+----------+-------------+--------------+------------+
| 168 | shipment_export | {"displayName":"App\\Jobs\\ExportCsvJob","job":"Illuminate\\Queue\\[email protected]","maxTries | 0 | NULL | 1549262600 | 1549262600 |
| 169 | default | {"displayName":"App\\Jobs\\ExportCsvJob","job":"Illuminate\\Queue\\[email protected]","maxTries | 0 | NULL | 1549262834 | 1549262834 |
+-----+-----------------+------------------------------------------------------------------------------------------------------+----------+-------------+--------------+------------+
but when I changed QUEUE_DRIVER=sync
to QUEUE_DRIVER=database
It worked
Can give me explanation and possibly solution about my problem?