io.deepsense.neptune.clientlibrary.config.internal.FileBasedInternalConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neptune-client-library Show documentation
Show all versions of neptune-client-library Show documentation
Enables integration with Neptune in your Java code
/**
* Copyright (c) 2016, CodiLime Inc.
*/
package io.deepsense.neptune.clientlibrary.config.internal;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
public class FileBasedInternalConfiguration implements InternalConfiguration {
private final ChannelValueBufferConfiguration channelValueBufferConfiguration;
private final ChannelValueSendingThreadConfiguration channelValueSendingThreadConfiguration;
private final RequestRetryConfiguration requestRetryStrategyConfiguration;
public FileBasedInternalConfiguration() {
Config conf = ConfigFactory.load();
channelValueBufferConfiguration = new ChannelValueBufferConfiguration(
conf.getInt("channelValueBuffer.maxPackageCount"),
conf.getDouble("channelValueBuffer.maxBatchSizeAsFractionOfRequestSize"),
conf.getLong("channelValueBuffer.minIntervalBetweenSends")
);
channelValueSendingThreadConfiguration = new ChannelValueSendingThreadConfiguration(
conf.getInt("channelValueSendingThread.queueSize")
);
requestRetryStrategyConfiguration = new RequestRetryConfiguration(
conf.getBoolean("requestRetry.isRetryingTurnedOn"),
conf.getLong("requestRetry.maxTimeoutBetweenRequestsInMillis")
);
}
@Override
public ChannelValueBufferConfiguration getChannelValueBufferConfiguration() {
return channelValueBufferConfiguration;
}
@Override
public ChannelValueSendingThreadConfiguration getChannelValueSendingThreadConfiguration() {
return channelValueSendingThreadConfiguration;
}
@Override
public RequestRetryConfiguration getRequestRetryStrategy() {
return requestRetryStrategyConfiguration;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy