lundi 13 novembre 2017

How to execute queue work in multi tenant database

Im working on Multi-tenant with laravel where each tenant has its own database. Im using http://ift.tt/1mSp7ki.

Queue driver is database. Each database have its own jobs and failed-jobs table where to runs the queue. My problem is how to i run multiple queue processing according to their database connection? the database name is dynamic by tenant id ex: tenant_1, tenant_2 and etc... Is there any way it can be done by supervisor where it listen dynamic queue? is there any good practice which can be easily done this?

What i tried.. i tried to change the connection

$config = Config::get('database.connections.company');
$config['database'] = env('TENANTI_DB_PREFIX')."_$id";
config()->set('database.connections.company', $config);

then, i run

Artisan::call('queue:work');

its seems running, but no effect at all. It also jamming local server from load the web..which i need to kill php to make it stop..

its working if using command db:seed

Artisan::call('db:seed', [
     '--database' => 'company'
]);

so i tried to do the same with the php artisan queue in code.. but not working..



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2AAhNo1
via IFTTT

Aucun commentaire:

Enregistrer un commentaire