TenantAwareDataSource - how it updated the current tenant Id

I see this code in TenantAwareDataSource class

 protected DataSource getCurrentDataSource() {
    String tenantId = tenantInfoHolder.getCurrentTenantId();
    DataSource dataSource = dataSources.get(tenantId);
    if (dataSource == null) {
        throw new FlowableException("Could not find a dataSource for tenant " + tenantId);
    }
    return dataSource;
}

I am using MultiSchemaMultiTenantProcessEngineConfiguration engine configuration. I can see the tenantInfoHolder is has all my tenants.

But wen I execute my process, I get the “tenantId” as null. I try to debut the code and could not get how its setting the value.

Please help.

Any idea on this. I am stuck due to this.

See org.flowable.common.engine.api.FlowableException: Could not find a dataSource for tenant null

1 Like