-
replace gson by
fastjson
-
using
OkHttp3
, support query retry by customRetryInterceptor
, configuration example:private static final OkHttpClient CLIENT = new OkHttpClient.Builder() .sslSocketFactory(sslSocketFactory(), x509TrustManager())//fix SSLHandshakeException .hostnameVerifier((hostname, session) -> true)//fix SSLPeerUnverifiedException .retryOnConnectionFailure(false) .connectionPool(pool()) .addInterceptor(new RetryInterceptor.Builder().executionCount(3).retryInterval(1000).build()) .connectTimeout(10, TimeUnit.SECONDS) .readTimeout(1, TimeUnit.MINUTES) .writeTimeout(1, TimeUnit.MINUTES) .build();
-
default method provided in
OpenTSDBService
:default String buildUrl(String serviceUrl, String postApiEndPoint, ExpectResponse expectResponse) default String pushDataPointsString(DataPointBuilder builder, ExpectResponse expectResponse) default String pushQueriesString(QueryBuilder builder, ExpectResponse expectResponse) default void asyncPushDataPoints(DataPointBuilder builder, ExpectResponse expectResponse, Callback callback) default QueryResponse pushQueries(QueryBuilder builder, ExpectResponse expectResponse)
@Bean
public OpenTSDBService openTSDBService() {
List<String> openTSDBServerList = configProperties.getOpentsdbServer();
if (CollectionUtils.isEmpty(openTSDBServerList)) {
throw new IllegalArgumentException("empty opentsdb server url");
}
return () -> openTSDBServerList;
}
Apache License, Version 2.0