Laravel
Last updated
Last updated
While using Laravel we can reuse existing Connections (config/database.php).
And then we can set up Mapping:
`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).
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 Entity Manager for the job.
Like we can see here, there is no code being aware of Multi-Tenancy here. This is because Ecotone will understand the current context and will switch default database to Tenant's database. This way Customer will be stored in correct DB.