diff --git a/engine/src/main/java/io/camunda/zeebe/engine/processing/deployment/transform/DmnResourceTransformer.java b/engine/src/main/java/io/camunda/zeebe/engine/processing/deployment/transform/DmnResourceTransformer.java index de398910c321..ece8672622c8 100644 --- a/engine/src/main/java/io/camunda/zeebe/engine/processing/deployment/transform/DmnResourceTransformer.java +++ b/engine/src/main/java/io/camunda/zeebe/engine/processing/deployment/transform/DmnResourceTransformer.java @@ -235,8 +235,12 @@ private boolean isDuplicate( } private void writeRecords(final DeploymentRecord deployment, final DeploymentResource resource) { + final var metadataRecords = + deployment.decisionRequirementsMetadata().stream() + .filter(metadata -> metadata.getResourceName().equals(resource.getResourceName())) + .collect(Collectors.toList()); - for (final DecisionRequirementsMetadataRecord drg : deployment.decisionRequirementsMetadata()) { + for (final DecisionRequirementsMetadataRecord drg : metadataRecords) { if (!drg.isDuplicate()) { stateWriter.appendFollowUpEvent( drg.getDecisionRequirementsKey(), @@ -253,8 +257,14 @@ private void writeRecords(final DeploymentRecord deployment, final DeploymentRes } } + final var decisionRequirementKeys = + metadataRecords.stream() + .map(DecisionRequirementsMetadataRecord::getDecisionRequirementsKey) + .collect(Collectors.toList()); + for (final DecisionRecord decision : deployment.decisionsMetadata()) { - if (!decision.isDuplicate()) { + if (!decision.isDuplicate() + && decisionRequirementKeys.contains(decision.getDecisionRequirementsKey())) { stateWriter.appendFollowUpEvent( decision.getDecisionKey(), DecisionIntent.CREATED,