Courses

Queues in Laravel 12

How to Retry the Failed Job Manually: Many Options

You're reading a FREE PREVIEW of a PREMIUM course.
Summary of this lesson:
- Retrying a specific failed job using php artisan queue:retry {uuid} command
- Retrying all failed jobs with php artisan queue:retry all
- Setting job retry attempts using the --tries flag when running queue workers
- Configuring retry attempts within job classes using $tries property or tries() method

In this lesson, we will discuss how to retry a failed job in Laravel queues. There are multiple approaches to handling retries, and we'll explore each one.


Manually Retrying a Failed Laravel Job

Let's begin with the scenario from our previous lesson where we had an error in our email template. The template was trying to use a variable that wasn't passed from the mail class. We've now fixed that error by passing the missing variable:

app/Mail/RegisteredUserMail.php:

class RegisteredUserMail extends Mailable
{
// ...
public function content(): Content
{
return new Content(
view: 'emails.registered-user',
with: [
'name' => $this->user->name,
'email' => $this->user->email,
]
);
}
}

After fixing the code, we restart the queue worker. However, the job isn't automatically processed because...

The full lesson is only for Premium Members.
Want to access all 15 lessons of this course? (46 min read)

You also get:

  • 76 courses
  • Premium tutorials
  • Access to repositories
  • Private Discord