Skip to content

Commit

Permalink
Oppdatert statushåndtering
Browse files Browse the repository at this point in the history
  • Loading branch information
krharum committed Sep 19, 2023
1 parent 462fe2c commit bcc9224
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package no.nav.dolly.bestilling.pdldata;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.netty.channel.ChannelOption;
import lombok.extern.slf4j.Slf4j;
import no.nav.dolly.bestilling.ConsumerStatus;
import no.nav.dolly.bestilling.pdldata.command.PdlDataCheckIdentCommand;
Expand Down Expand Up @@ -57,7 +58,8 @@ public PdlDataConsumer(
.maxConnections(5)
.pendingAcquireMaxCount(500)
.pendingAcquireTimeout(Duration.ofMinutes(15))
.build())))
.build())
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10000)))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ private static String getStatus(List<SigrunstubResponse.OpprettelseTilbakemeldin
String.format("Feil: %s", ErrorStatusDecoder.encodeStatus(
tilbakemeldinger.stream()
.filter(SigrunstubResponse.OpprettelseTilbakemelding::isError)
.map(SigrunstubResponse.OpprettelseTilbakemelding::getMessage)
.distinct()
.map(status -> String.format("Inntektsår: ‰s, feilmelding: %s", status.getInntektsaar(), status.getMessage()))
.collect(Collectors.joining(", "))));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ public Mono<SigrunstubResponse> call() {
.header(UserConstant.USER_HEADER_JWT, getUserJwt())
.retrieve()
.bodyToMono(SigrunstubResponse.class)
.map(response -> {
for (int i = 0; i < response.getOpprettelseTilbakemeldingsListe().size(); i++) {
response.getOpprettelseTilbakemeldingsListe().get(i).setInntektsaar(
request.get(i).getInntektsaar());
}
return response;
})
.doOnError(WebClientFilter::logErrorMessage)
.onErrorResume(error -> Mono.just(SigrunstubResponse.builder()
.errorStatus(WebClientFilter.getStatus(error))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ public Mono<SigrunstubResponse> call() {
.bodyValue(request)
.retrieve()
.bodyToMono(SigrunstubResponse.class)
.map(response -> {
for (int i = 0; i < response.getOpprettelseTilbakemeldingsListe().size(); i++) {
response.getOpprettelseTilbakemeldingsListe().get(i).setInntektsaar(
request.get(i).getInntektsaar());
}
return response;
})
.doOnError(WebClientFilter::logErrorMessage)
.onErrorResume(error -> Mono.just(SigrunstubResponse.builder()
.errorStatus(WebClientFilter.getStatus(error))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ public List<OpprettelseTilbakemelding> getOpprettelseTilbakemeldingsListe() {
@AllArgsConstructor
public static class OpprettelseTilbakemelding {

private String message;
private String inntektsaar;
private String personident;
private Integer status;

private String message;

public boolean isOK() {
return nonNull(status) && status == 200;
}
Expand Down

0 comments on commit bcc9224

Please sign in to comment.