cancel
Showing results for 
Search instead for 
Did you mean: 

How to add multi tenant configuration for REST

dj_universe
Champ in-the-making
Champ in-the-making
I'm developing a workflow application that communicates with Activiti framework by REST API.

I'd like to add some configuration to support multi tenancy databases. I've found that I can use "tenantId" property to assign deployment or start new process instance. Unfortuantelly I don't know
<b>how and where should I assign these tenantIds to db configs?</b>

At this moment I have the following (clear) config files:

<b>activiti_custom_context.xml</b>


<bean id="dbProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
        <list>
            <value>classpath:db.properties</value>
            <value>file:activiti-rest.properties</value>
        </list>
    </property>
    <property name="ignoreUnresolvablePlaceholders" value="true" />
    <property name="ignoreResourceNotFound" value="true" />
</bean>

<bean id="dataSource"
    class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
    <property name="driverClass" value="${jdbc.driver}" />
    <property name="url" value="${jdbc.url}" />
    <property name="username" value="${jdbc.username}" />
    <property name="password" value="${jdbc.password}" />
</bean>


<b>db.properties</b>


db=mysql
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://myHost/activitidb?characterEncoding=UTF-8
jdbc.username=myUser
jdbc.password=myPass
5 REPLIES 5

hari
Star Contributor
Star Contributor
Hi,

Even I am working on multitenancy currently and have understood that it doesnot support REST based multi tenancy out of the box. We have to create a wrapper and expose those as services for the external system's use.

hari
Star Contributor
Star Contributor
I had a similar discussion here in the forum recently. Hope it might be of some help.
https://forums.activiti.org/content/shared-db-multitenancy
And below is a blog by Barrez on multi tenancy
http://www.jorambarrez.be/blog/2015/10/06/multi-tenancy-separate-database-schemas-in-activiti/

dj_universe
Champ in-the-making
Champ in-the-making
Thanks for your response. I've read the blog and yout posts earlier. The blog shows the multitenancy for integrated environment only so it's not our case.
You have written about proxy and defining own services. What should they do? (I've no experience in this area at this moment yet)

hari
Star Contributor
Star Contributor
Use the Activiti API and implement multi tenancy. Expose the implemented functionality to external systems to use it.

dj_universe
Champ in-the-making
Champ in-the-making
Thanks for clarification and support!