Hello,
I try to implement a Multi-Schema Multi-Tenancy with the MultiSchemaMultiTenantProcessEngineConfiguration configuration class. I integrate with Activiti only through rest, my main app is written in Python.
Every request I do to activiti has the tenantId information, then it should be easy for activiti to route the query to the correct DB, however I need to crate a class implementing the TenantInfoHolder.
My question is, where do I hook this class in activiti-rest code to be sure the tenantId will be always set when a DB query is done ?
Thank you !
Solved! Go to Solution.
The class that implements TenantInfoHolder is registered when you create the configuration for MSMT.
It is a relatively simple interface and in general all it needs to do is correlate your current userid to the tenant id.
Alternatively, if the tenant_id will be included in the url you can use a filter to set/get a thread local variable:
protected static final ThreadLocal<Long> currentTenantIdPlaceHolder = new ThreadLocal<Long>();
...
...
@Override
public void setCurrentTenantId(String tenantId) {
currentTenantIdPlHolder.set(Long.valueOf(tenantId));
}
Also, make sure you take a look at the following blog post:
Multi-Tenancy with separate database schemas in Activiti | Small steps with big feet
Cheers,
greg
The class that implements TenantInfoHolder is registered when you create the configuration for MSMT.
It is a relatively simple interface and in general all it needs to do is correlate your current userid to the tenant id.
Alternatively, if the tenant_id will be included in the url you can use a filter to set/get a thread local variable:
protected static final ThreadLocal<Long> currentTenantIdPlaceHolder = new ThreadLocal<Long>();
...
...
@Override
public void setCurrentTenantId(String tenantId) {
currentTenantIdPlHolder.set(Long.valueOf(tenantId));
}
Also, make sure you take a look at the following blog post:
Multi-Tenancy with separate database schemas in Activiti | Small steps with big feet
Cheers,
greg
Thank you Greg,
I will try to hook in the BasicAuthenticationProvider class !
Stephane
Sounds like a good option. God luck.
Greg
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.