1
votes

I have created a chain of deployment jobs in Laravel following the documentation:

https://laravel.com/docs/5.6/queues#job-chaining

From the docs (similar to my code):

ProcessPodcast::withChain([
    new OptimizePodcast,
    new ReleasePodcast
])->dispatch();

Is there any way to track whether the job chain has started and finished completely?

I guess a possibility would to always start the chain with a beforeDeployment job and a afterDeployment job. Since the chain gets broken when an error happens and the afterDeployment will not be reached, this seems feasible.

Any thoughts on taking this approach or is there something easier to be done?

I guess my approach would allow me to set a listener like so:

https://laravel.com/docs/5.6/queues#job-events

Cheers!

1

1 Answers

2
votes

Honestly, if I was implementing this – I'd have an event fire upon success PodcastWasReleased which notified me, but I'd hook into the Queue::failing() listener (https://laravel.com/docs/5.6/queues#failed-job-events) to again, fire an event PodcastFailedToRelease.

You could pass the job which failed into the event to give a concise idea as to what happened, as well as the stack trace available in the JobFailed object.

Does that help? Maybe it'll at least set you on a different path.

Let me know how you get on :)