com.epam.reportportal.log.LogProcessing Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of service-jobs Show documentation
Show all versions of service-jobs Show documentation
EPAM Report portal. Service jobs
package com.epam.reportportal.log;
import com.epam.reportportal.calculation.BatchProcessing;
import com.epam.reportportal.elastic.ElasticSearchClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.concurrent.DefaultManagedTaskScheduler;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* Batch processing for log.
* @author Maksim Antonov
*/
@Component
@ConditionalOnProperty(prefix = "rp.elasticsearch", name = "host")
public class LogProcessing extends BatchProcessing {
private final ElasticSearchClient elasticSearchClient;
public LogProcessing(ElasticSearchClient elasticSearchClient,
@Value("${rp.processing.log.maxBatchSize}") int batchSize,
@Value("${rp.processing.log.maxBatchTimeout}") int timeout) {
super(batchSize, timeout, new DefaultManagedTaskScheduler());
this.elasticSearchClient = elasticSearchClient;
}
@Override
protected void process(List logMessageList) {
if (!CollectionUtils.isEmpty(logMessageList)) {
elasticSearchClient.save(logMessageList);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy