Package io.confluent.ksql.api.client
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 ifisFailed()
is true.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<String>
columnNames()
Returns column names for these results.List<ColumnType>
columnTypes()
Returns column types for these results.boolean
isComplete()
Returns whether theStreamedQueryResult
is complete.boolean
isFailed()
Returns whether theStreamedQueryResult
is failed.Row
poll()
Returns the next row.Row
poll(Duration timeout)
Returns the next row.String
queryID()
Returns the ID of the underlying query if the query is a push query.
-
-
-
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 theStreamedQueryResult
is complete.A
StreamedQueryResult
is complete if the HTTP connection associated with this query has been ended gracefully. Once complete, theStreamedQueryResult
will continue to deliver any remaining rows, then callonComplete()
on the subscriber, if present.- Returns:
- whether the
StreamedQueryResult
is complete.
-
isFailed
boolean isFailed()
Returns whether theStreamedQueryResult
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 existingpoll()
calls will return null, and new calls topoll()
andsubscribe()
will be rejected.- Returns:
- whether the
StreamedQueryResult
is failed.
-
-