Hello,
I am developing a spring boot app in which I want to implement multitetancy where each tenant has its own db, not just a different schema.
Can I still use MultiSchemaMultiTenantProcessEngineConfiguration or is this used when we have one db server and multiple schemas?
If I can’t use it, can I implement it using for example Hibernate or it isn’t possible at all?
Hi @desp.kaz,
when you try to setup something like this, I would recommend to read through the MultiSchemaMultiTenantProcessEngineConfiguration
and related classes like the TenantAwareDataSource
. When doing this, you need to understand your database, connection pools and how the isolation between different requests, threads etc. works. Without deep knowledge about the database and the few configuration files Flowable provides you, I would recommend you to stick to a default configuration like for each database a Flowable instance.
What do you want to do with Hibernate?
Valentin
Hello @valentin,
I have managed to create a dummy implementation and test it just by using two h2 databases and MultiSchemaMultiTenantProcessEngineConfiguration (I had a look also at TenantAwareDataSource to check how the connection is changed according to tenantId) but then I saw the javadoc from here: flowable-engine/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cfg/multitenant/MultiSchemaMultiTenantProcessEngineConfiguration.java at main · flowable/flowable-engine · GitHub
A {@link ProcessEngineConfiguration} that builds a multi tenant {@link ProcessEngine} where each tenant has its own database schema.
So, I understood that MultiSchemaMultiTenantProcessEngineConfiguration can only be used for same db server-different schemas case. Is this true?
I thought of using Hibernate multitenancy feature or SpingJPA like mentioned here: https://www.baeldung.com/multitenancy-with-spring-data-jpa to change the flowable database before each call because I thought that it’s not possible with MultiSchemaMultiTenantProcessEngineConfiguration.
So, to conclude:
- Is it possible to use MultiSchemaMultiTenantProcessEngineConfiguration also for different db servers but is this something you don’t recommend? Do you think that if I implement it with spring jpa would be better?
by this you mean to have multiple instances of my springboot app with different dbs?
Hey @desp.kaz,
The class you are referencing if using different DataSource
(s). In theory they can be different DB servers as well.
Indeed that is what Valentin meant. You need to have multiple instances of your Spring Boot App, each communicating with a different database.
Cheers,
Filip