Laravel
Configuring Connections
return [
'default' => 'tenant_a_connection',
'connections' => [
'tenant_a_connection' => [
'url' => getenv('TENANT_A_DATABASE_URL')
],
'tenant_b_connection' => [
'url' => getenv('TENANT_B_DATABASE_URL')
],
]
];final readonly class EcotoneConfiguration
{
#[ServiceContext]
public function multiTenantConfiguration(): MultiTenantConfiguration
{
return MultiTenantConfiguration::create(
tenantHeaderName: 'tenant', // Message header, where to look for tenant
tenantToConnectionMapping: [
'tenant_a' => LaravelConnectionReference::create('tenant_a_connection'),
'tenant_b' => LaravelConnectionReference::create('tenant_b_connection')
],
);
}
}Sending Message in Context of Tenant
Defining Message Handlers
Last updated
Was this helpful?