getContainer(); switch($job['type']) { case 'invoice_extraction': $handler = $container->get(\Queue\Jobs\ExtractInvoiceJob::class); $handler->handle($job['payload']); break; case 'submit_jofotara': $handler = $container->get(\Queue\Jobs\SubmitJoFotaraJob::class); $handler->handle($job['payload']); break; case 'risk_analysis': $handler = $container->get(\Queue\Jobs\RiskAnalysisJob::class); $handler->handle($job['payload']); break; case 'send_notification': $handler = $container->get(\Queue\Jobs\SendNotificationJob::class); $handler->handle($job['payload']); break; default: echo "[!] Unknown job type: {$job['type']}\n"; } echo "[✓] Job completed: {$job['id']}\n"; } catch (\Throwable $e) { echo "[✗] Job failed: {$job['id']} - {$e->getMessage()}\n"; // In a real app, you'd handle retries or move to a failed_jobs table } } else { usleep(500000); // 0.5s } } echo "[*] Worker stopped.\n";