public class CsvFileSampleSource extends AbstractSampleSource
SampleConsumer
s.results.csv
is the source file name then
results
is the root file name.CsvFileSampleSource
looks for all the files in the same
directory of the main source file that have the same root file nameresults.csv
,
results-1.csv
, results-2.csv
, etc. then all
these files will be read and produced on their corresponding channels.results-1.csv
then it will
be produced on the channel 1.results-2.csv
then it will
be produced on the channel 2.results.csv
then it will
be produced on the channel 0.Modifier and Type | Field and Description |
---|---|
static String |
SOURCE_FILE_ATTRIBUTE
File name whose sample are being produced on the channel
|
Constructor and Description |
---|
CsvFileSampleSource(File inputFile,
char separator)
Build a sample source from the specified input file and character
separator.
|
Modifier and Type | Method and Description |
---|---|
void |
addSampleConsumer(SampleConsumer consumer)
Add a sample consumer to this sample source.
|
void |
removeSampleConsumer(SampleConsumer consumer)
Remove a sample consumer from this sample source.
|
void |
run()
Run this sample source.
|
void |
setSampleConsumers(List<SampleConsumer> consumers)
Sets the specified sample consumers that will consume samples produced by
this sample source.
|
getSampleContext, setSampleContext
public static final String SOURCE_FILE_ATTRIBUTE
public CsvFileSampleSource(File inputFile, char separator)
inputFile
- The input sample file (CSV file) (must not be null
)separator
- The character separator to be used for delimiting samples
columnspublic void setSampleConsumers(List<SampleConsumer> consumers)
SampleSource
setSampleConsumers
in interface SampleSource
setSampleConsumers
in class AbstractSampleSource
consumers
- consumers to be setpublic void addSampleConsumer(SampleConsumer consumer)
SampleSource
addSampleConsumer
in interface SampleSource
addSampleConsumer
in class AbstractSampleSource
consumer
- consumer to be addedpublic void removeSampleConsumer(SampleConsumer consumer)
SampleSource
removeSampleConsumer
in interface SampleSource
removeSampleConsumer
in class AbstractSampleSource
consumer
- consumer to be removedpublic void run()
run
in interface Runnable
run
in class AbstractSampleSource
Copyright © 1998-2016 Apache Software Foundation. All Rights Reserved.