I am building an application with Laravel that receives notifications and then fires events to handle those notifications. I want these events to be Queued so that only one event is handled at a time.
I've been trying to use the "database" Queue driver that the documentation says is available. I've changed the default driver in config/queue.php so it is set to use "database" and I ran php artisan queue:table to create the jobs migration but when I send a notification to the app I do not see any sign of queues being used in the jobs table or anywhere else. What could be going wrong?
(My EventHandler class is using ShouldBeQueued as well)
Show activity on this post. This is lower level but in the same vein you could run a command such as ps -aux | grep queue to literally view the running queue processes on whatever server your application/queue workers are running on.
Laravel Queues Queue Driver Configuration A queue driver is the handler for managing how to run a queued job, identifying whether the jobs succeeded or failed, and trying the job again if configured to do so.
Laravel queues provide a unified API across a variety of different queue backends, such as Beanstalk, Amazon SQS, Redis, or even a relational database. Queues allow you to defer the processing of a time consuming task, such as sending an email, until a later time.
Laravel allows the facility to configure queues with several drivers like database, Beanstalkd, Redis, Amazon, IronMQ, etc. Drives are used to store the list of tasks. The selection of the drives is based on the weight of your task list.
Each of Laravel's queue drivers are configured from the config/queue.php file. A queue driver is the handler for managing how to run a queued job, identifying whether the jobs succeeded or failed, and trying the job again if configured to do so.
Currently, Laravel provides first-party support for five databases: The configuration for Laravel's database services is located in your application's config/database.php configuration file. In this file, you may define all of your database connections, as well as specify which connection should be used by default.
For convenience, Laravel supports these URLs as an alternative to configuring your database with multiple configuration options. If the url (or corresponding DATABASE_URL environment variable) configuration option is present, it will be used to extract the database connection and credential information.
The main idea of queuing long-running tasks is to be able to execute them in some background process so your main application thread won't block and you can serve your client requests more quickly. For further information on different drivers and help please visit Laravel docs
In your .env file, you have to add this.
QUEUE_DRIVER=database
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With