public class NewtsWriter extends Object implements com.lmax.disruptor.WorkHandler<SampleBatchEvent>, org.springframework.beans.factory.DisposableBean
SampleRepository.
Calls to #insert() publish the samples to a ring buffer so
that they don't block while the data is being persisted.| Constructor and Description |
|---|
NewtsWriter(Integer maxBatchSize,
Integer ringBufferSize,
Integer numWriterThreads,
com.codahale.metrics.MetricRegistry registry) |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy() |
void |
index(List<org.opennms.newts.api.Sample> samples) |
void |
insert(List<org.opennms.newts.api.Sample> samples) |
void |
onEvent(SampleBatchEvent event) |
void |
setIndexer(org.opennms.newts.api.search.Indexer indexer) |
void |
setSampleRepository(org.opennms.newts.api.SampleRepository sampleRepository) |
@Inject
public NewtsWriter(@Named(value="newts.max_batch_size")
Integer maxBatchSize,
@Named(value="newts.ring_buffer_size")
Integer ringBufferSize,
@Named(value="newts.writer_threads")
Integer numWriterThreads,
@Named(value="newtsMetricRegistry")
com.codahale.metrics.MetricRegistry registry)
public void destroy()
throws Exception
destroy in interface org.springframework.beans.factory.DisposableBeanExceptionpublic void insert(List<org.opennms.newts.api.Sample> samples)
public void index(List<org.opennms.newts.api.Sample> samples)
public void onEvent(SampleBatchEvent event) throws Exception
onEvent in interface com.lmax.disruptor.WorkHandler<SampleBatchEvent>Exceptionpublic void setSampleRepository(org.opennms.newts.api.SampleRepository sampleRepository)
public void setIndexer(org.opennms.newts.api.search.Indexer indexer)
Copyright © 2022. All rights reserved.