com.signalfuse.metrics.connection.HttpDataPointProtobufReceiverFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of signalfuse-java Show documentation
Show all versions of signalfuse-java Show documentation
Bare minimum core library needed to sending metrics to SignalFuse from Java clients
package com.signalfuse.metrics.connection;
import org.apache.http.conn.HttpClientConnectionManager;
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
import com.signalfuse.endpoint.SignalFuseReceiverEndpoint;
import com.signalfuse.metrics.SignalfuseMetricsException;
public class HttpDataPointProtobufReceiverFactory implements DataPointReceiverFactory {
public static final int DEFAULT_TIMEOUT_MS = 2000;
public static final int DEFAULT_VERSION = 2;
private final SignalFuseReceiverEndpoint endpoint;
private HttpClientConnectionManager httpClientConnectionManager =
new BasicHttpClientConnectionManager();
private int timeoutMs = DEFAULT_TIMEOUT_MS;
private int version = DEFAULT_VERSION;
public HttpDataPointProtobufReceiverFactory(SignalFuseReceiverEndpoint endpoint) {
this.endpoint = endpoint;
}
public HttpDataPointProtobufReceiverFactory setTimeoutMs(int timeoutMs) {
this.timeoutMs = timeoutMs;
return this;
}
public HttpDataPointProtobufReceiverFactory setVersion(int version) {
this.version = version;
return this;
}
public void setHttpClientConnectionManager(
HttpClientConnectionManager httpClientConnectionManager) {
this.httpClientConnectionManager = httpClientConnectionManager;
}
@Override
public DataPointReceiver createDataPointReceiver() throws
SignalfuseMetricsException {
if (version == 1) {
return new HttpDataPointProtobufReceiverConnection(endpoint, this.timeoutMs, httpClientConnectionManager);
} else {
return new HttpDataPointProtobufReceiverConnectionV2(endpoint, this.timeoutMs, httpClientConnectionManager);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy