Is your class extending the abstract Job class that should be present in the app/Jobs/ directory?
Job handle() not called
Hi,
I'm stuck with Queue and jobs issue. I'm working on lumen. I've created jobs and failure migration. I got a Controller and a job. When I call the job in order to dispatch it goes into the constructor well but the handle() method is not called.
$this->dispatch(new FillBrutFec($import));
Then I look into jobs table and the job is insterted.
I put some logs into construct() and handle() :
protected $import;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(Import $import)
{
$this->import = $import;
Log::debug('construction');
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
Log::debug('handle');
}
But the handle is not print in logs file.
I've set the QUEUE_DRIVER in .env
QUEUE_DRIVER=database
I don't know what to do..
If you got any ideas, it will be a pleasure to resolve this. Thanks
sync and dispatchNow is the same. It will bit dispatched in sync. If you need to run it on queue, your approach is the right one. But you need worker that (yes, queue:work), that run constantly to work on that queue. And as soon as you dispatch a job on the queue, the worker are working that jobs.
Please or to participate in this conversation.