Skip to content

Commit

Permalink
Lagt til synkronisering for alle #deploy-test-dolly-backend
Browse files Browse the repository at this point in the history
  • Loading branch information
krharum committed Sep 14, 2023
1 parent 7b2dc4e commit 63cd58c
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import no.nav.dolly.bestilling.pdldata.dto.PdlResponse;
import no.nav.dolly.bestilling.pensjonforvalter.PensjonforvalterClient;
import no.nav.dolly.bestilling.tagshendelseslager.TagsHendelseslagerClient;
import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService;
import no.nav.dolly.domain.jpa.Bestilling;
import no.nav.dolly.domain.jpa.BestillingProgress;
import no.nav.dolly.domain.jpa.Bruker;
Expand Down Expand Up @@ -56,6 +57,7 @@ public class DollyBestillingService {
protected final PdlDataConsumer pdlDataConsumer;
protected final ErrorStatusDecoder errorStatusDecoder;
protected final TransactionHelperService transactionHelperService;
protected final TpsPersonService tpsPersonService;

public static Set<String> getEnvironments(String miljoer) {
return isNotBlank(miljoer) ? Set.of(miljoer.split(",")) : emptySet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public class GjenopprettBestillingService extends DollyBestillingService {

private final BestillingProgressService bestillingProgressService;
private final PersonServiceClient personServiceClient;
private final TpsPersonService tpsPersonService;

public GjenopprettBestillingService(
IdentService identService,
Expand All @@ -59,11 +58,11 @@ public GjenopprettBestillingService(
counterCustomRegistry,
pdlDataConsumer,
errorStatusDecoder,
transactionHelperService
transactionHelperService,
tpsPersonService
);
this.bestillingProgressService = bestillingProgressService;
this.personServiceClient = personServiceClient;
this.tpsPersonService = tpsPersonService;
}

@Async
Expand Down Expand Up @@ -94,7 +93,7 @@ public void executeAsync(Bestilling bestilling) {
.map(ClientFuture::get)
.filter(BestillingProgress::isPdlSync)
.flatMap(pdlSync -> Flux.concat(
tpsPersonService.syncPerson(dollyPerson, bestKriterier, progress)
tpsPersonService.syncPerson(bestKriterier, progress, false)
.map(ClientFuture::get),
gjenopprettKlienter(dollyPerson, bestKriterier,
fase2Klienter(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import no.nav.dolly.bestilling.pdldata.PdlDataConsumer;
import no.nav.dolly.bestilling.pdldata.dto.PdlResponse;
import no.nav.dolly.bestilling.personservice.PersonServiceClient;
import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService;
import no.nav.dolly.domain.jpa.Bestilling;
import no.nav.dolly.domain.jpa.BestillingProgress;
import no.nav.dolly.domain.resultset.RsDollyBestilling;
Expand Down Expand Up @@ -49,7 +50,8 @@ public GjenopprettGruppeService(
ErrorStatusDecoder errorStatusDecoder,
PdlDataConsumer pdlDataConsumer,
TransactionHelperService transactionHelperService,
PersonServiceClient personServiceClient
PersonServiceClient personServiceClient,
TpsPersonService tpsPersonService
) {
super(
identService,
Expand All @@ -59,7 +61,8 @@ public GjenopprettGruppeService(
counterCustomRegistry,
pdlDataConsumer,
errorStatusDecoder,
transactionHelperService
transactionHelperService,
tpsPersonService
);
this.personServiceClient = personServiceClient;
}
Expand Down Expand Up @@ -106,6 +109,8 @@ public void executeAsync(Bestilling bestilling) {
.doOnNext(request -> log.info("Startet gjenopprett bestilling {} for ident: {}",
request.getId(), testident.getIdent()))
.flatMapSequential(bestillingRequest -> Flux.concat(
tpsPersonService.syncPerson(bestillingRequest, progress, false)
.map(ClientFuture::get),
gjenopprettKlienter(dollyPerson, bestillingRequest,
fase2Klienter(),
progress, false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import no.nav.dolly.bestilling.pdldata.PdlDataConsumer;
import no.nav.dolly.bestilling.pdldata.dto.PdlResponse;
import no.nav.dolly.bestilling.personservice.PersonServiceClient;
import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService;
import no.nav.dolly.domain.jpa.Bestilling;
import no.nav.dolly.domain.jpa.BestillingProgress;
import no.nav.dolly.domain.resultset.RsDollyBestilling;
Expand Down Expand Up @@ -49,7 +50,8 @@ public GjenopprettIdentService(
ErrorStatusDecoder errorStatusDecoder,
PdlDataConsumer pdlDataConsumer,
TransactionHelperService transactionHelperService,
PersonServiceClient personServiceClient
PersonServiceClient personServiceClient,
TpsPersonService tpsPersonService
) {
super(
identService,
Expand All @@ -59,7 +61,8 @@ public GjenopprettIdentService(
counterCustomRegistry,
pdlDataConsumer,
errorStatusDecoder,
transactionHelperService
transactionHelperService,
tpsPersonService
);
this.personServiceClient = personServiceClient;
}
Expand Down Expand Up @@ -108,6 +111,8 @@ public void executeAsync(Bestilling bestilling) {
log.info("Startet gjenopprett bestilling {} for ident: {}",
request.getId(), testident.getIdent()))
.flatMap(bestillingRequest -> Flux.concat(
tpsPersonService.syncPerson(bestillingRequest, progress, false)
.map(ClientFuture::get),
gjenopprettKlienter(dollyPerson, bestillingRequest,
fase2Klienter(),
progress, false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import no.nav.dolly.bestilling.ClientRegister;
import no.nav.dolly.bestilling.pdldata.PdlDataConsumer;
import no.nav.dolly.bestilling.personservice.PersonServiceClient;
import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService;
import no.nav.dolly.domain.jpa.Bestilling;
import no.nav.dolly.domain.jpa.BestillingProgress;
import no.nav.dolly.domain.resultset.RsDollyBestillingRequest;
Expand Down Expand Up @@ -43,7 +44,8 @@ public ImportAvPersonerFraPdlService(IdentService identService,
ErrorStatusDecoder errorStatusDecoder,
PdlDataConsumer pdlDataConsumer,
TransactionHelperService transactionHelperService,
PersonServiceClient personServiceClient) {
PersonServiceClient personServiceClient,
TpsPersonService tpsPersonService) {
super(
identService,
bestillingService,
Expand All @@ -52,7 +54,8 @@ public ImportAvPersonerFraPdlService(IdentService identService,
counterCustomRegistry,
pdlDataConsumer,
errorStatusDecoder,
transactionHelperService
transactionHelperService,
tpsPersonService
);
this.personServiceClient = personServiceClient;
}
Expand Down Expand Up @@ -82,6 +85,8 @@ public void executeAsync(Bestilling bestilling) {
.filter(BestillingProgress::isPdlSync)
.flatMap(pdlSync ->
Flux.concat(
tpsPersonService.syncPerson(bestKriterier, progress, true)
.map(ClientFuture::get),
gjenopprettKlienter(dollyPerson, bestKriterier,
fase2Klienter(),
progress, true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import no.nav.dolly.bestilling.pdldata.PdlDataConsumer;
import no.nav.dolly.bestilling.pdldata.dto.PdlResponse;
import no.nav.dolly.bestilling.personservice.PersonServiceClient;
import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService;
import no.nav.dolly.domain.jpa.Bestilling;
import no.nav.dolly.domain.jpa.BestillingProgress;
import no.nav.dolly.domain.resultset.RsDollyBestillingRequest;
Expand Down Expand Up @@ -55,7 +56,8 @@ public LeggTilPaaGruppeService(
ErrorStatusDecoder errorStatusDecoder,
PdlDataConsumer pdlDataConsumer,
TransactionHelperService transactionHelperService,
PersonServiceClient personServiceClient) {
PersonServiceClient personServiceClient,
TpsPersonService tpsPersonService) {
super(
identService,
bestillingService,
Expand All @@ -64,7 +66,8 @@ public LeggTilPaaGruppeService(
counterCustomRegistry,
pdlDataConsumer,
errorStatusDecoder,
transactionHelperService
transactionHelperService,
tpsPersonService
);
this.personServiceClient = personServiceClient;
this.mapperFacade = mapperFacade;
Expand Down Expand Up @@ -104,6 +107,8 @@ public void executeAsync(Bestilling bestilling) {
.filter(BestillingProgress::isPdlSync)
.flatMap(pdlSync ->
Flux.concat(
tpsPersonService.syncPerson(bestKriterier, progress, true)
.map(ClientFuture::get),
gjenopprettKlienter(dollyPerson, bestKriterier,
fase2Klienter(),
progress, true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import no.nav.dolly.bestilling.pdldata.PdlDataConsumer;
import no.nav.dolly.bestilling.pdldata.dto.PdlResponse;
import no.nav.dolly.bestilling.personservice.PersonServiceClient;
import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService;
import no.nav.dolly.domain.jpa.Bestilling;
import no.nav.dolly.domain.jpa.BestillingProgress;
import no.nav.dolly.domain.resultset.RsDollyUpdateRequest;
Expand Down Expand Up @@ -50,7 +51,8 @@ public OppdaterPersonService(
ErrorStatusDecoder errorStatusDecoder,
PdlDataConsumer pdlDataConsumer,
TransactionHelperService transactionHelperService,
PersonServiceClient personServiceClient) {
PersonServiceClient personServiceClient,
TpsPersonService tpsPersonService) {
super(
identService,
bestillingService,
Expand All @@ -59,7 +61,8 @@ public OppdaterPersonService(
counterCustomRegistry,
pdlDataConsumer,
errorStatusDecoder,
transactionHelperService
transactionHelperService,
tpsPersonService
);
this.personServiceClient = personServiceClient;
this.mapperFacade = mapperFacade;
Expand Down Expand Up @@ -93,6 +96,8 @@ public void oppdaterPersonAsync(RsDollyUpdateRequest request, Bestilling bestill
.filter(BestillingProgress::isPdlSync)
.flatMap(pdlSync ->
Flux.concat(
tpsPersonService.syncPerson(request, progress, true)
.map(ClientFuture::get),
gjenopprettKlienter(dollyPerson, request,
fase2Klienter(),
progress, true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ public class OpprettPersonerByKriterierService extends DollyBestillingService {
private final PersonServiceClient personServiceClient;
private final MapperFacade mapperFacade;

private final TpsPersonService tpsPersonService;

public OpprettPersonerByKriterierService(
IdentService identService,
BestillingService bestillingService,
Expand All @@ -60,11 +58,11 @@ public OpprettPersonerByKriterierService(
counterCustomRegistry,
pdlDataConsumer,
errorStatusDecoder,
transactionHelperService
transactionHelperService,
tpsPersonService
);
this.personServiceClient = personServiceClient;
this.mapperFacade = mapperFacade;
this.tpsPersonService = tpsPersonService;
}

@Async
Expand Down Expand Up @@ -96,7 +94,7 @@ public void executeAsync(Bestilling bestilling) {
.map(ClientFuture::get)
.filter(BestillingProgress::isPdlSync)
.flatMap(pdlSync -> Flux.concat(
tpsPersonService.syncPerson(dollyPerson, bestKriterier, progress)
tpsPersonService.syncPerson(bestKriterier, progress, true)
.map(ClientFuture::get),
gjenopprettKlienter(dollyPerson, bestKriterier,
fase2Klienter(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import no.nav.dolly.bestilling.ClientRegister;
import no.nav.dolly.bestilling.pdldata.PdlDataConsumer;
import no.nav.dolly.bestilling.personservice.PersonServiceClient;
import no.nav.dolly.bestilling.tpsmessagingservice.service.TpsPersonService;
import no.nav.dolly.domain.jpa.Bestilling;
import no.nav.dolly.domain.jpa.BestillingProgress;
import no.nav.dolly.domain.resultset.RsDollyBestillingRequest;
Expand Down Expand Up @@ -48,7 +49,8 @@ public OpprettPersonerFraIdenterMedKriterierService(
ErrorStatusDecoder errorStatusDecoder,
PdlDataConsumer pdlDataConsumer,
TransactionHelperService transactionHelperService,
PersonServiceClient personServiceClient) {
PersonServiceClient personServiceClient,
TpsPersonService tpsPersonService) {
super(
identService,
bestillingService,
Expand All @@ -57,7 +59,8 @@ public OpprettPersonerFraIdenterMedKriterierService(
counterCustomRegistry,
pdlDataConsumer,
errorStatusDecoder,
transactionHelperService
transactionHelperService,
tpsPersonService
);
this.mapperFacade = mapperFacade;
this.personServiceClient = personServiceClient;
Expand Down Expand Up @@ -94,12 +97,14 @@ public void executeAsync(Bestilling bestilling) {
.map(ClientFuture::get)
.filter(BestillingProgress::isPdlSync)
.flatMap(pdlSync -> Flux.concat(
gjenopprettKlienter(dollyPerson, bestKriterier,
fase2Klienter(),
progress, true),
gjenopprettKlienter(dollyPerson, bestKriterier,
fase3Klienter(),
progress, true))))))
tpsPersonService.syncPerson(bestKriterier, progress, true)
.map(ClientFuture::get),
gjenopprettKlienter(dollyPerson, bestKriterier,
fase2Klienter(),
progress, true),
gjenopprettKlienter(dollyPerson, bestKriterier,
fase3Klienter(),
progress, true))))))
.onErrorResume(throwable -> {
var error = errorStatusDecoder.getErrorText(
WebClientFilter.getStatus(throwable), WebClientFilter.getMessage(throwable));
Expand Down
Loading

0 comments on commit 63cd58c

Please sign in to comment.