Hello,
I am researching on a multitenant setup with tomcat managed StandAloneProcessEngine, where:
-
there will be a set of shared process definitions (i.e without tenant)
-
process instances are mostly started via signals, and it would be quite normal for many process definitions to have the same signal start events.
-
when sending a signal, there always is the “tenantId” variable specifying which tenant does the signaling
-
tenants start processes, which will have their tenant Id set to the instance, from the variables passed (this one I managed to do with a custom plugin)
-
(now, what causes my problem) - A tenant, may or may not customize a particular process definition Customize action is actually deploying the same process, but with a tenantId
In the case of a tenant customizing a process, I want to trigger only the customized definition, and not the shared one, when a signal got sent from that tenant
Example scenario: 2 shared process definitions
- SharedProcess1, having start signal A
- SharedProcess2, having start signal A
-
whoever tenant sending a signal A, will trigger both processes, setting corresponding tenantId on them - scenario is OK
-
Lets say, tenant1 customizes SharedProcess1, after this, in camunda we have 3 process definitions in total:
- SharedProcess1, having start signal A
- SharedProcess2, having start signal A
- CustomizedProcess1, having signal A, having tenantId=tenant1
Now, if tenant1 sends signal A I want only those two processes to trigger:
- SharedProcess2, having start signal A
- CustomizedProcess1, having signal A, having tenantId=tenant1
SharedProcess1, having start signal A(does not get triggered because something indicated that there is customization)
However, if tenantX, which did not customize any processes, sends the same signal A, I want to trigger the original shared processes only.
I was thinking of modifying the Customize process, and appending the tenantId, to each signalId within that process (making it tenantId#signalId), then, when someone sends a signal, the backend will actually send two signals:
a) the requested: signalId
b) another, tenant specific: tenantId#signalId
My problem is, in the described scenario above, both the shared and the customized process definitions will get executed, because of a)
Now I am thinking I need to (somehow :)) intercept the starting process, do a custom query againts camunda db, and:
- for a shared processes that is about to start, check whether there exists the same process but with a tenantId (tenantId always we have set in variables)
- if customized version exists - skip the execution, if not proceed with shared execution
However, I am not sure if that is at all possible. Is there a way to do that?
Thank you !
Krasimir