You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I need to process a lot of task (more then 1000), get output and return all the results to the user. I've started to use Job and Batch with something like:
use App\Jobs\ImportCsv;
use Illuminate\Bus\Batch;
use Illuminate\Support\Facades\Bus;
use Throwable;
$batch = Bus::batch([
new ImportCsv(1, 100),
new ImportCsv(101, 200),
new ImportCsv(201, 300),
new ImportCsv(301, 400),
new ImportCsv(401, 500),
])->then(function (Batch $batch) {
// All jobs completed successfully...
})->catch(function (Batch $batch, Throwable $e) {
// First batch job failure detected...
})->finally(function (Batch $batch) {
// The batch has finished executing...
})->dispatch();
The parallel execution works perfectly but I can't read the output for each Jobs (when all Jobs are finished).
I understand the Job concept, that is a work to run in async mode and cannot return the output to the original "dispatcher"... but how I can mix the advantage of parallel Job with the possibility to read the outputs (when are completed)?
Thank you
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I need to process a lot of task (more then 1000), get output and return all the results to the user. I've started to use Job and Batch with something like:
The parallel execution works perfectly but I can't read the output for each Jobs (when all Jobs are finished).
I understand the Job concept, that is a work to run in async mode and cannot return the output to the original "dispatcher"... but how I can mix the advantage of parallel Job with the possibility to read the outputs (when are completed)?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions