Multi-Tenancy: Programmatically create tenant

Hi all

I would like to provide a business process for multiple customers. For that, Camunda provides the multi-tenancy concept.

A requirement is that the customers can on their own register through a (external) website, which causes the setup of a Camunda process engine and database for the customer (every customer should have its own process engine and database).

As far as I understand the Camunda documentation, the process engines for the tenants need to be registered in the bpm-platform.xml and the data sources in the server.xml (the pre-packaged camunda distribution with Tomcat is used).

I wonder how I can register a new tenant programmatically. And can the tenant registration be accomplished without restarting the Tomcat application server, so that the other tenants are not affected by a registration of a new tenant?

Another thing is, that the tentants should not see anything from each other. As a test, I have registered multiple tenants in the bpm-platform.xml manually. This causes, that a dropdown box is visible on the upper right corner in Camunda. Can this dropdown box be made invisible?

Kind regards
Micha Boller

1 Like

@miguelgalaxy can you use the Rest API?


Thank you for your reply.
Yes, it is possible to use the REST API.
But is it also possible to configure the database to be used for a tenant through the REST API?
Every tenant should have it’s own database.

As documented in the multi tenancy section, there are two approaches to it: one that uses a single schema and discriminator columns and one that uses one database schema per tenant. Every Camunda API that says something about tenants is for the first approach. For the second approach, you would simply bootstrap multiple engines. There is no REST API endpoint to do this. Camunda also has no feature to create a database schema or datasource. You would have to implement these things yourself. You can register process engines programmatically via RuntimeContainerDelegate.INSTANCE.registerProcessEngine.



Thank you for your reply.
I have tried to register the Process Engine through the RuntimeContainerDelegate.

First I have created a database and imported the SQL scripts.
Then I did the following calls:

ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration()


Now, when I open the URL http://localhost:8080/camunda/app/admin/camunda/#/login and press the login button, then an InvalidRequestException is logged: Process Engine with name camunda does not exist.

What else is needed so that this works? Where can I find more information about the bootstrapping API?

1 Like

Could you share the minimal sources of an application that reproduces this on github?


The bootstraping of a process engine works now. I had a small error in my pom.xml…

When the Tomcat application server is restarted, the bootstrapped process engine is gone. What is the way to go to persist the process engine? Add it to the bpm-platform.xml (and the datasource in server.xml) programmatically by file manipulation?

Yes, you would have to build some kind of persistence yourself, be it as part of bpm-platform.xml, a custom file or a database table.


Hi @miguelgalaxy I am trying to achieve the same using camunda and wildfly server. Could you please tell me how to connect to a new h2 db instance using a new process engine. I want to connect two process engines to two new and different databases in camunda.
How to I achieve this? I wish to save data of every tenant separately and connect to a new db instance for every tenant. or atleast new db for every process engine. How to I configure this in process.xml and standalone.xml?