I'm completely new using laravel/lumen
I generate a new lumen proyect a few hours ago and I'm trying to send job to the default queue using a database driver.
my .env file looks like this
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=mydb
DB_USERNAME=root
DB_PASSWORD=xxxx
CACHE_DRIVER=file
QUEUE_DRIVER=database
Following the official Queues - Lumen page I generate a migration to create jobs and failed_jobs tables.
config/queue.php file has the default configuration
Problem:
- before running the command
php artisan queue:work
I tried to send a job to the queue,Queue::push(new SendEmailJob)
but it run immediately and I didn't run the commandphp artisan queue:work
yet. I check the database and table job is empty. - I run the command
php artisan queue:work
make a request to a specific endpoint, put the job on the queue using one of this lineQueue::push(new SendEmailJob)
ordispatch(new SendEmailJob())
I got no errors but jobs queue still empty
What am I doing wrong?
Why queue process all jobs before I run the command php artisan queue:work
?
Thanks in advance