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 the close() method doesn't get forgotten, which is easy to do if this gets passed around as an Iterator. Note that close() doesn't cut the stream of rows for Firehose users immediately, but rather stops the supply of new rows into internal buffers. hasMore() and nextRow() are expected to operate for some time after (or concurrently with) close() until the buffered events (if any) run out. Concurrency: The two methods hasMore() and nextRow() are all called from the same thread. close() might be called concurrently from a thread different from the thread calling hasMore() and nextRow().

    • 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 via nextRow(). 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 an InputRowListPlusRawValues 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