vendredi 30 juin 2017

How do I carry a record number into a Laravel job failed method

Using Laravel 5.1. I'm trying to write a job and make a table record (log) of the fact that the job has been started, that it's been completed and if it's failed. I've created a parent class (JobBase) that extends Job implements SelfHandling, ShouldQueue which has a before() method, an after() method and per the documentation a public failed method. In the handle() method of the I call before() before doing any processing and at the completion of processing I call after(). JobBase has a class variable that is supposed to retain the value of the log record inserted in before() and then used to update the record in after() or failed(). However regardless of scope of the class variable, when the failed() method executes the variable is the default value, now what was set in the before() method. It appears as if a new instantiation of the class is created for the failed method.

So how would I retain the record number for the failed() method?

Note - using 5.1 because we need to run on Google App-Engine and that appears to be the only version with tools for it.

Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire