/** * IOC constructor. * * @param config the configuration for this druid service * @param asyncHttpClient the HTTP client * @param mapper A shared jackson object mapper resource * @param headersToAppend Supplier for map of headers for Druid requests * @param jsonNodeBuilderStrategy A function to build JSON nodes from the response */ public AsyncDruidWebServiceImpl( DruidServiceConfig config, AsyncHttpClient asyncHttpClient, ObjectMapper mapper, Supplier<Map<String, String>> headersToAppend, Function<Response, JsonNode> jsonNodeBuilderStrategy ) { this.serviceConfig = config; if (serviceConfig.getUrl() == null) { String msg = DRUID_URL_INVALID.format(config.getNameAndUrl()); LOG.error(msg); throw new IllegalStateException(msg); } LOG.info("Configured with druid server config: {}", config.toString()); this.headersToAppend = headersToAppend; this.webClient = asyncHttpClient; this.writer = mapper.writer(); this.httpErrorMeter = REGISTRY.meter("druid.errors.http"); this.exceptionMeter = REGISTRY.meter("druid.errors.exceptions"); this.jsonNodeBuilderStrategy = jsonNodeBuilderStrategy; }