From 3f57d1a36476497ab4d0f7d12287621f2d7d7a39 Mon Sep 17 00:00:00 2001 From: Maximilian Wesener Date: Tue, 23 Jul 2024 17:25:34 +0200 Subject: [PATCH] chore(update): 1112 -added logging for discoveryfinder. --- .../FeignDiscoveryRepositoryImpl.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/discovery/infrastructure/repository/FeignDiscoveryRepositoryImpl.java b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/discovery/infrastructure/repository/FeignDiscoveryRepositoryImpl.java index 689572c879..c1dc427417 100644 --- a/tx-backend/src/main/java/org/eclipse/tractusx/traceability/discovery/infrastructure/repository/FeignDiscoveryRepositoryImpl.java +++ b/tx-backend/src/main/java/org/eclipse/tractusx/traceability/discovery/infrastructure/repository/FeignDiscoveryRepositoryImpl.java @@ -18,6 +18,8 @@ ********************************************************************************/ package org.eclipse.tractusx.traceability.discovery.infrastructure.repository; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.irs.registryclient.discovery.DiscoveryFinderClient; @@ -42,15 +44,28 @@ public class FeignDiscoveryRepositoryImpl implements DiscoveryRepository { private final EdcProperties edcProperties; private final DiscoveryFinderClient discoveryFinderClient; + private final ObjectMapper objectMapper; @Override public Optional retrieveDiscoveryByFinderAndEdcDiscoveryService(String bpn) { DiscoveryFinderRequest request = new DiscoveryFinderRequest(List.of(bpn)); DiscoveryResponse discoveryEndpoints = discoveryFinderClient.findDiscoveryEndpoints(request); + try { + objectMapper.writeValueAsString(discoveryEndpoints); + } catch (JsonProcessingException e) { + log.warn("Could not write value as string"); + } List discoveryResults = new ArrayList<>(); discoveryEndpoints.endpoints().forEach(discoveryEndpoint -> { String endPointAddress = discoveryEndpoint.endpointAddress(); - discoveryResults.addAll(discoveryFinderClient.findConnectorEndpoints(endPointAddress, List.of(bpn))); + log.info("endPointAddress {}", endPointAddress); + List connectorEndpoints = discoveryFinderClient.findConnectorEndpoints(endPointAddress, List.of(bpn)); + try { + objectMapper.writeValueAsString(connectorEndpoints); + } catch (JsonProcessingException e) { + log.warn("Could not write value as string"); + } + discoveryResults.addAll(connectorEndpoints); }); List discoveryResultByBPN = discoveryResults.stream().filter(edcDiscoveryResult -> edcDiscoveryResult.bpn().equals(bpn)).toList();