Download the PHP package f9webltd/laravel-queue-check without Composer
On this page you can find all versions of the php package f9webltd/laravel-queue-check. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download f9webltd/laravel-queue-check
More information about f9webltd/laravel-queue-check
Files in f9webltd/laravel-queue-check
Package laravel-queue-check
Short Description Crudely, check if your Redis queue worker is running
License MIT
Homepage https://github.com/f9webltd/laravel-queue-check
Informations about the package laravel-queue-check
Laravel Redis Queue Check
A crude and simple Laravel console command to determine if your Redis queue worker is running.
When the command determines that your worker is not running, the event QueueCheckFailed
is dispatched.
Behind the scenes, the command ps aux
is ran to determine if you expected command is present.
Requirements
PHP >= 7.2, Laravel >= 5.8.
Installation
Publish the configuration file:
Documentation
Configuration Settings
The configuration is extremely basic and allows two expectations to be set.
processes
An integer, the required number of processes that should be present.
expected-output
The target command that should be running.
Some examples:
artisan queue:work redis
artisan horizon
php artisan horizon:work redis --delay=0 --memory=128 --queue=default --sleep=3 --timeout=60 --tries=3 --supervisor=abc:supervisor-1
The specificity is optional.
To determine the output typically ps aux | grep artisan
can be ran from the command line. So if the output of which was:
The following configuration values could apply:
expected-output
=artisan queue:work redis
processes
= 3
Usage within your application
When desired command or required number of processes is not running, the event QueueCheckFailed
os dispatched.
Within your application you can listen for that event.
Define the event listener, in this case QueueFailed
.
Register the scheduled task f9web:queue-check
:
The event returns the console output that caused the command to fail, In the below case, that is simply logged. The listener can of course do anything required, such as sending an email or a Slack notification.
N.B: When running a Redis queue, there is a high chance your application will queue mail. If the queue is down the notification email is queued, the email will never be sent. If sending an email ensure the mail is not queued. If using a "mailable" object the Queueable
trait can be omitted.
Contribution
Any ideas are welcome. Feel free to submit any issues or pull requests.
Testing
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-queue-check with dependencies
illuminate/config Version 5.8.* || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
illuminate/console Version 5.8.* || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
illuminate/support Version 5.8.* || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
symfony/process Version ^4.0|^5.0|^6.0|^7.0