use of com.treasuredata.client.TDClientBuilder in project fluency by komamitsu.
the class TreasureDataSender method buildClient.
@VisibleForTesting
protected TDClient buildClient() {
URI uri;
try {
uri = new URI(config.getEndpoint());
} catch (URISyntaxException e) {
throw new NonRetryableException(String.format("Invalid endpoint. %s", config.getEndpoint()), e);
}
String host = uri.getHost() != null ? uri.getHost() : config.getEndpoint();
TDClientBuilder builder = new TDClientBuilder(false).setEndpoint(host).setApiKey(config.getApikey()).setRetryLimit(config.getRetryMax()).setRetryInitialIntervalMillis(config.getRetryIntervalMs()).setRetryMaxIntervalMillis(config.getMaxRetryIntervalMs()).setRetryMultiplier(config.getRetryFactor());
if (uri.getScheme() != null && uri.getScheme().equals("http")) {
builder.setUseSSL(false);
}
if (uri.getPort() > 0) {
builder.setPort(uri.getPort());
}
return builder.build();
}
Aggregations