Any Framework Configuration
Configuring Connections
Configuring Multi-Tenancy is straight forward, all we need to do is to define Conncetions for Tenants and mapping.
For new Connections
For new connections, you may register in your DI Container DbalConnection using DSN.
and then we can setup Mapping
Sending Message in Context of Tenant
`We've defined tenantHeaderName as tenant in our Mapping configuration. This means we can now pass tenant context under this name using Message Headers (metadata).
This way we are telling Ecotone, that we want to execute this Command in context of tenant_a.
Defining Message Handlers
We define Message Handler the same way we would do it for Single Tenant application. Yet we need to be aware that we need to make use of correct Connection for the job.
By marking Connection with MultiTenantConnection, Ecotone will understand that it should inject Connection for Tenant in current context.
Last updated