Can one process engine should serve multiple tenants with different schema

I was using Camunda workflow for one of my usecase. It was working fine with MySQL datasource. But i need a solution or example for the below scenario to achieve this.

a)I was using “camunda-bpm-spring-boot-starter-rest” and making rest api call to access workflow services.
b)Not using processes.xml file or bpm.xml file to provide datasource details. It was done using java configuration. Like below,

@Configuration(value = “dataSourceConfig”)
public class DataSourceConfig {

private static final Logger LOGGER = LoggerFactory.getLogger(DataSourceConfig.class);

private String dbUserName;

private String dbPassword;

private String dbUrl;

@Bean(name = “dataSource”)
public DataSource dataSource() {“Inside {} configuration…”, “datasource”);
SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
try {
} catch (InstantiationException | IllegalAccessException e) {"Exception: {} ", e);
return dataSource;

@Bean(name = “transactionManager”)
public DataSourceTransactionManager transactionManager() {“Inside {} configuration…”, “transactionManager”);
return new DataSourceTransactionManager(dataSource());

Camunda workflow setup:
a)I have more than one tenant. Let’s say google, microsoft, vmware
b)I’m following schema per tenant and also i have schema’s based on each tenant. I’m using Mysql datasource for all schemas. Schemas are created like this tenant-google, tenant-microsoft, tenant-vmware
c)Camunda workflow itself created as springboot microservice it can run independently and we can scale it up, load balancing , etc.

Observations from camunda doc:

a)One processengine → Multiple Tenant → Table level isolation(having discriminator column)

b)One processengine per tenant → each tenant will have seperate database or seperate schema


a)For process engine bootstrapping always dataSource is eagerly initialized

b)Tenant details and related schema are in-place while starting the application.

c)And how can we avoid processengine bootstarpping at application startup. can’t we start process engine lazily based on tenant request?


a) Need to introduce new tenant dynamically at any point of time and processengine should connect to that dataSource based on tenant by lazy initalization of datasource(it means processengine should connect with tenant specific schema when tenant specific request is recieved by process engine)

b) One processengine should serve for multiple tenants and schema would be per tenant(it means each tenant will have seperate schema but all tenant requests should be processed by one process engine). Is that possible?

How can we acheive this? If possible share some sample code or example.

This is not possible as far as I know. The way Camunda works OOTB for a schema per tenant requires a separate process engine. It would require customization of the engine to make this behavior change.
You may be able to handle this outside Camunda using a proxy to determine which tenant to route requests depending on some identifier.


If i provide custom implementation of process engine(implementing as shared process engine) for serving more than one tenant with different schema, then still can i access the rest api’s provided by the camunda-springboot-starter-rest ?

I think as long as you hide the implementations behind the existing interfaces without added or extending the interfaces you should be able to use the REST api as is. If you make changes to the interfaces you would have to change the REST api accordingly. I don’t have an exhaustive knowledge of the REST api, but from what I do understand the standard is to use the Interface not the Impl.

@aravindhrs,were you able to achieve this?
If yes,how? and can you share a sample code?

In one springboot application, you can’t create multiple process engines. In order to setup multiple process engines, better to use container(Tomcat/Wildfly) managed distributions of camunda.

Multitenancy with SpringBoot application,

  1. To handle all multiple tenants in same spring boot app, use discriminator column TENANT_ID_ , here single schema is shared across all the tenants.
    Reference: Multi-Tenancy |

  2. Deploy one SpringBoot application per tenant, so each tenant will have own separate schema.
    Reference:Multi-Tenancy |