diff --git a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/RetryPolicy.java b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/RetryPolicy.java index d6515fce8f99431060a0428b290b0e8ea738a7d9..9fcf09a89be684fb1f6adeed93965327f53827cf 100644 --- a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/RetryPolicy.java +++ b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/RetryPolicy.java @@ -20,12 +20,11 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import io.github.resilience4j.retry.RetryConfig; import lombok.Data; -import lombok.extern.java.Log; +import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; import org.opengroup.osdu.core.common.model.http.HttpResponse; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; -import org.springframework.stereotype.Service; import java.time.Duration; @@ -33,12 +32,15 @@ import java.time.Duration; * This class handles retry configuration logic for calls made to <prefix>/storage/v2/query/records:batch * to resolve intermittent CosmosDb Not found issue */ -@Log + @Component @Data -@ConfigurationProperties(prefix = "azure.urlfetchservice.retry") +@ConfigurationProperties(prefix = "azure.storage.client.retry") public class RetryPolicy { + @Autowired + private JaxRsDpsLog logger; + private int attempts = 3; private int waitDuration = 1000; private final String RECORD_NOT_FOUND = "notFound"; @@ -71,7 +73,7 @@ public class RetryPolicy { notFoundElement.getAsJsonArray().isJsonNull()) { return false; } - log.info("Retry is set true"); + logger.info("Retry is set true"); return true; } } diff --git a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/UrlFetchServiceAzureImpl.java b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/UrlFetchServiceAzureImpl.java index 1e0453120b916fe3962b8a6cded62304bc59b53e..d56b888fafaf747bd51f97658e7bfd255a0f31e9 100644 --- a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/UrlFetchServiceAzureImpl.java +++ b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/UrlFetchServiceAzureImpl.java @@ -17,10 +17,10 @@ package org.opengroup.osdu.indexer.azure.service; import io.github.resilience4j.retry.Retry; import io.github.resilience4j.retry.RetryConfig; import io.github.resilience4j.retry.RetryRegistry; -import lombok.extern.java.Log; import org.opengroup.osdu.core.common.http.FetchServiceHttpRequest; import org.opengroup.osdu.core.common.http.IUrlFetchService; import org.opengroup.osdu.core.common.http.UrlFetchServiceImpl; +import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; import org.opengroup.osdu.core.common.model.http.HttpResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Primary; @@ -34,7 +34,7 @@ import java.util.function.Supplier; * This class has same function as that of UrlFetchService except in the case of * <prefix>/storage/v2/query/records:batch call for which it enables retry */ -@Log + @Service @RequestScope @Primary @@ -48,6 +48,8 @@ public class UrlFetchServiceAzureImpl implements IUrlFetchService { @Autowired private UrlFetchServiceImpl urlFetchService; + @Autowired + private JaxRsDpsLog logger; /** * this method invokes retryFunction only for <prefix>/storage/v2/query/records:batch * calls otherwise invokes UrlFetchService.sendRequest(FetchServiceHttpRequest request) @@ -84,7 +86,7 @@ public class UrlFetchServiceAzureImpl implements IUrlFetchService { try { return this.urlFetchService.sendRequest(request); } catch (URISyntaxException e) { - log.info("HttpResponse is null due to URISyntaxException. " + e.getReason()); + logger.error("HttpResponse is null due to URISyntaxException. " + e.getReason()); return null; } };