Closed
Description
Problem
I have two engines, and I want to create a job category for each engine. As I read the code, I noticed that the JobService only allows querying jobs by category and does not support querying by tenant ID. Therefore, I added a configuration:
config.addEnabledJobCategory(tenantId);
to SpringProcessEngineConfiguration
But it doesn't work. As I delved deeper into the code, I discovered that there were two instances of the JobUtil class being used to create new Job objects:
org.flowable.engine.impl.util.JobUtil
and
org.flowable.cmmn.engine.impl.util.JobUtil
And the way it creates a job is by utilizing the extension element named 'jobCategory' of the BPMN modell:
protected static JobEntity createJob(VariableContainer variableContainer, BaseElement baseElement, String jobHandlerType, CmmnEngineConfiguration cmmnEngineConfiguration) {
JobService jobService = cmmnEngineConfiguration.getJobServiceConfiguration().getJobService();
JobEntity job = jobService.createJob();
job.setJobHandlerType(jobHandlerType);
job.setScopeType(ScopeTypes.CMMN);
job.setElementId(baseElement.getId());
if (baseElement instanceof CaseElement) {
job.setElementName(((CaseElement) baseElement).getName());
}
List<ExtensionElement> jobCategoryElements = baseElement.getExtensionElements().get("jobCategory");
if (jobCategoryElements != null && jobCategoryElements.size() > 0) {
ExtensionElement jobCategoryElement = jobCategoryElements.get(0);
if (StringUtils.isNotEmpty(jobCategoryElement.getElementText())) {
Expression categoryExpression = cmmnEngineConfiguration.getExpressionManager().createExpression(jobCategoryElement.getElementText());
Object categoryValue = categoryExpression.getValue(variableContainer);
if (categoryValue != null) {
job.setCategory(categoryValue.toString());
}
}
}
job.setTenantId(variableContainer.getTenantId());
return job;
}
I have to add the following XML snippet in every BPMN node:
<flowable:jobCategory>myJobCategory</flowable:jobCategory>
My question is, is there any way to configure the engine to create jobs with a single category using a global configuration?
Metadata
Metadata
Assignees
Labels
No labels