imTigger / laravel-job-status

Add ability to track Job progress, status and result dispatched to Queue.
MIT License
407 stars 60 forks source link

Use with Laravel-Excel's importing feature #65

Open jwindevelopment opened 4 years ago

jwindevelopment commented 4 years ago

I'm trying to use this with the laravel-excel package which allows chunked importing of CSV data. (https://docs.laravel-excel.com/3.1/imports/queued.html#queuing-chunks)

Laravel version: 5.6.*

The problem I'm running into seems to be in how the job-status package needs the "dispatch" method to happen a certain way, but the laravel-excel package uses a "queue" method that doesn't end up sending out events or SOMETHING which is causing the job status to not be updated. I am having the darndest time trying to track it down.

I apologize, I am ignorant here, and a beginner at this.

Here is some example code: From the controller where I pick up an API call (this is the excel implementation): $importer = new $job(array_merge($params, $metaParams)); $importer->queue($bucket . '/' . $uploadFilePath, 'minio');

The job being referenced is: class BaseBulkImport implements ShouldQueue, WithEvents { use Trackable, RegistersEventListeners, InteractsWithQueue, Queueable, SerializesModels;

When I attempt to dispatch the import job as noted in the job-status documentation $importer = new $job(array_merge($params, $metaParams)); $this->dispatch($importer);

I end up with this problem: Argument 2 passed to ...::queue() must be of the type string or null, object given, called in /opt/anorak/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php on line 157",

I know it's a long shot, but if you have any pointers, I'd be forever indebted.