-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor ImportService and update reactive dependencies #deploy-organ…
…isasjon-forvalter Simplified `ImportService` logic by removing redundant methods and using reactive streams. Replaced `commands` library with `reactive-core` to enhance error handling and logging across services. Updated `GenererNavnServiceConsumer` and related classes to improve efficiency with non-blocking calls.
- Loading branch information
Showing
15 changed files
with
121 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...alter/src/main/java/no/nav/organisasjonforvalter/consumer/command/GenererNavnCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package no.nav.organisasjonforvalter.consumer.command; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import no.nav.testnav.libs.dto.generernavnservice.v1.NavnDTO; | ||
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; | ||
import reactor.core.publisher.Mono; | ||
import reactor.util.retry.Retry; | ||
|
||
import java.time.Duration; | ||
import java.util.concurrent.Callable; | ||
|
||
@RequiredArgsConstructor | ||
public class GenererNavnCommand implements Callable<Flux<NavnDTO>> { | ||
|
||
private final WebClient webClient; | ||
private final Integer antall; | ||
private final String accessToken; | ||
|
||
@Override | ||
public Flux<NavnDTO> call() { | ||
return webClient | ||
.get() | ||
.uri(builder -> builder | ||
.path("/api/v1/navn") | ||
.queryParam("antall", antall) | ||
.build()) | ||
.header(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken) | ||
.retrieve() | ||
.bodyToFlux(NavnDTO.class) | ||
.doOnError(WebClientFilter::logErrorMessage) | ||
.retryWhen(Retry.backoff(3, Duration.ofSeconds(5)) | ||
.filter(WebClientFilter::is5xxException)) | ||
.onErrorResume(throwable -> Mono.empty()); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...er/src/main/java/no/nav/organisasjonforvalter/consumer/command/MiljoerServiceCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.