Closed sheriffmarley closed 4 years ago
From what I understand, the moment you call $this->prepareStatus()
in the constructor of a job, you will have access to it through getJobStatusId()
:
https://github.com/imTigger/laravel-job-status/blob/8d0dc85bc09e7949ec0f7a3de90f4cf5b28e41ba/src/Trackable.php#L55-L65
So in theory, you should be able to use the following:
$shareJob = new ShareOnSites();
$job = ImageResize::withChain([
$shareJob
])->dispatch($image);
// $job->getJobStatusId() == first job id
// $shareJob->getJobStatusId() == second job id
You can use "Improve job_id capture" feature >= 1.0.0 to catch job_id on new jobs. It also works on chained jobs.
I need to chain multiple jobs. First job
ImageResize
secondShareOnSites
, maybe there will be more in the Future. Till now I added them to the queue likeBut i need to track them.
As far as I see it, for each job, even if they are chained, a new job status is created. So how can I track the second job as soon as the first one finished? I would store in in the image table as
job_id
column.Can I get the second
job_id
in thehandle()
method of job two, or how would I have to do this?