diff --git a/irs-api/src/main/java/org/eclipse/tractusx/irs/ess/service/EssRecursiveNotificationHandler.java b/irs-api/src/main/java/org/eclipse/tractusx/irs/ess/service/EssRecursiveNotificationHandler.java index 8b4cce1d6e..041899d752 100644 --- a/irs-api/src/main/java/org/eclipse/tractusx/irs/ess/service/EssRecursiveNotificationHandler.java +++ b/irs-api/src/main/java/org/eclipse/tractusx/irs/ess/service/EssRecursiveNotificationHandler.java @@ -48,7 +48,8 @@ public class EssRecursiveNotificationHandler { private final BpnInvestigationJobCache bpnInvestigationJobCache; private final EdcNotificationSender edcNotificationSender; - /* package */ void handleNotification(final UUID finishedJobId, final SupplyChainImpacted supplyChainImpacted, final String bpn) { + /* package */ void handleNotification(final UUID finishedJobId, final SupplyChainImpacted supplyChainImpacted, final String bpn, + final Integer hops) { final Optional relatedJobsId = relatedInvestigationJobsCache.findByRecursiveRelatedJobId( finishedJobId); @@ -56,20 +57,20 @@ public class EssRecursiveNotificationHandler { relatedJobsId.ifPresentOrElse(relatedJobs -> { if (SupplyChainImpacted.YES.equals(supplyChainImpacted)) { log.debug("SupplyChain is impacted. Sending notification back to requestor."); - edcNotificationSender.sendEdcNotification(relatedJobs.originalNotification(), supplyChainImpacted, FIRST_HOP, bpn); + edcNotificationSender.sendEdcNotification(relatedJobs.originalNotification(), supplyChainImpacted, hops, bpn); relatedInvestigationJobsCache.remove( relatedJobs.originalNotification().getHeader().getNotificationId()); } else { log.debug( "SupplyChainImpacted in state '{}'. Waiting for Jobs to complete to send notification back to requestor.", supplyChainImpacted); - sendNotificationAfterAllCompleted(relatedJobs, bpn); + sendNotificationAfterAllCompleted(relatedJobs, bpn, hops); } }, () -> log.debug("No RelatedInvestigationJob found for id '{}'.", finishedJobId)); } private void sendNotificationAfterAllCompleted(final RelatedInvestigationJobs relatedInvestigationJobs, - final String bpn) { + final String bpn, final Integer hops) { final List allInvestigationJobs = relatedInvestigationJobs.recursiveRelatedJobIds() .stream() .map(bpnInvestigationJobCache::findByJobId) @@ -82,7 +83,7 @@ private void sendNotificationAfterAllCompleted(final RelatedInvestigationJobs re .reduce(SupplyChainImpacted.NO, SupplyChainImpacted::or); - edcNotificationSender.sendEdcNotification(relatedInvestigationJobs.originalNotification(), finalResult, getMinHops(allInvestigationJobs), bpn); + edcNotificationSender.sendEdcNotification(relatedInvestigationJobs.originalNotification(), finalResult, hops, bpn); } } diff --git a/irs-api/src/main/java/org/eclipse/tractusx/irs/ess/service/EssService.java b/irs-api/src/main/java/org/eclipse/tractusx/irs/ess/service/EssService.java index 934c16efc0..5a71931b08 100644 --- a/irs-api/src/main/java/org/eclipse/tractusx/irs/ess/service/EssService.java +++ b/irs-api/src/main/java/org/eclipse/tractusx/irs/ess/service/EssService.java @@ -129,7 +129,7 @@ public void handleNotificationCallback(final EdcNotification