package builder; public class HttpClientConfig { // Director method 1: a health check probe — short timeout, no retries public HttpRequest buildHealthCheck(String baseUrl) { return new HttpRequest.Builder() .url(baseUrl + "/health") .method("GET") .timeoutMs(2_000) // fast fail for health checks .maxRetries(0) .build(); } // Director method 2: a resilient POST with standard JSON headers and retries public HttpRequest buildResilientPost(String url, String jsonBody) { return new HttpRequest.Builder() .url(url) .method("POST") .body(jsonBody) .header("Content-Type", "application/json") .header("Accept", "application/json") .timeoutMs(15_000) .maxRetries(3) .build(); } }