@InterfaceAudience.Private @InterfaceStability.Evolving public class ReliableSpoolingFileEventReader extends Object implements ReliableEventReader
A ReliableEventReader which reads log data from files stored
 in a spooling directory and renames each file once all of its data has been
 read (through EventDeserializer.readEvent() calls). The user must
 commit() each read, to indicate that the lines have been fully
 processed.
 
Read calls will return no data if there are no files left to read. This class, in general, is not thread safe.
This reader assumes that files with unique file names are left in the spooling directory and not modified once they are placed there. Any user behavior which violates these assumptions, when detected, will result in a FlumeException being thrown.
This class makes the following guarantees, if above assumptions are met:
completedSuffix,
      all of its records have been read through the
      EventDeserializer.readEvent() function and
      commit()ed at least once.
 readEvents(int) caller.
 | Modifier and Type | Class and Description | 
|---|---|
| static class  | ReliableSpoolingFileEventReader.BuilderSpecial builder class for ReliableSpoolingFileEventReader | 
| Modifier and Type | Method and Description | 
|---|---|
| void | close()Clean-up any state associated with this reader. | 
| void | commit()Commit the last lines which were read. | 
| String | getLastFileRead()Return the filename which generated the data from the last successful
  readEvents(int)call. | 
| Event | readEvent()Get the next line associated with the input stream. | 
| List<Event> | readEvents(int numEvents)Get up to  nlines associated with the input stream. | 
public String getLastFileRead()
readEvents(int) call. Returns null if called before any file
 contents are read.public Event readEvent() throws IOException
EventReadernull, the input underlying input source is considered finished.
 Note that this is allowed to block for indefinite amounts of time waiting
 to generate a new line.readEvent in interface EventReaderIOExceptionpublic List<Event> readEvents(int numEvents) throws IOException
EventReadern lines associated with the input stream. If this returns
 less than n lines, the input underlying input source is considered
 finished. Note that this is allowed to block for indefinite amounts of
 time waiting to generate a new line.readEvents in interface EventReaderIOExceptionpublic void close()
           throws IOException
EventReaderclose in interface Closeableclose in interface AutoCloseableclose in interface EventReaderIOExceptionpublic void commit()
            throws IOException
commit in interface ReliableEventReaderIOExceptionCopyright © 2009-2017 Apache Software Foundation. All Rights Reserved.