You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a problem I noticed when I was working on a project is that there's some unexpected behavior happens in queues, at which I try to implement NotTenantAware or TenantAware and switch the queues_are_tenant_aware_by_default key, and then I realize that there's a problem happens on the other side, meaning that if the tenant side is fixed, the landlord side crashes in queues and vice versa.
Env:
PHP 7.4.8
Laravel 7.0
OS: Windows
Local Server Client: Laragon
namespace App\Listeners\Landlord;
use App\Events\Landlord\TenantCreated;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\Artisan;
use Spatie\Multitenancy\Jobs\NotTenantAware;
class OnTenantCreated implements ShouldQueue, NotTenantAware
{
public $queue = 'tenants_db';
public function __construct()
{
//
}
public function handle(TenantCreated $event)
{
Artisan::call(
"tenants:artisan \"migrate --database=tenant --seed\" --tenant={$event->tenant->id}"
);
}
}
this code is Landlord Specific Event Listener
namespace App\Listeners\Tenant;
use App\Events\Tenant\UserCreated;
use App\Mail\UserCreatedMail;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\Mail;
use Spatie\Multitenancy\Jobs\TenantAware;
class OnUserCreated implements ShouldQueue, TenantAware
{
public $queue = 'tenants_mail';
public function __construct()
{
//
}
public function handle(UserCreated $event)
{
Mail::to($event->user)->send(new UserCreatedMail($event->user));
}
}
and this one is tenant specific.
However, when I switch the key in config one works and one crashes, but I noticed something happened also.
When I tried to use Tinker or Web to inspect those Listeners Implementations I got the right implementation Like following:
There's a problem I noticed when I was working on a project is that there's some unexpected behavior happens in queues, at which I try to implement NotTenantAware or TenantAware and switch the queues_are_tenant_aware_by_default key, and then I realize that there's a problem happens on the other side, meaning that if the tenant side is fixed, the landlord side crashes in queues and vice versa.
Env:
this code is Landlord Specific Event Listener
and this one is tenant specific.
However, when I switch the key in config one works and one crashes, but I noticed something happened also.
When I tried to use Tinker or Web to inspect those Listeners Implementations I got the right implementation Like following:
And then I tried to Log Listener implementations to errors log file and I noticed something very very weird:
As the result shows, it does not detect TenantAware or NotTenantAware interfaces from inside MakeQueueTenantAwareAction
Solutions I tried:
The text was updated successfully, but these errors were encountered: