Skip to content

Conversation

@mvpopuk
Copy link

@mvpopuk mvpopuk commented Nov 24, 2025

Purpose

Adds --json output option to queue:failed command for automation and monitoring use cases.

Changes

  • Converted $name to $signature with --json option definition
  • Modified handle() method to support JSON output
  • Added displayFailedJobsAsJson() method
  • Added tests for JSON output (empty state)
  • Maintains existing table output as default

Example Usage

Command:

php artisan queue:failed --json

Output:

{
  "failed_jobs": [
    {
      "id": "1234",
      "uuid": "550e8400-e29b-41d4-a716-446655440000",
      "connection": "redis",
      "queue": "emails",
      "class": "App\\Jobs\\SendEmail",
      "failed_at": "2025-11-21 10:30:00",
      "exception": "Connection timeout..."
    }
  ],
  "count": 1
}

Benefits:

  • Enables CI/CD pipeline integration
  • Supports monitoring and alerting systems
  • Allows programmatic failed job analysis
  • Follows recent pattern (schedule:list --json in PR #57741)

Backwards Compatibility:
Fully backwards compatible - optional flag, default behavior unchanged.

Future Work

Filtering options (--queue, --connection, --after, --class) will be added in a separate PR to keep this change focused and easy to review.

@taylorotwell
Copy link
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants