Package org.apache.druid.data.input
Interface Firehose
-
- All Superinterfaces:
AutoCloseable
,Closeable
@Deprecated public interface Firehose extends Closeable
Deprecated.This is an interface that holds onto the stream of incoming data. Realtime data ingestion is built around this abstraction. This object acts a lot like an Iterator, but it doesn't extend the Iterator interface because it extends Closeable and it is very important that theclose()
method doesn't get forgotten, which is easy to do if this gets passed around as an Iterator. Note thatclose()
doesn't cut the stream of rows for Firehose users immediately, but rather stops the supply of new rows into internal buffers.hasMore()
andnextRow()
are expected to operate for some time after (or concurrently with)close()
until the buffered events (if any) run out. Concurrency: The two methodshasMore()
andnextRow()
are all called from the same thread.close()
might be called concurrently from a thread different from the thread callinghasMore()
andnextRow()
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
close()
Deprecated.boolean
hasMore()
Deprecated.Returns whether there are more rows to process.InputRow
nextRow()
Deprecated.The next row available.default InputRowListPlusRawValues
nextRowWithRaw()
Deprecated.
-
-
-
Method Detail
-
hasMore
boolean hasMore() throws IOException
Deprecated.Returns whether there are more rows to process. This is used to indicate that another item is immediately available vianextRow()
. Thus, if the stream is still available but there are no new messages on it, this call should block until a new message is available. If something happens such that the stream is no longer available, this should return false.- Returns:
- true if and when there is another row available, false if the stream has dried up
- Throws:
IOException
-
nextRow
@Nullable InputRow nextRow() throws IOException
Deprecated.The next row available. Should only be called if hasMore returns true. The return value can be null which means the caller must skip this row.- Returns:
- The next row
- Throws:
IOException
-
nextRowWithRaw
@Deprecated default InputRowListPlusRawValues nextRowWithRaw() throws IOException
Deprecated.Returns anInputRowListPlusRawValues
object containing the InputRow plus the raw, unparsed data corresponding to the next row available. Used in the sampler to provide the caller with information to assist in configuring a parse spec. If a ParseException is thrown by the parser, it should be caught and returned in the InputRowListPlusRawValues so we will be able to provide information on the raw row which failed to be parsed. Should only be called if hasMore returns true.- Returns:
- an InputRowListPlusRawValues which may contain any of: an InputRow, map of the raw data, or a ParseException
- Throws:
IOException
-
close
void close() throws IOException
Deprecated.Closes the "ingestion side" of the Firehose, potentially concurrently with calls tohasMore()
andnextRow()
being made from a different thread.hasMore()
andnextRow()
continue to work after close(), but since the ingestion side is closed rows will eventually run out.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-