Using Camunda 7.
We have distinct sets of processes that must be assigned to different tenants. While certain elements have a tenant ID field (e.g. call activity), this is not consistent, and there is no option to assign a tenant ID to an entire diagram. Besides creating extension properties, is there an easy way to associate entire processes with a tenant id?
Hi @AlAnt ,
usually declaring tenant ids for sub process activies / called activities will not be necessary as per default it will use the parent executions tenant id (see Called Element TenantId).
Regarding processes you have to differentiate following two cases:
- If you want to deployment processes for specific tenants only, you have this option using a deployment builder (see DeploymentBuilder.java at line 257))
- If you want to deploy processes globally and start them for specfic tenants you can do this via a process instantion builder (see ProcessInstantiationBuilder.java at line 35).
The description is quite fuzzy, so that it’s hardly possible to give a good advice. But this page might help: Multi-Tenancy | docs.camunda.org
The question was around whether there is an easy way to assign processes to a tenant when configuring the whole process. There is a tenant id associated with elements of a process (e.g. a call activity), but none associated with the process itself.
So, we can choose a tenant when deploying or instantiating a process, but not when configuring a process, correct?
Hi @AlAnt ,
yes, as far as I know, it is not possible to define the tenant id of the process itself within the process model. Someone else might prove me wrong, tho.
You mentioned extension properties as an option beforehand. You could add a variable containing the wanted tenant id there and read it from the process model before deploying or instantiating.
For setting tenants on process instantiation there is also the TenantIdProvider interface for which you can configure an implementation for your process engine.
there is no dedicated field in the modeler to provide a tenantId during modeling. But you can use for example the extension properties on the process level to provide your own field for it.
To access extension elements during deployment, you can use the BPMN Model API like here: camunda-bpm-examples/ParseBpmnTest.java at master · camunda/camunda-bpm-examples · GitHub
Hope this helps, Ingo