...
Jira | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Medium article
Issues & Decisions
# | Issue | Notes | Decision |
---|---|---|---|
1 |
Overview
As specified in the Jira ticket the replacement of RestTemplate became neccessary due the fact that it is not under development anymore and also because it does not support basic function required in the modern dev world such as async calls.
...
Example async call with subscribing
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
public Mono<String> httpOperationWithJsonData(final HttpMethod httpMethod, final String resourceUrl, final String jsonData, final HttpHeaders httpHeaders) { return webClient .get() .uri(resourceUrl) .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) .retrieve() .onStatus(HttpStatus::is4xxClientError, error -> Mono.error(new RuntimeException("API not found"))) .onStatus(HttpStatus::is5xxServerError, error -> Mono.error(new RuntimeException("Server is not responding"))) .bodyToMono(String.class); } |
...