SpringBootAutoDeployment of common resources with Multi-Schema Multi-Tenant

Hello,

We have a Multi-Schema Multi-Tenant flowable application running in spring boot that has both a BPMN Process engine and an Event Registry engine configured. I’d like to deploy some common resources that all tenants will share including callable sub-process definitions, event registry channel definitions, and event registry event definitions.

When I put these common resources on the spring boot classpath, a new deployment is created and stored in the database with the name “SpringBootAutoDeployment”. Unfortunately, this is only stored in one of the tenant schemas, namely, the one I have aliased to the tenant ID “default”. All the other tenants are unaware of these common resources. For instance, when I execute

POST /process-api/runtime/process-instances

on one of the other tenants, I receive a 400 error:

<ErrorInfo>
    <message>Bad request</message>
    <exception>No process definition found for key 'mySharedProcess'</exception>
</ErrorInfo>

When I look at the release notes for 6.4.1 (I’m using 6.8.0), it mentions:

Multi tenancy improvements to support lookups for process, case, form, and decision table definitions within the tenant, but also allow for a fallback lookup in a default tenant of choice

Also, there’s mention of a default tenant with fallback lookups in the Enterprise documentation:

The default tenant is handled specially:

  • Definitions deployed to this tenant are considered shared by all tenants. This means that if you have, for example, a process definition with key abc and start a process instance by key:
    • a lookup is first done in the current tenant of the user starting the process instance. If found, that process definition is used (this means that it is always possible to override in a tenant specific way the shared definition).
    • if the previous lookup returns no results, a lookup in the default tenant is done.

Is this fallback behavior supported in the open source version, or is this an enterprise feature? I tried configuring the properties described in the above documentation (eg: flowable.platform.multi-tenant.auto-deploy-tenants), but spring boot didn’t seem to recognize the property as being available in the context’s configuration properties.

It looks like the “default” tenant fallback is supported in the open source product, but only if the “default” resources are found in the schema used by the tenant. In a shared schema environment, I think everything would have worked as described in the release notes and documentation.

My problem is that the out of the box auto deployment only deployed the “default” resources to one of the schemata in my multi-schema environment. The way I got around this was to configure my process engine and event registry engine with overrides for the following classes:

  • org.flowable.spring.configurator.DefaultAutoDeploymentStrategy
  • org.flowable.eventregistry.spring.autodeployment.DefaultAutoDeploymentStrategy

In the deployResourcesInternal() method of each of these strategies, I used the TenantInfoHolder to iterate through the tenants, and deploy a “default” deployment to each

Changed:

deploy(deploymentBuilder);

To:

final String origTenantId = tenantInfoHolder.getCurrentTenantId();
for (final String currentTenantId : tenantInfoHolder.getAllTenants()) {
    tenantInfoHolder.setCurrentTenantId(currentTenantId);
    deploy(deploymentBuilder);
}
tenantInfoHolder.setCurrentTenantId(origTenantId);