16 Multi-Tenancy
To use the Micronaut’s multitenancy capabilities you must have the dependency on your classpath.
A common requirement for supporting Multi-tenancy is the ability to resolve the current tenant. Micronaut ships with the following built-in TenantResolvers:
Micronaut supports tenant propagation. As an example, take the following scenario:
You want incoming requests to the microservice to resolve the tenant id via subdomain. However, you want your requests to other internal microservices to include the as an HTTP Header.
Your configuration in the microservice will look like:
In the microservice the configuration will look like:
To propagate the tenant you will need to write the resolved tenant ID to the outgoing requests.
Currently, Micronaut ships with two built-in implementations for :
name | description |
Writes the current tenant to a Cookie in your outgoing requests. See . | |
Writes the current tenant to a HTTP Header. See HttpHeaderTenantWriter Configuration Properties. |