Support the ongoing development of Laravel.io →
Queues Jobs

How to add job again in queue if certain condition met in handle method of laravel command or stop a job being mark as complete if certain condition met. I am adding job in laravel queue. And listener pick the job from queue. This job check several condition and if certain condition met it dump the data in to database and finish the execution. During the execution of job there are certain condition if those met then dumping of database is not completed that means task is not finish which i want to accomplish but job is marked as complete because it successfully executed the handle method of command. How can i stop a job being mark as complete if data is not dumped into database?

Last updated 3 years ago.
0

Throw an exception instead of exiting the method to release the job back to the queue to be retried later.

0

@Xum Thanks. Yes i tried this throwing exception solution. I was looking for if there is any another way or any best practice.

0

Throwing exception is what documentation proposes. There's also another way to release the job mentioned in the docs.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

msankhala msankhala Joined 18 Feb 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.