Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/idporten-miljoevelger
Browse files Browse the repository at this point in the history
# Conflicts:
#	apps/dolly-frontend/src/main/js/src/components/ui/form/inputs/datepicker/Datepicker.tsx
  • Loading branch information
stigus committed Mar 21, 2024
2 parents 04634b9 + d48b5e0 commit 2569072
Show file tree
Hide file tree
Showing 60 changed files with 1,079 additions and 167 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/app.ereg-batch-status-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
workflow:
uses: ./.github/workflows/common.workflow.backend.yml
with:
cluster: "dev-fss"
cluster: "dev-gcp"
working-directory: "apps/ereg-batch-status-service"
deploy-tag: "#deploy-ereg-batch-status-service"
permissions:
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/proxy.modapp-ereg-proxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: modapp-ereg-proxy

on:
push:
paths:
- libs/reactive-core
- libs/reactive-proxy
- libs/reactive-security
- libs/security-core
- proxies/modapp-ereg-proxy/**
- .github/workflows/proxy.modapp-ereg-proxy.yml

jobs:
workflow:
uses: ./.github/workflows/common.workflow.backend.yml
with:
cluster: "dev-fss"
working-directory: "proxies/modapp-ereg-proxy"
deploy-tag: "#deploy-proxy"
permissions:
contents: read
id-token: write
secrets: inherit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.idea/
*target/
*.iml
*.http

# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public Flux<ClientFuture> gjenopprett(RsDollyUtvidetBestilling bestilling, Dolly

return sendArbeidsforhold(bestilling, dollyPerson, miljoerTrygg.get(), isOpprettEndre);
} else {
return ameldingService.sendAmelding(bestilling, dollyPerson, miljoerTrygg.get(), progress);
return ameldingService.sendAmelding(bestilling, dollyPerson, miljoerTrygg.get());
}
})
.map(status -> futurePersist(progress, status));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import lombok.extern.slf4j.Slf4j;
import no.nav.dolly.bestilling.aareg.command.AmeldingPutCommand;
import no.nav.dolly.config.Consumers;
import no.nav.dolly.domain.jpa.BestillingProgress;
import no.nav.dolly.errorhandling.ErrorStatusDecoder;
import no.nav.dolly.metrics.Timed;
import no.nav.testnav.libs.dto.ameldingservice.v1.AMeldingDTO;
Expand All @@ -14,15 +13,11 @@
import no.nav.testnav.libs.standalone.servletsecurity.exchange.TokenExchange;
import org.slf4j.event.Level;
import org.springframework.http.HttpStatus;
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.time.format.DateTimeFormatter;
import java.util.List;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -53,22 +48,12 @@ public AmeldingConsumer(
this.webClient = webClientBuilder
.baseUrl(serverProperties.getUrl())
.exchangeStrategies(getJacksonStrategy(objectMapper))
.clientConnector(
new ReactorClientHttpConnector(
HttpClient
.create(ConnectionProvider.builder("Testnorge connection pool")
.maxConnections(5)
.pendingAcquireMaxCount(10000)
.pendingAcquireTimeout(Duration.ofMinutes(30))
.build())
.responseTimeout(Duration.ofSeconds(3))
))
.build();
this.errorStatusDecoder = errorStatusDecoder;
}

@Timed(name = "providers", tags = {"operation", "amelding_put"})
public Flux<String> sendAmeldinger(List<AMeldingDTO> ameldinger, String miljoe, BestillingProgress progress) {
public Flux<String> sendAmeldinger(List<AMeldingDTO> ameldinger, String miljoe) {

return tokenService.exchange(serverProperties)
.flatMapMany(token -> Flux.fromIterable(ameldinger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import lombok.extern.slf4j.Slf4j;
import ma.glasnost.orika.MapperFacade;
import ma.glasnost.orika.MappingContext;
import no.nav.dolly.domain.jpa.BestillingProgress;
import no.nav.dolly.domain.resultset.RsDollyUtvidetBestilling;
import no.nav.dolly.domain.resultset.aareg.RsAareg;
import no.nav.dolly.domain.resultset.aareg.RsAmeldingRequest;
Expand Down Expand Up @@ -34,7 +33,7 @@ public class AmeldingService {
private final OrganisasjonServiceConsumer organisasjonServiceConsumer;

public Mono<String> sendAmelding(RsDollyUtvidetBestilling bestilling, DollyPerson dollyPerson,
Set<String> miljoer, BestillingProgress progress) {
Set<String> miljoer) {

var orgnumre = bestilling.getAareg().getFirst().getAmelding().stream()
.map(RsAmeldingRequest::getArbeidsforhold)
Expand All @@ -49,14 +48,14 @@ public Mono<String> sendAmelding(RsDollyUtvidetBestilling bestilling, DollyPerso
.collect(Collectors.toMap(OrganisasjonDTO::getOrgnummer, OrganisasjonDTO::getJuridiskEnhet))
.flatMapMany(organisasjon ->
prepareAmeldinger(bestilling.getAareg().getFirst(), dollyPerson.getIdent(),
organisasjon, miljoe, progress))
organisasjon, miljoe))
.collect(Collectors.joining(",")))
.flatMap(Flux::from)
.collect(Collectors.joining(","));
}

private Flux<String> prepareAmeldinger(RsAareg aareg, String ident, Map<String, String> organisasjon,
String miljoe, BestillingProgress progress) {
String miljoe) {

var context = new MappingContext.Factory().getContext();
context.setProperty("personIdent", ident);
Expand All @@ -67,7 +66,7 @@ private Flux<String> prepareAmeldinger(RsAareg aareg, String ident, Map<String,
.map(aamelding -> mapperFacade.map(aamelding, AMeldingDTO.class, context))
.sort(Comparator.comparing(AMeldingDTO::getKalendermaaned))
.collectList()
.flatMapMany(ameldinger -> ameldingConsumer.sendAmeldinger(ameldinger, miljoe, progress)
.flatMapMany(ameldinger -> ameldingConsumer.sendAmeldinger(ameldinger, miljoe)
.distinct()
.map(status -> STATUS_ELEMENT.formatted(miljoe, status)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
import reactor.netty.http.client.HttpClientRequest;
import reactor.util.retry.Retry;

import java.time.Duration;
import java.util.concurrent.Callable;

import static no.nav.dolly.util.RequestTimeout.REQUEST_DURATION;

@RequiredArgsConstructor
public class AmeldingPutCommand implements Callable<Mono<ResponseEntity<String>>> {

Expand All @@ -31,6 +34,10 @@ public Mono<ResponseEntity<String>> call() {
return webClient.put()
.uri(uriBuilder -> uriBuilder.path(AMELDING_URL)
.build())
.httpRequest(httpRequest -> {
HttpClientRequest reactorRequest = httpRequest.getNativeRequest();
reactorRequest.responseTimeout(Duration.ofSeconds(REQUEST_DURATION));
})
.header(HttpHeaders.AUTHORIZATION, "Bearer " + token)
.header(UserConstant.USER_HEADER_JWT, TokenXUtil.getUserJwt())
.header(MILJOE, miljo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;
import reactor.netty.http.client.HttpClientRequest;
import reactor.util.retry.Retry;

import java.net.http.HttpTimeoutException;
import java.time.Duration;
import java.util.concurrent.Callable;

import static no.nav.dolly.util.RequestTimeout.REQUEST_DURATION;
import static no.nav.dolly.util.TokenXUtil.getUserJwt;

@Slf4j
Expand All @@ -37,6 +39,10 @@ public Flux<PdlResponse> call() {
return webClient
.put()
.uri(PDL_FORVALTER_PERSONER_URL, ident)
.httpRequest(httpRequest -> {
HttpClientRequest reactorRequest = httpRequest.getNativeRequest();
reactorRequest.responseTimeout(Duration.ofSeconds(REQUEST_DURATION));
})
.header(HttpHeaders.AUTHORIZATION, "Bearer " + token)
.header(UserConstant.USER_HEADER_JWT, getUserJwt())
.contentType(MediaType.APPLICATION_JSON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;
import reactor.netty.http.client.HttpClientRequest;
import reactor.util.retry.Retry;

import java.net.http.HttpTimeoutException;
import java.time.Duration;
import java.util.concurrent.Callable;

import static no.nav.dolly.util.RequestTimeout.REQUEST_DURATION;
import static no.nav.dolly.util.TokenXUtil.getUserJwt;

@Slf4j
Expand All @@ -36,6 +38,10 @@ public Flux<PdlResponse> call() {
return webClient
.post()
.uri(PDL_FORVALTER_PERSONER_URL)
.httpRequest(httpRequest -> {
HttpClientRequest reactorRequest = httpRequest.getNativeRequest();
reactorRequest.responseTimeout(Duration.ofSeconds(REQUEST_DURATION));
})
.header(HttpHeaders.AUTHORIZATION, "Bearer " + token)
.header(UserConstant.USER_HEADER_JWT, getUserJwt())
.contentType(MediaType.APPLICATION_JSON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;
import reactor.netty.http.client.HttpClientRequest;
import reactor.util.retry.Retry;

import java.net.http.HttpTimeoutException;
import java.time.Duration;
import java.util.concurrent.Callable;

import static no.nav.dolly.util.RequestTimeout.REQUEST_DURATION;
import static no.nav.dolly.util.TokenXUtil.getUserJwt;

@RequiredArgsConstructor
Expand All @@ -36,6 +38,10 @@ public Flux<PdlResponse> call() {
.uri(uriBuilder -> uriBuilder.path(PDL_FORVALTER_ORDRE_URL)
.queryParam(EXCLUDE_EKSTERNE_PERSONER, ekskluderEksternePersoner)
.build(ident))
.httpRequest(httpRequest -> {
HttpClientRequest reactorRequest = httpRequest.getNativeRequest();
reactorRequest.responseTimeout(Duration.ofSeconds(REQUEST_DURATION));
})
.header(HttpHeaders.AUTHORIZATION, "Bearer " + token)
.header(UserConstant.USER_HEADER_JWT, getUserJwt())
.contentType(MediaType.APPLICATION_JSON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.netty.http.client.HttpClientRequest;
import reactor.util.retry.Retry;

import java.time.Duration;
Expand All @@ -18,6 +19,7 @@
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.RequestTimeout.REQUEST_DURATION;
import static org.springframework.http.HttpHeaders.AUTHORIZATION;

@Slf4j
Expand All @@ -40,6 +42,10 @@ public Flux<PensjonforvalterResponse> call() {
.path(alderspensjonRequest instanceof AlderspensjonVedtakRequest ?
PENSJON_AP_VEDTAK_URL : PENSJON_AP_SOKNAD_URL)
.build())
.httpRequest(httpRequest -> {
HttpClientRequest reactorRequest = httpRequest.getNativeRequest();
reactorRequest.responseTimeout(Duration.ofSeconds(REQUEST_DURATION));
})
.header(AUTHORIZATION, "Bearer " + token)
.header(HEADER_NAV_CALL_ID, generateCallId())
.header(HEADER_NAV_CONSUMER_ID, CONSUMER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.netty.http.client.HttpClientRequest;
import reactor.util.retry.Retry;

import java.time.Duration;
Expand All @@ -17,6 +18,7 @@
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.RequestTimeout.REQUEST_DURATION;
import static org.springframework.http.HttpHeaders.AUTHORIZATION;

@Slf4j
Expand All @@ -35,6 +37,10 @@ public Flux<PensjonforvalterResponse> call() {
.uri(uriBuilder -> uriBuilder
.path(POPP_INNTEKT_URL)
.build())
.httpRequest(httpRequest -> {
HttpClientRequest reactorRequest = httpRequest.getNativeRequest();
reactorRequest.responseTimeout(Duration.ofSeconds(REQUEST_DURATION));
})
.header(AUTHORIZATION, "Bearer " + token)
.header(HEADER_NAV_CALL_ID, generateCallId())
.header(HEADER_NAV_CONSUMER_ID, CONSUMER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.netty.http.client.HttpClientRequest;
import reactor.util.retry.Retry;

import java.time.Duration;
Expand All @@ -18,6 +19,7 @@
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.RequestTimeout.REQUEST_DURATION;
import static no.nav.dolly.util.TokenXUtil.getUserJwt;
import static org.springframework.http.HttpHeaders.AUTHORIZATION;

Expand All @@ -39,6 +41,10 @@ public Flux<PensjonforvalterResponse> call() {
.uri(uriBuilder -> uriBuilder
.path(PENSJON_TP_FORHOLD_URL)
.build())
.httpRequest(httpRequest -> {
HttpClientRequest reactorRequest = httpRequest.getNativeRequest();
reactorRequest.responseTimeout(Duration.ofSeconds(REQUEST_DURATION));
})
.header(AUTHORIZATION, "Bearer " + token)
.header(UserConstant.USER_HEADER_JWT, getUserJwt())
.header(HEADER_NAV_CALL_ID, generateCallId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.netty.http.client.HttpClientRequest;
import reactor.util.retry.Retry;

import java.time.Duration;
Expand All @@ -18,6 +19,7 @@
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.RequestTimeout.REQUEST_DURATION;
import static no.nav.dolly.util.TokenXUtil.getUserJwt;
import static org.springframework.http.HttpHeaders.AUTHORIZATION;

Expand All @@ -38,6 +40,10 @@ public Flux<PensjonforvalterResponse> call() {
.uri(uriBuilder -> uriBuilder
.path(PENSJON_TP_YTELSE_URL)
.build())
.httpRequest(httpRequest -> {
HttpClientRequest reactorRequest = httpRequest.getNativeRequest();
reactorRequest.responseTimeout(Duration.ofSeconds(REQUEST_DURATION));
})
.header(AUTHORIZATION, "Bearer " + token)
.header(UserConstant.USER_HEADER_JWT, getUserJwt())
.header(HEADER_NAV_CALL_ID, generateCallId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.netty.http.client.HttpClientRequest;
import reactor.util.retry.Retry;

import java.time.Duration;
Expand All @@ -17,6 +18,7 @@
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.RequestTimeout.REQUEST_DURATION;
import static org.springframework.http.HttpHeaders.AUTHORIZATION;

@Slf4j
Expand All @@ -37,6 +39,10 @@ public Flux<PensjonforvalterResponse> call() {
.uri(uriBuilder -> uriBuilder
.path(PENSJON_UT_URL)
.build())
.httpRequest(httpRequest -> {
HttpClientRequest reactorRequest = httpRequest.getNativeRequest();
reactorRequest.responseTimeout(Duration.ofSeconds(REQUEST_DURATION));
})
.header(AUTHORIZATION, "Bearer " + token)
.header(HEADER_NAV_CALL_ID, generateCallId())
.header(HEADER_NAV_CONSUMER_ID, CONSUMER)
Expand Down
Loading

0 comments on commit 2569072

Please sign in to comment.