public interface ReactiveResultSet extends Publisher<ReactiveRow>
Publisher
of ReactiveRow
s returned by a ReactiveSession
.
By default, all implementations returned by the driver are cold, unicast, single-subscriber only publishers. In other words, they do not support multiple subscriptions; consider caching the results produced by such publishers if you need to consume them by more than one downstream subscriber.
Also, note that reactive result sets may emit items to their subscribers on an internal driver
IO thread. Subscriber implementors are encouraged to abide by Reactive Streams
Specification rule 2.2 and avoid performing heavy computations or blocking calls inside
onNext
calls, as doing so could slow down
the driver and impact performance. Instead, they should asynchronously dispatch received signals
to their processing logic.
This interface exists mainly to expose useful information about request execution and query metadata. This is particularly convenient for queries that do not return rows; for queries that do return rows, it is also possible, and oftentimes easier, to access that same information at row level.
Modifier and Type | Method and Description |
---|---|
Publisher<? extends ColumnDefinitions> |
getColumnDefinitions()
Returns metadata about the columns contained in this result set.
|
Publisher<? extends ExecutionInfo> |
getExecutionInfos()
Returns information about the execution of all requests that have
been performed so far to assemble this result set.
|
Publisher<Boolean> |
wasApplied()
If the query that produced this result was a conditional update, indicates whether it was
successfully applied.
|
@NonNull Publisher<? extends ColumnDefinitions> getColumnDefinitions()
This publisher emits exactly one item as soon as the first response arrives, then completes. If the query execution fails within the first request-response cycle, then this publisher will fail with the same error; however if the error happens after the first response, then this publisher will be already completed and will not acknowledge that error in any way.
By default, publishers returned by this method do not support multiple subscriptions.
ReactiveRow.getColumnDefinitions()
@NonNull Publisher<? extends ExecutionInfo> getExecutionInfos()
If the query is not paged, this publisher will emit exactly one item as soon as the response arrives, then complete. If the query is paged, it will emit multiple items, one per page; then it will complete when the last page arrives. If the query execution fails, then this publisher will fail with the same error.
By default, publishers returned by this method do not support multiple subscriptions.
ReactiveRow.getExecutionInfo()
@NonNull Publisher<Boolean> wasApplied()
This publisher emits exactly one item as soon as the first response arrives, then completes. If the query execution fails within the first request-response cycle, then this publisher will fail with the same error; however if the error happens after the first response, then this publisher will be already completed and will not acknowledge that error in any way.
By default, publishers returned by this method do not support multiple subscriptions.
For consistency, this method always returns true
for non-conditional queries
(although there is no reason to call the method in that case). This is also the case for
conditional DDL statements (CREATE KEYSPACE... IF NOT EXISTS
, CREATE TABLE... IF
NOT EXISTS
), for which Cassandra doesn't return an [applied]
column.
Note that, for versions of Cassandra strictly lower than 2.1.0-rc2, a server-side bug (CASSANDRA-7337) causes this
method to always return true
for batches containing conditional queries.
ReactiveRow.wasApplied()
Copyright © 2017–2019. All rights reserved.