From 8086af73a1a566e67277c7b5da4f35346db3bea7 Mon Sep 17 00:00:00 2001 From: Punit Darira Date: Mon, 13 May 2024 17:58:26 -0400 Subject: [PATCH] feat(engine): Populating process instance id in jobs related to #4205 --- .../bpm/engine/impl/batch/AbstractBatchJobHandler.java | 5 +++++ .../batch/message/MessageCorrelationBatchJobHandler.java | 5 +---- .../impl/batch/variables/BatchSetVariablesHandler.java | 5 +---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/engine/src/main/java/org/camunda/bpm/engine/impl/batch/AbstractBatchJobHandler.java b/engine/src/main/java/org/camunda/bpm/engine/impl/batch/AbstractBatchJobHandler.java index 1272ca59427..02381914c3b 100644 --- a/engine/src/main/java/org/camunda/bpm/engine/impl/batch/AbstractBatchJobHandler.java +++ b/engine/src/main/java/org/camunda/bpm/engine/impl/batch/AbstractBatchJobHandler.java @@ -169,6 +169,11 @@ protected void createJobEntities(BatchEntity batch, T configuration, String depl ByteArrayEntity configurationEntity = saveConfiguration(byteArrayManager, jobConfiguration); JobEntity job = createBatchJob(batch, configurationEntity); + + if (jobConfiguration.getIds() != null && jobConfiguration.getIds().size() == 1) { + job.setProcessInstanceId(jobConfiguration.getIds().get(0)); + } + job.setDeploymentId(deploymentId); postProcessJob(configuration, job, jobConfiguration); jobManager.insertAndHintJobExecutor(job); diff --git a/engine/src/main/java/org/camunda/bpm/engine/impl/batch/message/MessageCorrelationBatchJobHandler.java b/engine/src/main/java/org/camunda/bpm/engine/impl/batch/message/MessageCorrelationBatchJobHandler.java index 32491d830b4..83511fcc23d 100644 --- a/engine/src/main/java/org/camunda/bpm/engine/impl/batch/message/MessageCorrelationBatchJobHandler.java +++ b/engine/src/main/java/org/camunda/bpm/engine/impl/batch/message/MessageCorrelationBatchJobHandler.java @@ -66,10 +66,7 @@ protected MessageCorrelationBatchConfiguration createJobConfiguration(MessageCor @Override protected void postProcessJob(MessageCorrelationBatchConfiguration configuration, JobEntity job, MessageCorrelationBatchConfiguration jobConfiguration) { - // if there is only one process instance to adjust, set its ID to the job so exclusive scheduling is possible - if (jobConfiguration.getIds() != null && jobConfiguration.getIds().size() == 1) { - job.setProcessInstanceId(jobConfiguration.getIds().get(0)); - } + } @Override diff --git a/engine/src/main/java/org/camunda/bpm/engine/impl/batch/variables/BatchSetVariablesHandler.java b/engine/src/main/java/org/camunda/bpm/engine/impl/batch/variables/BatchSetVariablesHandler.java index e7e5fb85a58..193978d981e 100644 --- a/engine/src/main/java/org/camunda/bpm/engine/impl/batch/variables/BatchSetVariablesHandler.java +++ b/engine/src/main/java/org/camunda/bpm/engine/impl/batch/variables/BatchSetVariablesHandler.java @@ -78,10 +78,7 @@ public String getType() { @Override protected void postProcessJob(BatchConfiguration configuration, JobEntity job, BatchConfiguration jobConfiguration) { - // if there is only one process instance to adjust, set its ID to the job so exclusive scheduling is possible - if (jobConfiguration.getIds() != null && jobConfiguration.getIds().size() == 1) { - job.setProcessInstanceId(jobConfiguration.getIds().get(0)); - } + } protected ByteArrayEntity findByteArrayById(String byteArrayId, CommandContext commandContext) {