From f6bea6ce84323c11a947cc8a52b3ede0637282e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristen=20H=C3=A6rum?= Date: Fri, 17 Nov 2023 13:33:14 +0100 Subject: [PATCH] Bugfix/bestillinger som henger (#3336) WebClientConfig og WebClientFilter oppdatert og refaktorering --- .../dolly/DollyBackendApplicationStarter.java | 2 +- .../dolly/bestilling/aareg/AaregConsumer.java | 11 ----- .../aareg/command/AmeldingPutCommand.java | 2 +- .../command/ArbeidsforholdGetCommand.java | 2 +- .../command/ArbeidsforholdPostCommand.java | 2 +- .../command/ArbeidsforholdPutCommand.java | 2 +- .../aareg/command/OrganisasjonGetCommand.java | 2 +- .../ArbeidsplassenDeleteCVCommand.java | 2 +- .../ArbeidsplassenGodtaHjemmelCommand.java | 2 +- .../ArbeidsplassenGodtaVilkaarCommand.java | 2 +- .../ArbeidsplassenPostPersonCommand.java | 2 +- .../command/ArbeidsplassenPutCVCommand.java | 2 +- .../command/ArenaForvalterDeleteCommand.java | 2 +- .../ArenaForvalterGetMiljoeCommand.java | 2 +- .../command/ArenaGetCommand.java | 2 +- .../command/ArenaforvalterPostAap.java | 2 +- .../command/ArenaforvalterPostAap115.java | 2 +- .../ArenaforvalterPostArenaBruker.java | 2 +- .../ArenaforvalterPostArenadagpenger.java | 2 +- .../brregstub/command/BrregDeleteCommand.java | 2 +- .../brregstub/command/BrregGetCommand.java | 2 +- .../brregstub/command/BrregPostCommand.java | 2 +- .../command/DokarkivGetMiljoeCommand.java | 2 +- .../dokarkiv/command/DokarkivPostCommand.java | 2 +- .../histark/command/HistarkPostCommand.java | 2 +- .../OpprettInntektsmeldingCommand.java | 2 +- .../command/InntektstubDeleteCommand.java | 2 +- .../command/InntektstubGetCommand.java | 2 +- .../command/InntektstubPostCommand.java | 2 +- .../command/InstdataDeleteCommand.java | 2 +- .../instdata/command/InstdataGetCommand.java | 2 +- .../command/InstdataGetMiljoerCommand.java | 2 +- .../instdata/command/InstdataPostCommand.java | 2 +- .../KontoregisterConsumer.java | 13 +---- .../command/KontoregisterDeleteCommand.java | 2 +- .../command/KontoregisterGetCommand.java | 2 +- .../command/KontoregisterPostCommand.java | 4 +- .../command/GetKontaktdataCommand.java | 2 +- .../command/KontaktadataDeleteCommand.java | 2 +- .../command/KontaktdataPostCommand.java | 2 +- .../medl/command/MedlGetCommand.java | 2 +- .../medl/command/MedlPostCommand.java | 2 +- .../medl/command/MedlPutCommand.java | 2 +- .../OrganisasjonConsumer.java | 2 +- .../command/GetOrganisasjonCommand.java | 2 +- .../bestilling/pdldata/PdlDataConsumer.java | 11 ----- .../command/PdlDataCheckIdentCommand.java | 2 +- .../pdldata/command/PdlDataHentCommand.java | 2 +- .../command/PdlDataIdenterCommand.java | 2 +- .../command/PdlDataOppdateringCommand.java | 2 +- .../command/PdlDataOpprettingCommand.java | 2 +- .../pdldata/command/PdlDataOrdreCommand.java | 2 +- .../pdldata/command/PdlDataSlettCommand.java | 2 +- .../command/PdlDataSlettUtenomCommand.java | 2 +- .../command/PdlDataStanaloneCommand.java | 2 +- .../PensjonforvalterConsumer.java | 12 ----- .../command/AnnullerSamboerCommand.java | 8 +-- .../command/HentMiljoerCommand.java | 2 +- .../command/HentPoppInntekterCommand.java | 2 +- .../command/HentSamboerCommand.java | 6 +-- .../command/LagreAlderspensjonCommand.java | 6 ++- .../command/LagrePoppInntektCommand.java | 6 ++- .../command/LagreSamboerCommand.java | 8 +-- .../command/LagreTpForholdCommand.java | 6 ++- .../command/LagreTpYtelseCommand.java | 6 ++- .../command/LagreUforetrygdCommand.java | 6 ++- .../command/OpprettPersonCommand.java | 2 +- .../command/SletteTpForholdCommand.java | 2 +- .../personservice/PersonServiceConsumer.java | 11 ----- .../command/PdlPersonerGetCommand.java | 2 +- .../service/DollyBestillingService.java | 11 ++++- .../service/GjenopprettBestillingService.java | 9 ++-- .../service/GjenopprettGruppeService.java | 13 +++-- .../service/GjenopprettIdentService.java | 9 ++-- .../ImportAvPersonerFraPdlService.java | 5 +- .../service/LeggTilPaaGruppeService.java | 9 ++-- .../service/OppdaterPersonService.java | 5 +- .../OpprettPersonerByKriterierService.java | 5 +- ...PersonerFraIdenterMedKriterierService.java | 5 +- .../SigrunstubLignetDeleteCommand.java | 2 +- ...igrunstubPensjonsgivendeDeleteCommand.java | 2 +- .../command/SigurunstubPutCommand.java | 2 +- .../SkjermingsregisterDeleteCommand.java | 2 +- .../command/SkjermingsregisterGetCommand.java | 2 +- .../SkjermingsregisterPostCommand.java | 2 +- .../command/SkjermingsregisterPutCommand.java | 2 +- .../sykemelding/SyntSykemeldingConsumer.java | 3 +- .../sykemelding/command/Norg2GetCommand.java | 2 +- .../command/SykemeldingPostCommand.java | 2 +- .../command/SyntSykemeldingPostCommand.java | 2 +- .../command/HendelseslagerPublishCommand.java | 2 +- .../command/TagsHenteCommand.java | 2 +- .../command/TagsOpprettingCommand.java | 2 +- .../command/TagsSlettingCommand.java | 2 +- .../TpsMessagingConsumer.java | 12 ----- .../command/EgenansattDeleteCommand.java | 2 +- .../command/EgenansattPostCommand.java | 2 +- .../command/MiljoerGetCommand.java | 2 +- .../command/PersonGetCommand.java | 2 +- .../SikkerhetstiltakDeleteCommand.java | 2 +- .../command/TelefonnummerDeleteCommand.java | 2 +- .../command/TpsMessagingPostCommand.java | 2 +- .../udistub/command/UdistubDeleteCommand.java | 2 +- .../udistub/command/UdistubGetCommand.java | 2 +- .../udistub/command/UdistubPostCommand.java | 2 +- .../udistub/command/UdistubPutCommand.java | 2 +- .../consumer/kodeverk/KodeverkConsumer.java | 2 +- .../consumer/command/ElasticPutCommand.java | 2 +- .../no/nav/dolly/util/WebClientFilter.java | 49 ------------------- .../command/ElasticSearchCommand.java | 10 +--- .../reactivecore/config/WebClientConfig.java | 11 +++-- .../reactivecore/utils/WebClientFilter.java | 45 ++++++++++++----- 112 files changed, 202 insertions(+), 279 deletions(-) delete mode 100644 apps/dolly-backend/src/main/java/no/nav/dolly/util/WebClientFilter.java diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/DollyBackendApplicationStarter.java b/apps/dolly-backend/src/main/java/no/nav/dolly/DollyBackendApplicationStarter.java index d0743b7b81b..d023e7e2dfd 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/DollyBackendApplicationStarter.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/DollyBackendApplicationStarter.java @@ -10,4 +10,4 @@ public static void main(String[] args) { SpringApplication.run(DollyBackendApplicationStarter.class, args); } -} +} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/AaregConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/AaregConsumer.java index f2e6b1f811a..c0fbd09dbf3 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/AaregConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/AaregConsumer.java @@ -13,15 +13,10 @@ import no.nav.testnav.libs.securitycore.domain.AccessToken; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; -import org.springframework.http.client.reactive.ReactorClientHttpConnector; import org.springframework.stereotype.Component; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.netty.http.client.HttpClient; -import reactor.netty.resources.ConnectionProvider; - -import java.time.Duration; import static no.nav.dolly.util.JacksonExchangeStrategyUtil.getJacksonStrategy; @@ -44,12 +39,6 @@ public AaregConsumer( this.webClient = webClientBuilder .exchangeStrategies(getJacksonStrategy(objectMapper)) .baseUrl(serverProperties.getUrl()) - .clientConnector(new ReactorClientHttpConnector( - HttpClient.create(ConnectionProvider.builder("custom") - .maxConnections(5) - .pendingAcquireMaxCount(500) - .pendingAcquireTimeout(Duration.ofMinutes(15)) - .build()))) .build(); } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/AmeldingPutCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/AmeldingPutCommand.java index af6aabb5383..2e1f0b015d1 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/AmeldingPutCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/AmeldingPutCommand.java @@ -2,8 +2,8 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.util.TokenXUtil; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.dto.ameldingservice.v1.AMeldingDTO; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/ArbeidsforholdGetCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/ArbeidsforholdGetCommand.java index 23133cb949d..06c0ccfcfee 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/ArbeidsforholdGetCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/ArbeidsforholdGetCommand.java @@ -3,8 +3,8 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.aareg.domain.ArbeidsforholdRespons; import no.nav.dolly.util.CallIdUtil; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.dto.aareg.v1.Arbeidsforhold; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/ArbeidsforholdPostCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/ArbeidsforholdPostCommand.java index 5c96ca42d58..203114b8259 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/ArbeidsforholdPostCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/ArbeidsforholdPostCommand.java @@ -3,8 +3,8 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.aareg.domain.ArbeidsforholdRespons; import no.nav.dolly.util.CallIdUtil; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.dto.aareg.v1.Arbeidsforhold; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.BodyInserters; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/ArbeidsforholdPutCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/ArbeidsforholdPutCommand.java index 243d22b502e..74981e22369 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/ArbeidsforholdPutCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/ArbeidsforholdPutCommand.java @@ -3,8 +3,8 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.aareg.domain.ArbeidsforholdRespons; import no.nav.dolly.util.CallIdUtil; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.dto.aareg.v1.Arbeidsforhold; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.BodyInserters; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/OrganisasjonGetCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/OrganisasjonGetCommand.java index 8ce68f07050..92aa973d1eb 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/OrganisasjonGetCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/aareg/command/OrganisasjonGetCommand.java @@ -1,8 +1,8 @@ package no.nav.dolly.bestilling.aareg.command; import lombok.RequiredArgsConstructor; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.dto.organisasjon.v1.OrganisasjonDTO; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenDeleteCVCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenDeleteCVCommand.java index c84de6f2f1f..9422b18a3dd 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenDeleteCVCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenDeleteCVCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.arbeidsplassencv.dto.ArbeidsplassenCVStatusDTO; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenGodtaHjemmelCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenGodtaHjemmelCommand.java index 59a6305ed2b..0a2d7189923 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenGodtaHjemmelCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenGodtaHjemmelCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.arbeidsplassencv.dto.ArbeidsplassenCVStatusDTO; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenGodtaVilkaarCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenGodtaVilkaarCommand.java index fb9a65ab042..28d464bc740 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenGodtaVilkaarCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenGodtaVilkaarCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.arbeidsplassencv.dto.ArbeidsplassenCVStatusDTO; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenPostPersonCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenPostPersonCommand.java index 50c620ea167..1c098079138 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenPostPersonCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenPostPersonCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.arbeidsplassencv.dto.ArbeidsplassenCVStatusDTO; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenPutCVCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenPutCVCommand.java index 0af93eb0e5b..3d91ee3f2ee 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenPutCVCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arbeidsplassencv/command/ArbeidsplassenPutCVCommand.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.arbeidsplassencv.dto.ArbeidsplassenCVStatusDTO; import no.nav.dolly.bestilling.arbeidsplassencv.dto.PAMCVDTO; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaForvalterDeleteCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaForvalterDeleteCommand.java index d6c46ac26f0..5ee01f91822 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaForvalterDeleteCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaForvalterDeleteCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.arenaforvalter.dto.InaktiverResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaForvalterGetMiljoeCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaForvalterGetMiljoeCommand.java index e1f66bb5012..b83324d79b2 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaForvalterGetMiljoeCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaForvalterGetMiljoeCommand.java @@ -1,7 +1,7 @@ package no.nav.dolly.bestilling.arenaforvalter.command; import lombok.RequiredArgsConstructor; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaGetCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaGetCommand.java index c59702d4757..d023ba4d5d8 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaGetCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaGetCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.arenaforvalter.dto.ArenaStatusResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaforvalterPostAap.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaforvalterPostAap.java index 4388f4cb0b6..05867aed690 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaforvalterPostAap.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaforvalterPostAap.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.arenaforvalter.dto.AapRequest; import no.nav.dolly.bestilling.arenaforvalter.dto.AapResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaforvalterPostAap115.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaforvalterPostAap115.java index 9c5fcf40f6d..3af8faef7d3 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaforvalterPostAap115.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaforvalterPostAap115.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.arenaforvalter.dto.Aap115Request; import no.nav.dolly.bestilling.arenaforvalter.dto.Aap115Response; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaforvalterPostArenaBruker.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaforvalterPostArenaBruker.java index 3424c008650..a988fda21f7 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaforvalterPostArenaBruker.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaforvalterPostArenaBruker.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.domain.resultset.arenaforvalter.ArenaNyeBrukere; import no.nav.dolly.domain.resultset.arenaforvalter.ArenaNyeBrukereResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaforvalterPostArenadagpenger.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaforvalterPostArenadagpenger.java index 290569093dc..04d5379d0d4 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaforvalterPostArenadagpenger.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/arenaforvalter/command/ArenaforvalterPostArenadagpenger.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.domain.resultset.arenaforvalter.ArenaDagpenger; import no.nav.dolly.domain.resultset.arenaforvalter.ArenaNyeDagpengerResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/brregstub/command/BrregDeleteCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/brregstub/command/BrregDeleteCommand.java index 7c2abe799ad..16efca23645 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/brregstub/command/BrregDeleteCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/brregstub/command/BrregDeleteCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/brregstub/command/BrregGetCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/brregstub/command/BrregGetCommand.java index 51d998f5f4d..ea79a4452be 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/brregstub/command/BrregGetCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/brregstub/command/BrregGetCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.brregstub.domain.RolleoversiktTo; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/brregstub/command/BrregPostCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/brregstub/command/BrregPostCommand.java index 9a5f3d0c0dd..73c5bac0439 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/brregstub/command/BrregPostCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/brregstub/command/BrregPostCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.brregstub.domain.RolleoversiktTo; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/dokarkiv/command/DokarkivGetMiljoeCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/dokarkiv/command/DokarkivGetMiljoeCommand.java index b123f6c9adc..4ed861d6be3 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/dokarkiv/command/DokarkivGetMiljoeCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/dokarkiv/command/DokarkivGetMiljoeCommand.java @@ -1,7 +1,7 @@ package no.nav.dolly.bestilling.dokarkiv.command; import lombok.RequiredArgsConstructor; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/dokarkiv/command/DokarkivPostCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/dokarkiv/command/DokarkivPostCommand.java index fe74081a4eb..38959d37e97 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/dokarkiv/command/DokarkivPostCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/dokarkiv/command/DokarkivPostCommand.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.dokarkiv.domain.DokarkivRequest; import no.nav.dolly.bestilling.dokarkiv.domain.DokarkivResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/histark/command/HistarkPostCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/histark/command/HistarkPostCommand.java index b141ed72823..ad20fb87941 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/histark/command/HistarkPostCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/histark/command/HistarkPostCommand.java @@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.histark.domain.HistarkRequest; import no.nav.dolly.bestilling.histark.domain.HistarkResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.client.MultipartBodyBuilder; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/command/OpprettInntektsmeldingCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/command/OpprettInntektsmeldingCommand.java index 515c6a17ec0..b122259a8ff 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/command/OpprettInntektsmeldingCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektsmelding/command/OpprettInntektsmeldingCommand.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.inntektsmelding.domain.InntektsmeldingRequest; import no.nav.dolly.bestilling.inntektsmelding.domain.InntektsmeldingResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.BodyInserters; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/command/InntektstubDeleteCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/command/InntektstubDeleteCommand.java index fa98be5afa9..b5b84c7c3e6 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/command/InntektstubDeleteCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/command/InntektstubDeleteCommand.java @@ -1,7 +1,7 @@ package no.nav.dolly.bestilling.inntektstub.command; import lombok.RequiredArgsConstructor; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/command/InntektstubGetCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/command/InntektstubGetCommand.java index ba0ed1bf682..eb0dcae3cef 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/command/InntektstubGetCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/command/InntektstubGetCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.inntektstub.domain.Inntektsinformasjon; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/command/InntektstubPostCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/command/InntektstubPostCommand.java index 46641a80b7a..06e1e090f3e 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/command/InntektstubPostCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/inntektstub/command/InntektstubPostCommand.java @@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.inntektstub.domain.Inntektsinformasjon; import no.nav.dolly.util.TokenXUtil; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/command/InstdataDeleteCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/command/InstdataDeleteCommand.java index 819237f2778..bdefa78b38f 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/command/InstdataDeleteCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/command/InstdataDeleteCommand.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.instdata.domain.DeleteResponse; import no.nav.dolly.util.TokenXUtil; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/command/InstdataGetCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/command/InstdataGetCommand.java index 125fd01da11..a422787c559 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/command/InstdataGetCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/command/InstdataGetCommand.java @@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.instdata.domain.InstitusjonsoppholdRespons; import no.nav.dolly.domain.resultset.inst.Instdata; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpHeaders; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/command/InstdataGetMiljoerCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/command/InstdataGetMiljoerCommand.java index bd85bbff536..b909298636d 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/command/InstdataGetMiljoerCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/command/InstdataGetMiljoerCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.instdata.domain.MiljoerResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/command/InstdataPostCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/command/InstdataPostCommand.java index d77504be2cc..ac420ea89b6 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/command/InstdataPostCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/instdata/command/InstdataPostCommand.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.instdata.domain.InstdataResponse; import no.nav.dolly.domain.resultset.inst.Instdata; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/KontoregisterConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/KontoregisterConsumer.java index f26212ace0f..98e8812ce24 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/KontoregisterConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/KontoregisterConsumer.java @@ -14,13 +14,10 @@ import no.nav.testnav.libs.data.kontoregister.v1.OppdaterKontoRequestDTO; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; -import org.springframework.http.client.reactive.ReactorClientHttpConnector; import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.netty.http.client.HttpClient; -import reactor.netty.resources.ConnectionProvider; import java.time.Duration; import java.util.List; @@ -40,19 +37,13 @@ public KontoregisterConsumer( TokenExchange tokenService, Consumers consumers, ObjectMapper objectMapper, - WebClient.Builder webClientBuilder - ) { + WebClient.Builder webClientBuilder) { + this.tokenService = tokenService; serverProperties = consumers.getTestnavKontoregisterPersonProxy(); this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) - .clientConnector(new ReactorClientHttpConnector( - HttpClient.create(ConnectionProvider.builder("custom") - .maxConnections(10) - .pendingAcquireMaxCount(10000) - .pendingAcquireTimeout(Duration.ofMinutes(15)) - .build()))) .build(); } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/command/KontoregisterDeleteCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/command/KontoregisterDeleteCommand.java index e79b88444fd..5d7d88d4bfe 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/command/KontoregisterDeleteCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/command/KontoregisterDeleteCommand.java @@ -1,9 +1,9 @@ package no.nav.dolly.bestilling.kontoregisterservice.command; import lombok.RequiredArgsConstructor; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.data.kontoregister.v1.KontoregisterResponseDTO; import no.nav.testnav.libs.data.kontoregister.v1.SlettKontoRequestDTO; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/command/KontoregisterGetCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/command/KontoregisterGetCommand.java index 87109f69bbd..08e45a247c5 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/command/KontoregisterGetCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/command/KontoregisterGetCommand.java @@ -1,10 +1,10 @@ package no.nav.dolly.bestilling.kontoregisterservice.command; import lombok.RequiredArgsConstructor; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.data.kontoregister.v1.HentKontoRequestDTO; import no.nav.testnav.libs.data.kontoregister.v1.HentKontoResponseDTO; import no.nav.testnav.libs.data.kontoregister.v1.KontoDTO; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/command/KontoregisterPostCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/command/KontoregisterPostCommand.java index 80b35468e4e..b334e1ecd90 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/command/KontoregisterPostCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/kontoregisterservice/command/KontoregisterPostCommand.java @@ -1,9 +1,9 @@ package no.nav.dolly.bestilling.kontoregisterservice.command; import lombok.RequiredArgsConstructor; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.data.kontoregister.v1.KontoregisterResponseDTO; import no.nav.testnav.libs.data.kontoregister.v1.OppdaterKontoRequestDTO; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -46,4 +46,4 @@ public Mono call() { .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) .filter(WebClientFilter::is5xxException)); } -} +} \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/command/GetKontaktdataCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/command/GetKontaktdataCommand.java index 4e3a5c28a55..bded7c81054 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/command/GetKontaktdataCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/command/GetKontaktdataCommand.java @@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.domain.resultset.krrstub.DigitalKontaktdata; import no.nav.dolly.util.RequestHeaderUtil; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/command/KontaktadataDeleteCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/command/KontaktadataDeleteCommand.java index 352d7fbbf6c..e96b27865c2 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/command/KontaktadataDeleteCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/command/KontaktadataDeleteCommand.java @@ -5,7 +5,7 @@ import no.nav.dolly.bestilling.krrstub.dto.DigitalKontaktdataResponse; import no.nav.dolly.metrics.Timed; import no.nav.dolly.util.RequestHeaderUtil; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/command/KontaktdataPostCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/command/KontaktdataPostCommand.java index 3216cfa0338..7a496af3ae0 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/command/KontaktdataPostCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/krrstub/command/KontaktdataPostCommand.java @@ -4,7 +4,7 @@ import no.nav.dolly.bestilling.krrstub.dto.DigitalKontaktdataResponse; import no.nav.dolly.domain.resultset.krrstub.DigitalKontaktdata; import no.nav.dolly.util.RequestHeaderUtil; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/medl/command/MedlGetCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/medl/command/MedlGetCommand.java index 0e695f734fc..bcda027eaa6 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/medl/command/MedlGetCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/medl/command/MedlGetCommand.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import no.nav.dolly.domain.resultset.medl.MedlDataResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/medl/command/MedlPostCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/medl/command/MedlPostCommand.java index eb39348cdc3..a52174d22e3 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/medl/command/MedlPostCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/medl/command/MedlPostCommand.java @@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.medl.dto.MedlPostResponse; import no.nav.dolly.domain.resultset.medl.MedlData; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/medl/command/MedlPutCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/medl/command/MedlPutCommand.java index d472057aaf0..e444b2b6b72 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/medl/command/MedlPutCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/medl/command/MedlPutCommand.java @@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.medl.dto.MedlPostResponse; import no.nav.dolly.domain.resultset.medl.MedlData; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/organisasjonforvalter/OrganisasjonConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/organisasjonforvalter/OrganisasjonConsumer.java index f90a98636bf..2eb3f95ca40 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/organisasjonforvalter/OrganisasjonConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/organisasjonforvalter/OrganisasjonConsumer.java @@ -11,7 +11,7 @@ import no.nav.dolly.bestilling.organisasjonforvalter.domain.OrganisasjonDetaljer; import no.nav.dolly.config.Consumers; import no.nav.dolly.metrics.Timed; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/organisasjonforvalter/command/GetOrganisasjonCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/organisasjonforvalter/command/GetOrganisasjonCommand.java index 9a60dc88fde..a69e12e3491 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/organisasjonforvalter/command/GetOrganisasjonCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/organisasjonforvalter/command/GetOrganisasjonCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.organisasjonforvalter.domain.OrganisasjonDetaljer; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; import reactor.util.retry.Retry; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/PdlDataConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/PdlDataConsumer.java index 74b20add474..0fa07fd48a3 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/PdlDataConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/PdlDataConsumer.java @@ -1,7 +1,6 @@ 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; @@ -22,13 +21,10 @@ import no.nav.testnav.libs.data.pdlforvalter.v1.PersonUpdateRequestDTO; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; -import org.springframework.http.client.reactive.ReactorClientHttpConnector; import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.netty.http.client.HttpClient; -import reactor.netty.resources.ConnectionProvider; import java.time.Duration; import java.util.List; @@ -54,13 +50,6 @@ public PdlDataConsumer( this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .exchangeStrategies(JacksonExchangeStrategyUtil.getJacksonStrategy(objectMapper)) - .clientConnector(new ReactorClientHttpConnector( - HttpClient.create(ConnectionProvider.builder("custom") - .maxConnections(5) - .pendingAcquireMaxCount(500) - .pendingAcquireTimeout(Duration.ofMinutes(15)) - .build()) - .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10000))) .build(); } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataCheckIdentCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataCheckIdentCommand.java index 3fba9b3cb89..89a5657a528 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataCheckIdentCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataCheckIdentCommand.java @@ -3,8 +3,8 @@ import io.netty.handler.timeout.TimeoutException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.data.pdlforvalter.v1.AvailibilityResponseDTO; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataHentCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataHentCommand.java index 1111b26fb0a..4e63f0f6da5 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataHentCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataHentCommand.java @@ -3,8 +3,8 @@ import io.netty.handler.timeout.TimeoutException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.data.pdlforvalter.v1.FullPersonDTO; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataIdenterCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataIdenterCommand.java index 0a89296edae..1dfd86b9843 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataIdenterCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataIdenterCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataOppdateringCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataOppdateringCommand.java index 1a213993311..aea49ffdfb4 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataOppdateringCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataOppdateringCommand.java @@ -4,8 +4,8 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.pdldata.dto.PdlResponse; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.data.pdlforvalter.v1.PersonUpdateRequestDTO; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataOpprettingCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataOpprettingCommand.java index 7877e7ba5dd..e476b4e6ce9 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataOpprettingCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataOpprettingCommand.java @@ -4,8 +4,8 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.pdldata.dto.PdlResponse; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.data.pdlforvalter.v1.BestillingRequestDTO; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataOrdreCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataOrdreCommand.java index b7effccd547..ad42a28a9f4 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataOrdreCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataOrdreCommand.java @@ -3,7 +3,7 @@ import io.netty.handler.timeout.TimeoutException; import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.pdldata.dto.PdlResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataSlettCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataSlettCommand.java index 3cb3ede284b..87b5249d9ce 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataSlettCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataSlettCommand.java @@ -3,7 +3,7 @@ import io.netty.handler.timeout.TimeoutException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataSlettUtenomCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataSlettUtenomCommand.java index 3a6aaf2dd18..f27c88e3b4d 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataSlettUtenomCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataSlettUtenomCommand.java @@ -3,7 +3,7 @@ import io.netty.handler.timeout.TimeoutException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataStanaloneCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataStanaloneCommand.java index 508eb66ee37..2d984ceb092 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataStanaloneCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pdldata/command/PdlDataStanaloneCommand.java @@ -3,7 +3,7 @@ import io.netty.handler.timeout.TimeoutException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumer.java index 6599c88df64..9de7798e5e4 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/PensjonforvalterConsumer.java @@ -1,7 +1,6 @@ package no.nav.dolly.bestilling.pensjonforvalter; 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.pensjonforvalter.command.AnnullerSamboerCommand; @@ -28,15 +27,11 @@ import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; -import org.springframework.http.client.reactive.ReactorClientHttpConnector; import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.netty.http.client.HttpClient; -import reactor.netty.resources.ConnectionProvider; -import java.time.Duration; import java.util.List; import java.util.Set; @@ -61,13 +56,6 @@ public PensjonforvalterConsumer( this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) - .clientConnector(new ReactorClientHttpConnector( - HttpClient.create(ConnectionProvider.builder("custom") - .maxConnections(10) - .pendingAcquireMaxCount(500) - .pendingAcquireTimeout(Duration.ofMinutes(15)) - .build()) - .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10000))) .build(); } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/AnnullerSamboerCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/AnnullerSamboerCommand.java index db732c1a759..ab5b67beb8c 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/AnnullerSamboerCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/AnnullerSamboerCommand.java @@ -3,14 +3,14 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonforvalterResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.http.HttpStatus; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Mono; import reactor.util.retry.Retry; import java.time.Duration; -import java.util.Arrays; +import java.util.Collections; import java.util.concurrent.Callable; import static no.nav.dolly.domain.CommonKeysAndUtils.CONSUMER; @@ -61,7 +61,7 @@ private static PensjonforvalterResponse pensjonforvalterResponse(String miljoe, .build(); return PensjonforvalterResponse.builder() - .status(Arrays.asList(miljoeResponse)) + .status(Collections.singletonList(miljoeResponse)) .build(); } @@ -80,7 +80,7 @@ private static PensjonforvalterResponse pensjonforvalterResponseFromError(String .build(); return PensjonforvalterResponse.builder() - .status(Arrays.asList(miljoeResponse)) + .status(Collections.singletonList(miljoeResponse)) .build(); } } \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/HentMiljoerCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/HentMiljoerCommand.java index fd6997ffdbd..ab45ed0773a 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/HentMiljoerCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/HentMiljoerCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpHeaders; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/HentPoppInntekterCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/HentPoppInntekterCommand.java index fdf18317d8a..7b0f78b2921 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/HentPoppInntekterCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/HentPoppInntekterCommand.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.databind.JsonNode; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Mono; import reactor.util.retry.Retry; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/HentSamboerCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/HentSamboerCommand.java index 777a372943d..cd3f029a5fb 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/HentSamboerCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/HentSamboerCommand.java @@ -4,11 +4,11 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonSamboerResponse; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonforvalterResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Mono; -import java.util.Arrays; +import java.util.Collections; import java.util.concurrent.Callable; import static no.nav.dolly.domain.CommonKeysAndUtils.CONSUMER; @@ -58,7 +58,7 @@ private static PensjonSamboerResponse pensjonforvalterResponseFromError(String m .build(); return PensjonSamboerResponse.builder() - .status(Arrays.asList(miljoeResponse)) + .status(Collections.singletonList(miljoeResponse)) .build(); } } \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreAlderspensjonCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreAlderspensjonCommand.java index ea729b57b9e..9fb11dd473e 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreAlderspensjonCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreAlderspensjonCommand.java @@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.pensjonforvalter.domain.AlderspensjonRequest; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonforvalterResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -13,7 +13,9 @@ import java.time.Duration; import java.util.concurrent.Callable; -import static no.nav.dolly.domain.CommonKeysAndUtils.*; +import static no.nav.dolly.domain.CommonKeysAndUtils.CONSUMER; +import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CALL_ID; +import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CONSUMER_ID; import static no.nav.dolly.util.CallIdUtil.generateCallId; import static org.springframework.http.HttpHeaders.AUTHORIZATION; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagrePoppInntektCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagrePoppInntektCommand.java index 878a104cdeb..6b3fba6f980 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagrePoppInntektCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagrePoppInntektCommand.java @@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonPoppInntektRequest; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonforvalterResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -13,7 +13,9 @@ import java.time.Duration; import java.util.concurrent.Callable; -import static no.nav.dolly.domain.CommonKeysAndUtils.*; +import static no.nav.dolly.domain.CommonKeysAndUtils.CONSUMER; +import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CALL_ID; +import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CONSUMER_ID; import static no.nav.dolly.util.CallIdUtil.generateCallId; import static org.springframework.http.HttpHeaders.AUTHORIZATION; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreSamboerCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreSamboerCommand.java index f9fd6c0930d..617a0ba26a7 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreSamboerCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreSamboerCommand.java @@ -4,12 +4,12 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonSamboerRequest; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonforvalterResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.http.HttpStatus; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Mono; -import java.util.Arrays; +import java.util.Collections; import java.util.concurrent.Callable; import static no.nav.dolly.domain.CommonKeysAndUtils.CONSUMER; @@ -59,7 +59,7 @@ private static PensjonforvalterResponse pensjonforvalterResponse(String miljoe, .build(); return PensjonforvalterResponse.builder() - .status(Arrays.asList(miljoeResponse)) + .status(Collections.singletonList(miljoeResponse)) .build(); } @@ -78,7 +78,7 @@ private static PensjonforvalterResponse pensjonforvalterResponseFromError(String .build(); return PensjonforvalterResponse.builder() - .status(Arrays.asList(miljoeResponse)) + .status(Collections.singletonList(miljoeResponse)) .build(); } } \ No newline at end of file diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreTpForholdCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreTpForholdCommand.java index 9453db64466..108db087f52 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreTpForholdCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreTpForholdCommand.java @@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonTpForholdRequest; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonforvalterResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; @@ -14,7 +14,9 @@ import java.time.Duration; import java.util.concurrent.Callable; -import static no.nav.dolly.domain.CommonKeysAndUtils.*; +import static no.nav.dolly.domain.CommonKeysAndUtils.CONSUMER; +import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CALL_ID; +import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CONSUMER_ID; import static no.nav.dolly.util.CallIdUtil.generateCallId; import static no.nav.dolly.util.TokenXUtil.getUserJwt; import static org.springframework.http.HttpHeaders.AUTHORIZATION; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreTpYtelseCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreTpYtelseCommand.java index 2adb0710361..97e408b817c 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreTpYtelseCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreTpYtelseCommand.java @@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonTpYtelseRequest; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonforvalterResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; @@ -14,7 +14,9 @@ import java.time.Duration; import java.util.concurrent.Callable; -import static no.nav.dolly.domain.CommonKeysAndUtils.*; +import static no.nav.dolly.domain.CommonKeysAndUtils.CONSUMER; +import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CALL_ID; +import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CONSUMER_ID; import static no.nav.dolly.util.CallIdUtil.generateCallId; import static no.nav.dolly.util.TokenXUtil.getUserJwt; import static org.springframework.http.HttpHeaders.AUTHORIZATION; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreUforetrygdCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreUforetrygdCommand.java index 854d47977e6..8d8effe2cc6 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreUforetrygdCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/LagreUforetrygdCommand.java @@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonUforetrygdRequest; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonforvalterResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -13,7 +13,9 @@ import java.time.Duration; import java.util.concurrent.Callable; -import static no.nav.dolly.domain.CommonKeysAndUtils.*; +import static no.nav.dolly.domain.CommonKeysAndUtils.CONSUMER; +import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CALL_ID; +import static no.nav.dolly.domain.CommonKeysAndUtils.HEADER_NAV_CONSUMER_ID; import static no.nav.dolly.util.CallIdUtil.generateCallId; import static org.springframework.http.HttpHeaders.AUTHORIZATION; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/OpprettPersonCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/OpprettPersonCommand.java index 65a06db224e..a37bd6a6705 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/OpprettPersonCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/OpprettPersonCommand.java @@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonPersonRequest; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonforvalterResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/SletteTpForholdCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/SletteTpForholdCommand.java index 33c161cc11d..6b6a2fd11c6 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/SletteTpForholdCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/pensjonforvalter/command/SletteTpForholdCommand.java @@ -5,7 +5,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.pensjonforvalter.domain.PensjonforvalterResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/personservice/PersonServiceConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/personservice/PersonServiceConsumer.java index 5d94a31c6c8..aae9770e92b 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/personservice/PersonServiceConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/personservice/PersonServiceConsumer.java @@ -10,13 +10,10 @@ import no.nav.dolly.metrics.Timed; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; -import org.springframework.http.client.reactive.ReactorClientHttpConnector; import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.netty.http.client.HttpClient; -import reactor.netty.resources.ConnectionProvider; import java.time.Duration; import java.util.List; @@ -47,14 +44,6 @@ public PersonServiceConsumer( this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) - .clientConnector(new ReactorClientHttpConnector(HttpClient.create( - ConnectionProvider.builder("custom") - .maxConnections(10) - .pendingAcquireMaxCount(5000) - .pendingAcquireTimeout(Duration.ofMinutes(15)) - .build()) - .responseTimeout(Duration.ofSeconds(5)))) - .baseUrl(serverProperties.getUrl()) .build(); } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/personservice/command/PdlPersonerGetCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/personservice/command/PdlPersonerGetCommand.java index d74445e7f48..6dc0e3ec6a0 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/personservice/command/PdlPersonerGetCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/personservice/command/PdlPersonerGetCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.domain.PdlPersonBolk; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.web.reactive.function.client.WebClient; import org.springframework.web.reactive.function.client.WebClientResponseException; import reactor.core.publisher.Flux; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/DollyBestillingService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/DollyBestillingService.java index d381b9ee018..077ce0429aa 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/DollyBestillingService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/DollyBestillingService.java @@ -169,12 +169,21 @@ protected Flux opprettDollyPerson(String ident, BestillingProgress protected void doFerdig(Bestilling bestilling) { transactionHelperService.oppdaterBestillingFerdig(bestilling.getId(), bestillingService.cleanBestilling()); - transactionHelperService.clearCache(); MDC.remove(MDC_KEY_BESTILLING); log.info("Bestilling med id=#{} er ferdig", bestilling.getId()); } + protected void clearCache() { + + transactionHelperService.clearCache(); + } + + protected void saveFeil(BestillingProgress progress, String error) { + + transactionHelperService.persister(progress, BestillingProgress::setFeil, error); + } + protected void saveBestillingToElasticServer(RsDollyBestilling bestillingRequest, Bestilling bestilling) { if (isBlank(bestilling.getFeil()) && diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettBestillingService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettBestillingService.java index d2380d24ce1..704da340cf2 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettBestillingService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettBestillingService.java @@ -19,7 +19,7 @@ import no.nav.dolly.service.IdentService; import no.nav.dolly.util.ThreadLocalContextLifter; import no.nav.dolly.util.TransactionHelperService; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.slf4j.MDC; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -115,12 +115,15 @@ public void executeAsync(Bestilling bestilling) { log.error("Feil oppsto ved utføring av bestilling, progressId {} {}", progress.getId(), error, throwable); progress.setFeil(error); - transactionHelperService.persister(progress, BestillingProgress::setFeil, error); + saveFeil(progress, error); return Flux.just(progress); })))) .takeWhile(test -> !bestillingService.isStoppet(bestilling.getId())) .collectList() - .doFinally(done -> doFerdig(bestilling)) + .doFinally(done -> { + doFerdig(bestilling); + clearCache(); + }) .subscribe(); } else { diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettGruppeService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettGruppeService.java index a453cf5fe9c..2d282ddadf6 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettGruppeService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettGruppeService.java @@ -19,7 +19,7 @@ import no.nav.dolly.service.IdentService; import no.nav.dolly.util.ThreadLocalContextLifter; import no.nav.dolly.util.TransactionHelperService; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.slf4j.MDC; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -27,11 +27,9 @@ import reactor.core.publisher.Hooks; import reactor.core.publisher.Operators; -import java.time.Duration; import java.util.Comparator; import java.util.List; import java.util.Objects; -import java.util.concurrent.atomic.AtomicInteger; import static java.util.Objects.nonNull; import static no.nav.dolly.util.MdcUtil.MDC_KEY_BESTILLING; @@ -87,9 +85,7 @@ public void executeAsync(Bestilling bestilling) { .sorted(Comparator.comparing(GruppeBestillingIdent::getBestillingId)) .toList(); - var counter = new AtomicInteger(0); Flux.fromIterable(bestilling.getGruppe().getTestidenter()) - .delayElements(Duration.ofSeconds(counter.incrementAndGet() % 20 == 0 ? 30 : 0)) .flatMap(testident -> opprettProgress(bestilling, testident.getMaster(), testident.getIdent()) .flatMap(progress -> sendOrdrePerson(progress, PdlResponse.builder() .ident(testident.getIdent()) @@ -127,12 +123,15 @@ public void executeAsync(Bestilling bestilling) { WebClientFilter.getStatus(throwable), WebClientFilter.getMessage(throwable)); log.error("Feil oppsto ved utføring av bestilling, progressId {} {}", progress.getId(), error, throwable); - transactionHelperService.persister(progress, BestillingProgress::setFeil, error); + saveFeil(progress, error); return Flux.just(progress); })))) .takeWhile(test -> !bestillingService.isStoppet(bestilling.getId())) .collectList() - .doFinally(done -> doFerdig(bestilling)) + .doFinally(done -> { + doFerdig(bestilling); + clearCache(); + }) .subscribe(); } } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettIdentService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettIdentService.java index 5f3eddd991d..1be07918e11 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettIdentService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/GjenopprettIdentService.java @@ -20,7 +20,7 @@ import no.nav.dolly.service.IdentService; import no.nav.dolly.util.ThreadLocalContextLifter; import no.nav.dolly.util.TransactionHelperService; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.slf4j.MDC; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -130,12 +130,15 @@ public void executeAsync(Bestilling bestilling) { WebClientFilter.getStatus(throwable), WebClientFilter.getMessage(throwable)); log.error("Feil oppsto ved utføring av bestilling, progressId {} {}", progress.getId(), error, throwable); - transactionHelperService.persister(progress, BestillingProgress::setFeil, error); + saveFeil(progress, error); return Flux.just(progress); })))) .takeWhile(test -> !bestillingService.isStoppet(bestilling.getId())) .collectList() - .doFinally(done -> doFerdig(bestilling)) + .doFinally(done -> { + doFerdig(bestilling); + clearCache(); + }) .subscribe(); } } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/ImportAvPersonerFraPdlService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/ImportAvPersonerFraPdlService.java index 0742c20f43e..58a353ab24f 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/ImportAvPersonerFraPdlService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/ImportAvPersonerFraPdlService.java @@ -18,7 +18,7 @@ import no.nav.dolly.service.IdentService; import no.nav.dolly.util.ThreadLocalContextLifter; import no.nav.dolly.util.TransactionHelperService; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.slf4j.MDC; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -105,7 +105,7 @@ public void executeAsync(Bestilling bestilling) { WebClientFilter.getStatus(throwable), WebClientFilter.getMessage(throwable)); log.error("Feil oppsto ved utføring av bestilling, progressId {} {}", progress.getId(), error, throwable); - transactionHelperService.persister(progress, BestillingProgress::setFeil, error); + saveFeil(progress, error); }) .doOnNext(status -> oppdaterStatus(progress)))) .takeWhile(test -> !bestillingService.isStoppet(bestilling.getId())) @@ -113,6 +113,7 @@ public void executeAsync(Bestilling bestilling) { .doFinally(done -> { doFerdig(bestilling); saveBestillingToElasticServer(bestKriterier, bestilling); + clearCache(); }) .subscribe(); diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/LeggTilPaaGruppeService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/LeggTilPaaGruppeService.java index 40aed486399..08d207ed6e9 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/LeggTilPaaGruppeService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/LeggTilPaaGruppeService.java @@ -21,8 +21,8 @@ import no.nav.dolly.service.IdentService; import no.nav.dolly.util.ThreadLocalContextLifter; import no.nav.dolly.util.TransactionHelperService; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.data.pdlforvalter.v1.PersonUpdateRequestDTO; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.apache.commons.lang3.StringUtils; import org.slf4j.MDC; import org.springframework.scheduling.annotation.Async; @@ -31,9 +31,7 @@ import reactor.core.publisher.Hooks; import reactor.core.publisher.Operators; -import java.time.Duration; import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; import static java.util.Objects.nonNull; import static no.nav.dolly.util.MdcUtil.MDC_KEY_BESTILLING; @@ -85,10 +83,8 @@ public void executeAsync(Bestilling bestilling) { RsDollyBestillingRequest bestKriterier = getDollyBestillingRequest(bestilling); if (nonNull(bestKriterier)) { - var counter = new AtomicInteger(0); var testidenter = identService.getTestidenterByGruppe(bestilling.getGruppe().getId()); Flux.fromIterable(testidenter) - .delayElements(Duration.ofSeconds(counter.incrementAndGet() % 20 == 0 ? 30 : 0)) .flatMap(testident -> Flux.just(OriginatorUtility.prepOriginator(bestKriterier, testident, mapperFacade)) .flatMap(originator -> opprettProgress(bestilling, originator.getMaster(), testident.getIdent()) .flatMap(progress -> (originator.isPdlf() ? @@ -123,7 +119,7 @@ public void executeAsync(Bestilling bestilling) { WebClientFilter.getStatus(throwable), WebClientFilter.getMessage(throwable)); log.error("Feil oppsto ved utføring av bestilling, progressId {} {}", progress.getId(), error, throwable); - transactionHelperService.persister(progress, BestillingProgress::setFeil, error); + saveFeil(progress, error); return Flux.just(progress); }))))) .takeWhile(test -> !bestillingService.isStoppet(bestilling.getId())) @@ -131,6 +127,7 @@ public void executeAsync(Bestilling bestilling) { .doFinally(done -> { doFerdig(bestilling); saveBestillingToElasticServer(bestKriterier, bestilling); + clearCache(); }) .subscribe(); } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OppdaterPersonService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OppdaterPersonService.java index 8bb8010e14d..2848ee1a9ef 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OppdaterPersonService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OppdaterPersonService.java @@ -20,8 +20,8 @@ import no.nav.dolly.service.BestillingService; import no.nav.dolly.service.IdentService; import no.nav.dolly.util.TransactionHelperService; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.data.pdlforvalter.v1.PersonUpdateRequestDTO; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.apache.commons.lang3.StringUtils; import org.slf4j.MDC; import org.springframework.scheduling.annotation.Async; @@ -113,7 +113,7 @@ public void oppdaterPersonAsync(RsDollyUpdateRequest request, Bestilling bestill WebClientFilter.getStatus(throwable), WebClientFilter.getMessage(throwable)); log.error("Feil oppsto ved utføring av bestilling, progressId {} {}", progress.getId(), error, throwable); - transactionHelperService.persister(progress, BestillingProgress::setFeil, error); + saveFeil(progress, error); return Flux.just(progress); }))) .takeWhile(test -> !bestillingService.isStoppet(bestilling.getId())) @@ -121,6 +121,7 @@ public void oppdaterPersonAsync(RsDollyUpdateRequest request, Bestilling bestill .doFinally(done -> { doFerdig(bestilling); saveBestillingToElasticServer(request, bestilling); + clearCache(); }) .subscribe(); } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OpprettPersonerByKriterierService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OpprettPersonerByKriterierService.java index cacafd29de6..8649dcc50b0 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OpprettPersonerByKriterierService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OpprettPersonerByKriterierService.java @@ -17,7 +17,7 @@ import no.nav.dolly.service.IdentService; import no.nav.dolly.util.ThreadLocalContextLifter; import no.nav.dolly.util.TransactionHelperService; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.apache.commons.lang3.StringUtils; import org.slf4j.MDC; import org.springframework.scheduling.annotation.Async; @@ -110,7 +110,7 @@ public void executeAsync(Bestilling bestilling) { WebClientFilter.getStatus(throwable), WebClientFilter.getMessage(throwable)); log.error("Feil oppsto ved utføring av bestilling, progressId {} {}", progress.getId(), error, throwable); - transactionHelperService.persister(progress, BestillingProgress::setFeil, error); + saveFeil(progress, error); return Flux.just(progress); })))) .takeWhile(test -> !bestillingService.isStoppet(bestilling.getId())) @@ -118,6 +118,7 @@ public void executeAsync(Bestilling bestilling) { .doFinally(done -> { doFerdig(bestilling); saveBestillingToElasticServer(bestKriterier, bestilling); + clearCache(); }) .subscribe(); diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OpprettPersonerFraIdenterMedKriterierService.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OpprettPersonerFraIdenterMedKriterierService.java index 2d9426e34f8..12ed355c9b0 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OpprettPersonerFraIdenterMedKriterierService.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/service/OpprettPersonerFraIdenterMedKriterierService.java @@ -18,7 +18,7 @@ import no.nav.dolly.service.IdentService; import no.nav.dolly.util.ThreadLocalContextLifter; import no.nav.dolly.util.TransactionHelperService; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.apache.commons.lang3.StringUtils; import org.slf4j.MDC; import org.springframework.scheduling.annotation.Async; @@ -113,7 +113,7 @@ public void executeAsync(Bestilling bestilling) { WebClientFilter.getStatus(throwable), WebClientFilter.getMessage(throwable)); log.error("Feil oppsto ved utføring av bestilling, progressId {} {}", progress.getId(), error, throwable); - transactionHelperService.persister(progress, BestillingProgress::setFeil, error); + saveFeil(progress, error); return Flux.just(progress); })))) .takeWhile(test -> !bestillingService.isStoppet(bestilling.getId())) @@ -121,6 +121,7 @@ public void executeAsync(Bestilling bestilling) { .doFinally(done -> { doFerdig(bestilling); saveBestillingToElasticServer(bestKriterier, bestilling); + clearCache(); }) .subscribe(); diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sigrunstub/command/SigrunstubLignetDeleteCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sigrunstub/command/SigrunstubLignetDeleteCommand.java index e5653c15053..e4fd14dbddc 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sigrunstub/command/SigrunstubLignetDeleteCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sigrunstub/command/SigrunstubLignetDeleteCommand.java @@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.sigrunstub.dto.SigrunstubResponse; import no.nav.dolly.util.CallIdUtil; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpStatus; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sigrunstub/command/SigrunstubPensjonsgivendeDeleteCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sigrunstub/command/SigrunstubPensjonsgivendeDeleteCommand.java index 02255b54edd..dd63f291d79 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sigrunstub/command/SigrunstubPensjonsgivendeDeleteCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sigrunstub/command/SigrunstubPensjonsgivendeDeleteCommand.java @@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.sigrunstub.dto.SigrunstubResponse; import no.nav.dolly.util.CallIdUtil; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpStatus; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sigrunstub/command/SigurunstubPutCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sigrunstub/command/SigurunstubPutCommand.java index 6bbda9fcb52..0fd47cc2e9c 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sigrunstub/command/SigurunstubPutCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sigrunstub/command/SigurunstubPutCommand.java @@ -4,7 +4,7 @@ import no.nav.dolly.bestilling.sigrunstub.dto.SigrunstubRequest; import no.nav.dolly.bestilling.sigrunstub.dto.SigrunstubResponse; import no.nav.dolly.util.RequestHeaderUtil; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Mono; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/command/SkjermingsregisterDeleteCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/command/SkjermingsregisterDeleteCommand.java index 5d164363e14..143ab2a0f8f 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/command/SkjermingsregisterDeleteCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/command/SkjermingsregisterDeleteCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.util.CallIdUtil; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/command/SkjermingsregisterGetCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/command/SkjermingsregisterGetCommand.java index 21209ec22c4..5c748e943ad 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/command/SkjermingsregisterGetCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/command/SkjermingsregisterGetCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.skjermingsregister.domain.SkjermingDataResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.web.reactive.function.client.WebClient; import org.springframework.web.reactive.function.client.WebClientResponseException; import reactor.core.publisher.Mono; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/command/SkjermingsregisterPostCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/command/SkjermingsregisterPostCommand.java index 0e34893497c..a1921ee8ba7 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/command/SkjermingsregisterPostCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/command/SkjermingsregisterPostCommand.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.skjermingsregister.domain.SkjermingDataRequest; import no.nav.dolly.bestilling.skjermingsregister.domain.SkjermingDataResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; import reactor.util.retry.Retry; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/command/SkjermingsregisterPutCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/command/SkjermingsregisterPutCommand.java index 509f5b435d9..ee55cfb6cce 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/command/SkjermingsregisterPutCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/skjermingsregister/command/SkjermingsregisterPutCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.skjermingsregister.domain.SkjermingDataResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Mono; import reactor.util.retry.Retry; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/SyntSykemeldingConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/SyntSykemeldingConsumer.java index 8e8dd8e1f96..84560495a10 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/SyntSykemeldingConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/SyntSykemeldingConsumer.java @@ -43,8 +43,7 @@ public SyntSykemeldingConsumer( new ReactorClientHttpConnector( HttpClient .create() - .responseTimeout(Duration.ofSeconds(120)) - .resolver(spec -> spec.queryTimeout(Duration.ofSeconds(120))))) + .responseTimeout(Duration.ofSeconds(120)))) .build(); } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/command/Norg2GetCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/command/Norg2GetCommand.java index ce8e0c19901..29e670a5be7 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/command/Norg2GetCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/command/Norg2GetCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.sykemelding.dto.Norg2EnhetResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Mono; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/command/SykemeldingPostCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/command/SykemeldingPostCommand.java index e588ad99f65..06549e69549 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/command/SykemeldingPostCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/command/SykemeldingPostCommand.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.sykemelding.domain.DetaljertSykemeldingRequest; import no.nav.dolly.bestilling.sykemelding.dto.SykemeldingResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/command/SyntSykemeldingPostCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/command/SyntSykemeldingPostCommand.java index 1f230212c2f..2b781fa2dc8 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/command/SyntSykemeldingPostCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/sykemelding/command/SyntSykemeldingPostCommand.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.sykemelding.domain.SyntSykemeldingRequest; import no.nav.dolly.bestilling.sykemelding.dto.SykemeldingResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/command/HendelseslagerPublishCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/command/HendelseslagerPublishCommand.java index 35dd9890dde..16d29399990 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/command/HendelseslagerPublishCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/command/HendelseslagerPublishCommand.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.tagshendelseslager.dto.HendelselagerResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/command/TagsHenteCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/command/TagsHenteCommand.java index d000a6338e7..69fb78a3514 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/command/TagsHenteCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/command/TagsHenteCommand.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.databind.JsonNode; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/command/TagsOpprettingCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/command/TagsOpprettingCommand.java index 0015d1cf7dd..99e17a60d0b 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/command/TagsOpprettingCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/command/TagsOpprettingCommand.java @@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j; import no.nav.dolly.bestilling.tagshendelseslager.dto.TagsOpprettingResponse; import no.nav.dolly.domain.resultset.Tags; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/command/TagsSlettingCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/command/TagsSlettingCommand.java index 75b1df80e35..08ebc039d81 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/command/TagsSlettingCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tagshendelseslager/command/TagsSlettingCommand.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import no.nav.dolly.domain.resultset.Tags; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/TpsMessagingConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/TpsMessagingConsumer.java index e6fedcbea1c..7fb8c640168 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/TpsMessagingConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/TpsMessagingConsumer.java @@ -1,7 +1,6 @@ package no.nav.dolly.bestilling.tpsmessagingservice; 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.tpsmessagingservice.command.EgenansattDeleteCommand; @@ -19,14 +18,10 @@ import no.nav.testnav.libs.data.tpsmessagingservice.v1.TpsMeldingResponseDTO; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; -import org.springframework.http.client.reactive.ReactorClientHttpConnector; import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; -import reactor.netty.http.client.HttpClient; -import reactor.netty.resources.ConnectionProvider; -import java.time.Duration; import java.time.LocalDate; import java.util.Arrays; import java.util.List; @@ -60,13 +55,6 @@ public TpsMessagingConsumer( this.webClient = webClientBuilder .baseUrl(serverProperties.getUrl()) .exchangeStrategies(getJacksonStrategy(objectMapper)) - .clientConnector(new ReactorClientHttpConnector( - HttpClient.create(ConnectionProvider.builder("custom") - .maxConnections(5) - .pendingAcquireMaxCount(500) - .pendingAcquireTimeout(Duration.ofMinutes(15)) - .build()) - .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 5000))) .build(); } diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/EgenansattDeleteCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/EgenansattDeleteCommand.java index c6a62cee4dd..0c76e6772ac 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/EgenansattDeleteCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/EgenansattDeleteCommand.java @@ -2,8 +2,8 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.data.tpsmessagingservice.v1.TpsMeldingResponseDTO; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/EgenansattPostCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/EgenansattPostCommand.java index 8a62aa2d58b..be88cc247ff 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/EgenansattPostCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/EgenansattPostCommand.java @@ -2,8 +2,8 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.data.tpsmessagingservice.v1.TpsMeldingResponseDTO; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/MiljoerGetCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/MiljoerGetCommand.java index 31beab95d78..59534c09e7d 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/MiljoerGetCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/MiljoerGetCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Mono; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/PersonGetCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/PersonGetCommand.java index a13a8ab9cbb..7d30c111fdd 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/PersonGetCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/PersonGetCommand.java @@ -2,8 +2,8 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.data.tpsmessagingservice.v1.PersonMiljoeDTO; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/SikkerhetstiltakDeleteCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/SikkerhetstiltakDeleteCommand.java index 30e9018ec2c..9b5a5f45a41 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/SikkerhetstiltakDeleteCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/SikkerhetstiltakDeleteCommand.java @@ -2,8 +2,8 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.data.tpsmessagingservice.v1.TpsMeldingResponseDTO; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/TelefonnummerDeleteCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/TelefonnummerDeleteCommand.java index 13c64d24bbe..4b824d2895a 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/TelefonnummerDeleteCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/TelefonnummerDeleteCommand.java @@ -2,8 +2,8 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.data.tpsmessagingservice.v1.TpsMeldingResponseDTO; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Flux; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/TpsMessagingPostCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/TpsMessagingPostCommand.java index 0f91dcf9fce..cdde446774c 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/TpsMessagingPostCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/tpsmessagingservice/command/TpsMessagingPostCommand.java @@ -2,8 +2,8 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import no.nav.dolly.util.WebClientFilter; import no.nav.testnav.libs.data.tpsmessagingservice.v1.TpsMeldingResponseDTO; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.web.reactive.function.client.WebClient; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/command/UdistubDeleteCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/command/UdistubDeleteCommand.java index a33335f601a..3263ea15b33 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/command/UdistubDeleteCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/command/UdistubDeleteCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.udistub.domain.UdiPersonResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/command/UdistubGetCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/command/UdistubGetCommand.java index daa617c0c6e..3a6d3c38760 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/command/UdistubGetCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/command/UdistubGetCommand.java @@ -2,7 +2,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.udistub.domain.UdiPersonResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/command/UdistubPostCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/command/UdistubPostCommand.java index d20d4e1325d..ff69e899acb 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/command/UdistubPostCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/command/UdistubPostCommand.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.udistub.domain.UdiPerson; import no.nav.dolly.bestilling.udistub.domain.UdiPersonResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/command/UdistubPutCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/command/UdistubPutCommand.java index e39dd4edc34..dd37425f0d6 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/command/UdistubPutCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/bestilling/udistub/command/UdistubPutCommand.java @@ -3,7 +3,7 @@ import lombok.RequiredArgsConstructor; import no.nav.dolly.bestilling.udistub.domain.UdiPerson; import no.nav.dolly.bestilling.udistub.domain.UdiPersonResponse; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/kodeverk/KodeverkConsumer.java b/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/kodeverk/KodeverkConsumer.java index 6938efe2d2d..6b362c5e8f6 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/kodeverk/KodeverkConsumer.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/consumer/kodeverk/KodeverkConsumer.java @@ -4,7 +4,7 @@ import no.nav.dolly.config.Consumers; import no.nav.dolly.consumer.kodeverk.domain.KodeverkBetydningerResponse; import no.nav.dolly.metrics.Timed; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import no.nav.testnav.libs.securitycore.config.UserConstant; import no.nav.testnav.libs.securitycore.domain.ServerProperties; import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/consumer/command/ElasticPutCommand.java b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/consumer/command/ElasticPutCommand.java index 4847778fbe6..ae9a2bb0129 100644 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/consumer/command/ElasticPutCommand.java +++ b/apps/dolly-backend/src/main/java/no/nav/dolly/elastic/consumer/command/ElasticPutCommand.java @@ -2,7 +2,7 @@ import com.fasterxml.jackson.databind.JsonNode; import lombok.RequiredArgsConstructor; -import no.nav.dolly.util.WebClientFilter; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.web.reactive.function.BodyInserters; import org.springframework.web.reactive.function.client.WebClient; import reactor.core.publisher.Mono; diff --git a/apps/dolly-backend/src/main/java/no/nav/dolly/util/WebClientFilter.java b/apps/dolly-backend/src/main/java/no/nav/dolly/util/WebClientFilter.java deleted file mode 100644 index 1ed2401457c..00000000000 --- a/apps/dolly-backend/src/main/java/no/nav/dolly/util/WebClientFilter.java +++ /dev/null @@ -1,49 +0,0 @@ -package no.nav.dolly.util; - -import io.netty.channel.ChannelException; -import io.netty.resolver.dns.DnsNameResolverException; -import lombok.experimental.UtilityClass; -import lombok.extern.slf4j.Slf4j; -import org.springframework.http.HttpStatus; -import org.springframework.web.reactive.function.client.WebClientRequestException; -import org.springframework.web.reactive.function.client.WebClientResponseException; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; - -@Slf4j -@UtilityClass -public class WebClientFilter { - - public static boolean is5xxException(Throwable throwable) { - - return (throwable instanceof WebClientResponseException wce && - wce.getStatusCode().is5xxServerError()) && - !wce.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR) || - throwable instanceof WebClientRequestException || - throwable instanceof DnsNameResolverException || - throwable instanceof IOException || - throwable instanceof ChannelException; - } - - public static String getMessage(Throwable throwable) { - - return throwable instanceof WebClientResponseException webClientResponseException ? - webClientResponseException.getResponseBodyAsString(StandardCharsets.UTF_8) : - throwable.getMessage(); - } - - public static HttpStatus getStatus(Throwable throwable) { - - return throwable instanceof WebClientResponseException webClientResponseException ? - HttpStatus.valueOf(webClientResponseException.getStatusCode().value()) : - HttpStatus.INTERNAL_SERVER_ERROR; - } - - public static void logErrorMessage(Throwable throwable) { - - if (!(throwable instanceof WebClientResponseException)) { - log.error(throwable.getMessage(), throwable); - } - } -} diff --git a/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/consumer/command/ElasticSearchCommand.java b/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/consumer/command/ElasticSearchCommand.java index b3c4e3752fa..c09a74a7707 100644 --- a/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/consumer/command/ElasticSearchCommand.java +++ b/apps/person-search-service/src/main/java/no/nav/registre/testnorge/personsearchservice/consumer/command/ElasticSearchCommand.java @@ -2,9 +2,9 @@ import lombok.RequiredArgsConstructor; import no.nav.registre.testnorge.personsearchservice.model.SearchResponse; +import no.nav.testnav.libs.reactivecore.utils.WebClientFilter; import org.springframework.web.reactive.function.BodyInserters; import org.springframework.web.reactive.function.client.WebClient; -import org.springframework.web.reactive.function.client.WebClientResponseException; import reactor.core.publisher.Flux; import reactor.util.retry.Retry; @@ -26,12 +26,6 @@ public class ElasticSearchCommand implements Callable> { private final String token; private final Object body; - private static boolean is5xxException(Throwable throwable) { - - return throwable instanceof WebClientResponseException wce && - wce.getStatusCode().is5xxServerError(); - } - @Override public Flux call() { @@ -45,6 +39,6 @@ public Flux call() { .retrieve() .bodyToFlux(SearchResponse.class) .retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) - .filter(ElasticSearchCommand::is5xxException)); + .filter(WebClientFilter::is5xxException)); } } diff --git a/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/config/WebClientConfig.java b/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/config/WebClientConfig.java index ebe113850b3..2652f2ac20c 100644 --- a/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/config/WebClientConfig.java +++ b/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/config/WebClientConfig.java @@ -41,16 +41,17 @@ public WebClient.Builder webClientBuilder(ApplicationContext context) { new ReactorClientHttpConnector( HttpClient .create(ConnectionProvider.builder("Testnorge connection pool") - .maxConnections(1500) - .pendingAcquireMaxCount(3000) + .maxConnections(5) + .pendingAcquireMaxCount(10000) + .pendingAcquireTimeout(Duration.ofMinutes(30)) .build()) - .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 60000) + .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10000) .option(ChannelOption.SO_KEEPALIVE, true) .option(EpollChannelOption.TCP_KEEPIDLE, 300) .option(EpollChannelOption.TCP_KEEPINTVL, 60) .option(EpollChannelOption.TCP_KEEPCNT, 8) - .responseTimeout(Duration.ofSeconds(60)) - .resolver(spec -> spec.queryTimeout(Duration.ofSeconds(60))))); + .responseTimeout(Duration.ofSeconds(30)) + )); } catch (NoSuchBeanDefinitionException e) { diff --git a/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/utils/WebClientFilter.java b/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/utils/WebClientFilter.java index 4217b2d16a1..83eac6dc0ec 100644 --- a/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/utils/WebClientFilter.java +++ b/libs/reactive-core/src/main/java/no/nav/testnav/libs/reactivecore/utils/WebClientFilter.java @@ -1,13 +1,15 @@ package no.nav.testnav.libs.reactivecore.utils; -import io.netty.channel.ChannelException; -import io.netty.resolver.dns.DnsNameResolverException; + +import io.netty.channel.ConnectTimeoutException; +import io.netty.handler.timeout.ReadTimeoutException; +import io.netty.handler.timeout.WriteTimeoutException; import lombok.experimental.UtilityClass; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.web.reactive.function.client.WebClientRequestException; import org.springframework.web.reactive.function.client.WebClientResponseException; -import java.io.IOException; +import java.net.SocketException; import java.nio.charset.StandardCharsets; @Slf4j @@ -16,20 +18,37 @@ public class WebClientFilter { public static boolean is5xxException(Throwable throwable) { - return (throwable instanceof WebClientResponseException wce && - wce.getStatusCode().is5xxServerError()) && - !wce.getStatusCode().equals(HttpStatus.INTERNAL_SERVER_ERROR) || - throwable instanceof WebClientRequestException || - throwable instanceof DnsNameResolverException || - throwable instanceof IOException || - throwable instanceof ChannelException; + return throwable instanceof WebClientResponseException responseException && + responseException.getStatusCode().is5xxServerError() || + throwable instanceof WebClientRequestException requestException && + requestException.getCause() instanceof SocketException; } public static String getMessage(Throwable throwable) { - return throwable instanceof WebClientResponseException webClientResponseException ? - webClientResponseException.getResponseBodyAsString(StandardCharsets.UTF_8) : - throwable.getMessage(); + if (throwable instanceof WebClientResponseException responseException) { + return responseException.getResponseBodyAsString(StandardCharsets.UTF_8); + + } else if (throwable instanceof WebClientRequestException requestException) { + + if (requestException.getCause() instanceof ConnectTimeoutException || + requestException.getCause() instanceof ReadTimeoutException || + requestException.getCause() instanceof WriteTimeoutException) { + + return "Mottaker svarer ikke, eller har for lang svartid."; + + } else if (requestException.getCause() instanceof SocketException) { + + return "Forbindelsen er ustabil og mottaker kunne ikke nås."; + + } else { + + return requestException.getCause().toString(); + } + + } else { + return throwable.getMessage(); + } } public static HttpStatus getStatus(Throwable throwable) {