Search in sources :

Example 1 with LoggingMetricConsumer

use of com.adobe.target.edge.client.http.LoggingMetricConsumer in project target-java-sdk by adobe.

the class DefaultGeoClient method start.

public void start(ClientConfig clientConfig) {
    this.geoUrl = "https://" + clientConfig.getOnDeviceConfigHostname() + GEO_PATH;
    unirestInstance.config().socketTimeout(clientConfig.getSocketTimeout()).connectTimeout(clientConfig.getConnectTimeout()).concurrency(clientConfig.getMaxConnectionsTotal(), clientConfig.getMaxConnectionsPerHost()).automaticRetries(clientConfig.isEnabledRetries()).enableCookieManagement(false);
    if (clientConfig.isLogRequestStatus()) {
        unirestInstance.config().instrumentWith(new TargetMetrics(new LoggingMetricConsumer()));
    }
    if (clientConfig.isProxyEnabled()) {
        ClientProxyConfig proxyConfig = clientConfig.getProxyConfig();
        if (proxyConfig.isAuthProxy()) {
            unirestInstance.config().proxy(proxyConfig.getHost(), proxyConfig.getPort(), proxyConfig.getUsername(), proxyConfig.getPassword());
        } else {
            unirestInstance.config().proxy(proxyConfig.getHost(), proxyConfig.getPort());
        }
    }
}
Also used : ClientProxyConfig(com.adobe.target.edge.client.ClientProxyConfig) TargetMetrics(com.adobe.target.edge.client.http.TargetMetrics) LoggingMetricConsumer(com.adobe.target.edge.client.http.LoggingMetricConsumer)

Aggregations

ClientProxyConfig (com.adobe.target.edge.client.ClientProxyConfig)1 LoggingMetricConsumer (com.adobe.target.edge.client.http.LoggingMetricConsumer)1 TargetMetrics (com.adobe.target.edge.client.http.TargetMetrics)1