You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+49Lines changed: 49 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,55 @@ A Laravel package for real-time monitoring of queues with stats on processing ti
28
28
29
29
---
30
30
31
+
## Usage
32
+
1. Queue Monitoring Dashboard
33
+
Once installed, the package provides a monitoring dashboard accessible at `/queue-monitor` (or a custom route specified in`config/queue-monitor.php`). The dashboard displays:
34
+
- The list of queues being monitored.
35
+
- The number of jobs processed.
36
+
- The number of failed jobs.
37
+
- The average processing timefor each queue.
38
+
2. Automatically Updating Queue Statistics
39
+
To update queue statistics after job processing:
40
+
- Inject the `QueueMonitorService` into your job classes or relevant services.
41
+
- Use the `updateQueueStatus` method to log the queue name, processing time, and failure status.
42
+
Example Integration in a Job:
43
+
```php
44
+
use MattYeend\QueueMonitoring\Services\QueueMonitorService;
45
+
46
+
class ExampleJob implements ShouldQueue
47
+
{
48
+
public functionhandle(QueueMonitorService$service)
49
+
{
50
+
$queueName = 'example-queue';
51
+
$startTime = microtime(true);
52
+
53
+
try {
54
+
// Performs job processing
55
+
} catch (\Exception $e) {
56
+
$service->updateQueueStatus($queueName, 0, true); // Log a failed job
0 commit comments