Laravel
Configuring Connections
While using Laravel we can reuse existing Connections (config/database.php).
And then we can set up 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).
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 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.
Last updated