Comments (7)
@ChrisCook1906, I tried but seems that works like a charm. What am I wrong?
// app/console/Kernel.php
protected function schedule(Schedule $schedule)
{
if (Tenant::current()) {
$schedule->job(TenantNoopJob::class)->everyMinute();
return;
}
$schedule->job(LandlordNoopJob::class)->everyMinute();
}
//
// TenantNoopJob
class TenantNoopJob implements ShouldQueue, TenantAware
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info('TenantNoopJob - '. Tenant::current()->domain .' - '. now());
}
}
//
// LandlordNoopJob
class LandlordNoopJob implements ShouldQueue, NotTenantAware
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info('LandlordNoopJob - '. now());
}
}
from laravel-multitenancy.
Hi @ChrisCook1906, how does scheduled your jobs? All jobs are scheduled using the Laravel default logic (tenant not-aware). Have you implemented a logic that replaces the original one? Please post your code to help me to understand. Thanks
from laravel-multitenancy.
I'm running the standard Scheduler function in App/Console/Kernel:
protected function schedule(Schedule $schedule) { $schedule->job(new UpdateMatrix())->hourly(); }
The job, UpdateMatrix, has the proper TenantAware function implemented. All of my other queued jobs are working correctly, except for those dispatched via the Schedule function in (App/Console/Kernel).
from laravel-multitenancy.
Ok, sorry for my questions but I'd like to understand: in your UpdateMatrix
do you use Tenant::makeCurrent()
?
from laravel-multitenancy.
No. In the UpdateMatrix
job, I implement the following:
use Spatie\Multitenancy\Jobs\TenantAware;
class UpdateMatrix implements ShouldQueue, TenantAware {......}
from laravel-multitenancy.
@ChrisCook1906, do you have found a solution to the issue?
from laravel-multitenancy.
@masterix21 Yes. Thank you.
from laravel-multitenancy.
Related Issues (20)
- MakeQueueTenantAwareAction seems to break active requests when Queue Connection is sync HOT 4
- base table or view not found with AWS SQS queue for job TenantAware HOT 15
- randomly receive Invalid catalog name: 1046 No database selected (Connection: mysql, SQL: insert into failed_jobs (uuid, connection, queue, payload, exception, failed_at) on queue sqs HOT 5
- Tenant Aware Queue Fails No Database Selected when running from supervisor in a multi tenant environment using AWS SQS FIFO HOT 2
- Update documentation at https://spatie.be to `v3` HOT 3
- in_array(): Argument #2 ($haystack) must be of type array, null given {"exception":"[object] (TypeError(code: 0): in_array(): Argument #2 ($haystack) must be of type array, null given at /spatie/laravel-multitenancy/src/Actions/MakeQueueTenantAwareAction.php:79) HOT 1
- Cache issue with spatie/laravel-permission in TenantAware Command HOT 5
- Issue with the has function on different connections HOT 1
- I want to Connect to mongo DB for some tables but it is giving "Database connection [mongodb] not configured.", exception: "InvalidArgumentException",…} error
- Custom cache driver missing when switching Tenant HOT 4
- Cannot schedule jobs in Laravel 11 HOT 3
- Can't make route not tenant aware
- Erro during Laravel 11 for Notification multitenacy for multi-database
- Problem to install in Laravel 11 HOT 1
- Laravel 11: Multiple database does not switch and use tenant database HOT 2
- NeedsTenant with route model binding HOT 4
- Spatie\Multitenancy\Concerns\UsesMultitenancyConfig should be moved to ImplementsTenant? HOT 2
- getConnectionName() not compatible - ?string
- Session store not set on request HOT 3
- Switching tenants in the jobs queue HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-multitenancy.