Interface StreamedQueryResult

  • All Superinterfaces:
    org.reactivestreams.Publisher<Row>

    public interface StreamedQueryResult
    extends org.reactivestreams.Publisher<Row>
    The result of a query (push or pull), streamed one row at time. Records may be consumed by either subscribing to the publisher or polling (blocking) for one record at a time. These two methods of consumption are mutually exclusive; only one method may be used (per StreamedQueryResult).

    The subscribe() method cannot be called if isFailed() is true.

    • Method Detail

      • columnNames

        List<String> columnNames()
        Returns column names for these results.
        Returns:
        the column names.
      • columnTypes

        List<ColumnType> columnTypes()
        Returns column types for these results.
        Returns:
        the column types.
      • queryID

        String queryID()
        Returns the ID of the underlying query if the query is a push query. Else, returns null.
        Returns:
        the query ID
      • poll

        Row poll()
        Returns the next row. Blocks until one is available or the underlying query is terminated (either gracefully or because of an error).
        Returns:
        the row, or null if the query was terminated.
      • poll

        Row poll​(Duration timeout)
        Returns the next row. Blocks until one is available, the specified timeout has elapsed, or the underlying query is terminated (either gracefully or because of an error).
        Parameters:
        timeout - amount of time to wait for a row. A non-positive value will cause this method to block until a row is received or the query is terminated.
        Returns:
        the row, or null if the timeout elapsed or the query was terminated.
      • isComplete

        boolean isComplete()
        Returns whether the StreamedQueryResult is complete.

        A StreamedQueryResult is complete if the HTTP connection associated with this query has been ended gracefully. Once complete, the StreamedQueryResult will continue to deliver any remaining rows, then call onComplete() on the subscriber, if present.

        Returns:
        whether the StreamedQueryResult is complete.
      • isFailed

        boolean isFailed()
        Returns whether the StreamedQueryResult is failed.

        A StreamedQueryResult is failed if an error is received from the server. Once failed, onError() is called on the subscriber, if present, any existing poll() calls will return null, and new calls to poll() and subscribe() will be rejected.

        Returns:
        whether the StreamedQueryResult is failed.