AnsweredAssumed Answered

How to add multi tenant configuration for REST

Question asked by dj_universe on Feb 22, 2016
Latest reply on Feb 22, 2016 by dj_universe
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

Outcomes