Skip to content

Commit

Permalink
Add logging for KodeverkConsumer responses and remove KODEVERK caches
Browse files Browse the repository at this point in the history
#deploy-test-dolly-backend #deploy-test-dolly-frontend

Added a log.info() line in KodeverkConsumer to log the responses it receives when getting the "kodeverk". Additionally, unnecessary CACHE_KODEVERK and CACHE_KODEVERK_2 constant were removed from CachingConfig, along with their associated initialization in the CaffeineCacheManager, resulting in a streamlined cache configuration and reduced overhead.
  • Loading branch information
krharum committed Apr 4, 2024
1 parent 31cfed8 commit 265e5a6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public Mono<Map<String, String>> getKodeverkByName(String kodeverk) {

return tokenService.exchange(serverProperties)
.flatMap(token -> new KodeverkGetCommand(webClient, kodeverk, token.getTokenValue()).call())
.doOnNext(response -> log.info("Hentet kodeverk {}", response.getKodeverknavn()))
.doOnNext(response -> log.info("Hentet kodeverk {}, status {} melding {}",
response.getKodeverknavn(), response.getStatus(), response.getMessage()))
.map(KodeverkDTO::getKodeverk);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public Mono<KodeverkDTO> call() {
.bodyToMono(KodeverkDTO.class)
.doOnError(WebClientFilter::logErrorMessage)
.onErrorResume(error -> Mono.just(KodeverkDTO.builder()
.kodeverknavn(kodeverk)
.status(WebClientFilter.getStatus(error))
.message(WebClientFilter.getMessage(error))
.build()))
.retryWhen(Retry.backoff(3, Duration.ofSeconds(5))
.filter(WebClientFilter::is5xxException));
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.http.HttpStatus;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -19,6 +20,9 @@ public class KodeverkDTO {
private String kodeverknavn;
private Map<String, String> kodeverk;

private HttpStatus status;
private String message;

public Map<String, String> getKodeverk() {

if (isNull(kodeverk)) {
Expand Down

0 comments on commit 265e5a6

Please sign in to comment.