I'm trying to use a job for massive data upload...the idea is use a job to send excel sheet one by one to webservice, which is in charge of insert data to DB. Here is my job code :
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Facades\ {
App\Api\Insert
};
class uploadHoja implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
private $hojas;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($hojas)
{
$this->hojas = $hojas;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$hojas = $this->hojas;
foreach ($hojas as $key => $value) {
$respuesta = Insert::insertData($value);
$response = json_decode($response,true);
dd($response);
#if ($response["msg"] != 0) break;
}
}
}
Insert it's a facade for the webservice class, every function inside of this class it's working fine ( I already tested every one), but for some reason the handle method of the job fails, and when I type "php artisan queue:work"...it just loop "Processing : App\Jobs\uploadHoja"...until I end the process manually. Any help ? Thank you for your time.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire