files = $files; $this->bookingId = $bookingId; $this->groupId = $groupId; $this->batchIndex = $batchIndex; $this->totalBatches = $totalBatches; $this->isLast = $isLast; } public function handle() { Log::info(Carbon::now() . ': Start job - ETL Purchase Order Transaction.'); $start = new Carbon(); Log::info(Carbon::now() . ': Processing - ETL Purchase Order Transaction.', [ 'group_id' => $this->groupId, 'batch_index' => $this->batchIndex, 'total_batches' => $this->totalBatches, 'is_last' => $this->isLast, 'file_count' => count($this->files), ]); (App()->make(ETLPDFPurchaseOrderClaudeProcessor::class))->execute($this->files, $this->bookingId, $this->batchIndex !== 1, $this->isLast); $finished = Cache::increment('etl_finished_jobs_' . $this->groupId); Log::info('ETL job finished for group ' . $this->groupId, [ 'batch_index' => $this->batchIndex, 'total_batches' => $this->totalBatches, 'finished_counter' => $finished, 'timestamp' => now(), ]); if ($finished >= $this->totalBatches) { Log::info('All ETL jobs finished for group ' . $this->groupId . '. Last job finished at ' . now()); event(new ETLPurchaseOrderTransactionCompleteEvent(true, $this->bookingId)); } $end = new Carbon(); $elapsedTime = $start->diff($end)->format('%H:%I:%S'); Log::info(Carbon::now() . ': End job - ETL Purchase Order Transaction. ElapsedTime: ' . $elapsedTime . '.'); } }