Hi there,
I have process definition that includes timer event. When timer elapse, flow is executing a tasks that executes java code.
Definition of that task includes:
Script Format: groovy
Script: MyClass.MyMethod(execution.getVariable("MY_VARIABLE"))
I am using Single "Engine - Shared Database" multi-tenancy functionality of acitiviti engine, and activity is running as part of java spring web application.
Following is how I build the activity deployment when application is started:
DeploymentBuilder deploymentBuilder =
repositoryService
.createDeployment()
.enableDuplicateFiltering()
.tenantId(currentTenantResolver.getCurrentTenantId())
.name(resource.getFilename());
Following is dependency definition in the pom file
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring</artifactId>
<version>6.0.0</version>
</dependency>
Following is the definition for the process definition
ProcessDefinition processDefinition =
repositoryService
.createProcessDefinitionQuery()
.processDefinitionKey(SIGNUP_PROCESS_KEY)
.processDefinitionTenantId(currentTenantResolver.getCurrentTenantId())
.latestVersion()
.singleResult();
My issue is that there are situations when engine is executing MyClass.MyMethod() for tenant different than the tenant that was used when activity was initiated and process definition was created.
I can see in the database that tenant_id is correctly set for the timer job record, as well as in all other connected records.
Can someone share more info about this. Is this expected behavior or some bug, or there is some wrong usage in my code.
Thanks