Package org.apache.kafka.tools.api
Interface RecordReader
- All Superinterfaces:
AutoCloseable
,Closeable
,Configurable
Typical implementations of this interface convert data from an `InputStream` received via `readRecords` into a
iterator of `ProducerRecord` instance. Note that implementations must have a public nullary constructor.
This is used by the `kafka.tools.ConsoleProducer`.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
close()
Closes this reader.default void
Configure this class with the given key-value pairsIterator<ProducerRecord<byte[],
byte[]>> readRecords
(InputStream inputStream) read byte array from input stream and then generate an iterator of producer record
-
Method Details
-
configure
Description copied from interface:Configurable
Configure this class with the given key-value pairs- Specified by:
configure
in interfaceConfigurable
-
readRecords
read byte array from input stream and then generate an iterator of producer record- Returns:
- an iterator of producer record. It should implement following rules. 1) the hasNext() method must be idempotent. 2) the convert error should be thrown by next() method.
-
close
default void close()Closes this reader. This method is invoked if the iterator from readRecords either has no more records or throws exception.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-