use of org.komamitsu.fluency.fluentd.ingester.FluentdIngester in project fluency by komamitsu.
the class FluencyTestWithMockServer method testFluencyUsingAsyncFlusher.
@ParameterizedTest
@MethodSource("optionsProvider")
void testFluencyUsingAsyncFlusher(final Options options) throws Exception {
testFluencyBase(localPorts -> {
FluentdSender sender;
int fluentdPort = localPorts.get(0);
if (options.failover) {
int secondaryFluentdPort = localPorts.get(1);
if (options.sslEnabled) {
sender = getDoubleSSLSender(fluentdPort, secondaryFluentdPort);
} else {
sender = getDoubleTCPSender(fluentdPort, secondaryFluentdPort);
}
} else {
if (options.sslEnabled) {
sender = getSingleSSLSender(fluentdPort);
} else {
sender = getSingleTCPSender(fluentdPort);
}
}
FluentdIngester.Config ingesterConfig = new FluentdIngester.Config();
if (options.ackResponse) {
ingesterConfig.setAckResponseMode(true);
}
Buffer.Config bufferConfig = new Buffer.Config();
if (options.smallBuffer) {
bufferConfig.setChunkRetentionSize(SMALL_BUF_SIZE);
bufferConfig.setMaxBufferSize(SMALL_BUF_SIZE + 1);
}
if (options.fileBackup) {
bufferConfig.setFileBackupDir(TMPDIR);
bufferConfig.setFileBackupPrefix("testFluencyUsingAsyncFlusher" + options.hashCode());
}
if (options.jvmHeap) {
bufferConfig.setJvmHeapBufferMode(true);
}
Flusher.Config flusherConfig = new Flusher.Config();
flusherConfig.setWaitUntilBufferFlushed(10);
flusherConfig.setWaitUntilTerminated(10);
Buffer buffer = new Buffer(bufferConfig, new FluentdRecordFormatter(new FluentdRecordFormatter.Config()));
Flusher flusher = new Flusher(flusherConfig, buffer, new FluentdIngester(ingesterConfig, sender));
return new Fluency(buffer, flusher);
}, options);
}
use of org.komamitsu.fluency.fluentd.ingester.FluentdIngester in project fluency by komamitsu.
the class FluencyBuilderForFluentd method buildIngester.
private Ingester buildIngester(FluentdSender baseSender) {
ExponentialBackOffRetryStrategy.Config retryStrategyConfig = new ExponentialBackOffRetryStrategy.Config();
if (getSenderMaxRetryCount() != null) {
retryStrategyConfig.setMaxRetryCount(getSenderMaxRetryCount());
}
if (getSenderBaseRetryIntervalMillis() != null) {
retryStrategyConfig.setBaseIntervalMillis(getSenderBaseRetryIntervalMillis());
}
if (getSenderMaxRetryIntervalMillis() != null) {
retryStrategyConfig.setMaxIntervalMillis(getSenderMaxRetryIntervalMillis());
}
RetryableSender.Config senderConfig = new RetryableSender.Config();
if (getErrorHandler() != null) {
senderConfig.setErrorHandler(getErrorHandler());
}
RetryableSender retryableSender = new RetryableSender(senderConfig, baseSender, new ExponentialBackOffRetryStrategy(retryStrategyConfig));
FluentdIngester.Config ingesterConfig = new FluentdIngester.Config();
ingesterConfig.setAckResponseMode(isAckResponseMode());
return new FluentdIngester(ingesterConfig, retryableSender);
}
Aggregations