Package Data | |
---|---|
Maintainer Username: | gilbitron |
Maintainer Contact: | gilbert@pellegrom.me (Gilbert Pellegrom) |
Package Create Date: | 2017-01-17 |
Package Last Update: | 2017-01-17 |
Home Page: | https://packagist.org/packages/gilbitron/laravel-queue-monitor |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-11 15:24:04 |
Package Statistics | |
---|---|
Total Downloads: | 11,243 |
Monthly Downloads: | 79 |
Daily Downloads: | 3 |
Total Stars: | 10 |
Total Watchers: | 3 |
Total Forks: | 4 |
Total Open Issues: | 3 |
A Laravel package to monitor queue jobs. Logs certain information about queue jobs in a database table:
--tries
is being used the attempt number for each jobInstall the composer package:
composer require gilbitron/laravel-queue-monitor
Add the service provider in config/app.php
:
/*
* Package Service Providers...
*/
Gilbitron\LaravelQueueMonitor\LaravelQueueMonitorProvider::class,
Run a migration to setup the queue_monitor
database table:
php artisan migrate
All queue jobs will now be monitored and results stored to the queue_monitor
database table. No other configuration is required.
To save custom data with the queue monitor results you need to include the QueueMonitorData
trait in your Job and use the saveQueueMonitorData()
method. For example:
<?php
namespace App\Jobs;
use Gilbitron\LaravelQueueMonitor\Jobs\QueueMonitorData;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
class ExampleJob implements ShouldQueue
{
use InteractsWithQueue, Queueable, SerializesModels, QueueMonitorData;
protected $results = 0;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$this->results = rand(1, 100);
$this->saveQueueMonitorData([
'results' => $this->results,
]);
// ...
}
}
Laravel Queue Monitor was created by Gilbert Pellegrom from Dev7studios. Released under the MIT license.