+1
Hỏi về hàm dispatch Job trong laravel
Chào mọi người, hiện tại mình đang làm 1 project có sử dụng hàng đợi. Mình dùng hàng đợi connection. Ở sever mình dùng supervisor. Hiện tại khi mình call API thì sau khi làm xong nó sẽ call hàm:
dispatch(new \App\Jobs\createSqlJob($databaseName, $data['company_name']));
Nhưng khi mình check lại table failed_jobs trong db thì phát hiện nó chạy lỗi và báo exception sau:
| 2022-12-13 21:36:38 | Exception: Job is incomplete class: {"__PHP_Incomplete_Class_Name":"App\\Jobs\\createSqlJob","afterCommit":true} in /var/www/NTTJob/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:116
Stack trace:
#0 /var/www/NTTJob/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(69): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware()
#1 /var/www/NTTJob/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call()
#2 /var/www/NTTJob/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(428): Illuminate\Queue\Jobs\Job->fire()
#3 /var/www/NTTJob/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(378): Illuminate\Queue\Worker->process()
#4 /var/www/NTTJob/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(172): Illuminate\Queue\Worker->runJob()
#5 /var/www/NTTJob/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(130): Illuminate\Queue\Worker->daemon()
#6 /var/www/NTTJob/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(114): Illuminate\Queue\Console\WorkCommand->runWorker()
#7 /var/www/NTTJob/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
#8 /var/www/NTTJob/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#9 /var/www/NTTJob/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#10 /var/www/NTTJob/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#11 /var/www/NTTJob/vendor/laravel/framework/src/Illuminate/Container/Container.php(651): Illuminate\Container\BoundMethod::call()
#12 /var/www/NTTJob/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call()
#13 /var/www/NTTJob/vendor/symfony/console/Command/Command.php(308): Illuminate\Console\Command->execute()
#14 /var/www/NTTJob/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run()
#15 /var/www/NTTJob/vendor/symfony/console/Application.php(1002): Illuminate\Console\Command->run()
#16 /var/www/NTTJob/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand()
#17 /var/www/NTTJob/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#18 /var/www/NTTJob/vendor/laravel/framework/src/Illuminate/Console/Application.php(102): Symfony\Component\Console\Application->run()
#19 /var/www/NTTJob/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run()
#20 /var/www/NTTJob/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
#21 {main} |
Mình ko biết đây là lỗi gì, mong mọi người ai có biết thì giúp mình với ạ. Mình cám ơn
Thêm một bình luận
1 CÂU TRẢ LỜI
0
Bạn thử đặt lại tên Job xem nhé:
use App\Jobs\CreateSqlJob;
dispatch(new CreateSqlJob($databaseName, $data['company_name']));