Commit 5ae9f7a0 authored by Evgeni Sladkovskii's avatar Evgeni Sladkovskii

added restclient error handling

parent 4af17804
package nl.trifork.axondbbackupclient.axondb_client;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import nl.trifork.axondbbackupclient.BackupConfig;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
......@@ -13,6 +14,7 @@ import static org.springframework.http.HttpMethod.POST;
@Service
@RequiredArgsConstructor
@Slf4j
public class AxonDbRestClient {
private final RestTemplate restTemplate;
......@@ -27,8 +29,13 @@ public class AxonDbRestClient {
}
private String[] getReadySegments(String url) {
ResponseEntity<String[]> segments = restTemplate.exchange(url, GET, reqEntity(), String[].class);
return segments.getBody();
try {
ResponseEntity<String[]> segments = restTemplate.exchange(url, GET, reqEntity(), String[].class);
return segments.getBody();
} catch (RuntimeException e) {
log.error("Failed to get ready segments on {}", url, e);
return new String[0];
}
}
public String createControlDbDump() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment