File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
src/Illuminate/Queue/Console Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ class MonitorCommand extends Command
1919 */
2020 protected $ signature = 'queue:monitor
2121 {queues : The names of the queues to monitor}
22- {--max=1000 : The maximum number of jobs that can be on the queue before an event is dispatched} ' ;
22+ {--max=1000 : The maximum number of jobs that can be on the queue before an event is dispatched}
23+ {--json : Output the queue size as JSON} ' ;
2324
2425 /**
2526 * The console command description.
@@ -65,7 +66,15 @@ public function handle()
6566 {
6667 $ queues = $ this ->parseQueues ($ this ->argument ('queues ' ));
6768
68- $ this ->displaySizes ($ queues );
69+ if ($ this ->option ('json ' )) {
70+ $ this ->output ->writeln ((new Collection ($ queues ))->map (function ($ queue ) {
71+ return array_merge ($ queue , [
72+ 'status ' => str_contains ($ queue ['status ' ], 'ALERT ' ) ? 'ALERT ' : 'OK ' ,
73+ ]);
74+ })->toJson ());
75+ } else {
76+ $ this ->displaySizes ($ queues );
77+ }
6978
7079 $ this ->dispatchEvents ($ queues );
7180 }
You can’t perform that action at this time.
0 commit comments