Skip to content

Latest commit

 

History

History

multidatasource-multitenancy

multidatasource-multitenancy

Multi-tenancy is a software architecture in which a single instance of a software application is used to serve multiple tenants. Each tenant is a separate entity that has its own unique data, configuration, and user base. This architecture allows for efficient resource utilization, as the software application only needs to be installed and maintained once, but can be used by multiple tenants.

Multidatabases is a similar concept, but applies to databases rather than software applications. In this architecture, multiple databases are used to store and manage data for different tenants. This allows for efficient resource utilization, as the same database server can be used to host multiple databases. It also allows for greater flexibility, as different tenants can have different database configurations and access controls.

Application Flow

---
title: Application Data fetching strategy
---
flowchart TD
    A([Appication]) -->|Get Data| B{Where should I get data}
    B --> |primary| C[(Oracle)]
    B --> |secondary| D[(Postgres)]
    C --> |TenantId| E[Discriminator based MultiTenancy]
    D --> |Schema| F[Schema based MultiTenancy]
    E --> |Choose Tenant |G{tenant1 or tenenat2}
    F --> |Choose Schema |H{schema1 or schema2}
    G --> I(((END)))
    H --> I
Loading

Run tests

$ ./mvnw clean verify

Run locally

$ docker-compose -f docker/docker-compose.yml up -d
$ ./mvnw spring-boot:run -Dspring-boot.run.profiles=local

Useful Links