I am trying to execute job through dispatch()
method using
- laravel 5.4
- redis-server
- supervisor
I have done queue
config like 'default' => env('QUEUE_DRIVER', 'redis')
.
- I am call dispatch() method in my
app/Services
file
dispatch(new SavePropertyImages($pid_list));
the following is my job file in
app/Jobs
:namespace App\Jobs; use App\Property; use App\Services\CreaBase; use Illuminate\Bus\Queueable; use Illuminate\Queue\SerializesModels; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; class SavePropertyImages implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; protected $pid; protected $creaBase; public $timeout = 300; public $tries = 1; /** * Create a new job instance. * * @return void */ public function __construct($pid) { $this->pid = $pid; } /** * Execute the job. * * @return void */ public function handle() { $this->creaBase = new CreaBase(); if (!$this->creaBase->isLogin){ $this->creaBase->init(); } $this->creaBase->saveAllImages("Property", $this->pid); } }
When I call a dispatch(new SavePropertyImages($pid_list))
method, the job's __construct()
method calls, but it does not call handle()
function.
Do you have any ideas?