Class InternalReactiveResult
- All Implemented Interfaces:
ReactiveResult
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.reactivestreams.Publisher<ResultSummary>
consume()
Returns a cold publisher of result summary which arrives after all records.org.reactivestreams.Publisher<Boolean>
isOpen()
Determine if result is open.keys()
Returns a list of keys.org.reactivestreams.Publisher<Record>
records()
Returns a cold unicast publisher of records.
-
Constructor Details
-
InternalReactiveResult
-
-
Method Details
-
keys
Description copied from interface:ReactiveResult
Returns a list of keys.- Specified by:
keys
in interfaceReactiveResult
- Returns:
- a list of keys.
-
records
Description copied from interface:ReactiveResult
Returns a cold unicast publisher of records.When the record publisher is subscribed, the query is executed and the result is streamed back as a record stream followed by a result summary. This record publisher publishes all records in the result and signals the completion. However, before completion or error reporting if any, a cleanup of result resources such as network connection will be carried out automatically.
Therefore, the
Subscriber
of this record publisher shall wait for the termination signal (complete or error) to ensure that the resources used by this result are released correctly. Then the session is ready to be used to run more queries.Cancelling of the record streaming will immediately terminate the propagation of new records. But it will not cancel query execution on the server. When the execution is finished, the
Subscriber
will be notified with a termination signal (complete or error).The record publishing event by default runs in a Network IO thread, as a result no blocking operation is allowed in this thread. Otherwise, network IO might be blocked by application logic.
This publisher can only be subscribed by one
Subscriber
once.If this publisher is subscribed after
ReactiveResult.keys()
, then the publishing of records is carried out after the arrival of keys. If this publisher is subscribed afterReactiveResult.consume()
, then aResultConsumedException
will be thrown.- Specified by:
records
in interfaceReactiveResult
- Returns:
- a cold unicast publisher of records.
-
consume
Description copied from interface:ReactiveResult
Returns a cold publisher of result summary which arrives after all records.Subscribing the summary publisher results in the execution of the query followed by the result summary being returned. The summary publisher cancels record publishing if not yet subscribed and directly streams back the summary on query execution completion. As a result, the invocation of
ReactiveResult.records()
after this method, would receive anResultConsumedException
.If subscribed after
ReactiveResult.keys()
, then the result summary will be published after the query execution without streaming any record to client. If subscribed afterReactiveResult.records()
, then the result summary will be published after the query execution and the streaming of records.Usually, this method shall be chained after
ReactiveResult.records()
to ensure that all records are processed before summary.This method can be subscribed multiple times. When the summary arrives, it will be buffered locally for all subsequent calls.
- Specified by:
consume
in interfaceReactiveResult
- Returns:
- a cold publisher of result summary which only arrives after all records.
-
isOpen
Description copied from interface:ReactiveResult
Determine if result is open.Result is considered to be open if it has not been consumed (
ReactiveResult.consume()
) and its creator object (e.g. session or transaction) has not been closed (including committed or rolled back).Attempts to access data on closed result will produce
ResultConsumedException
.- Specified by:
isOpen
in interfaceReactiveResult
- Returns:
- a publisher emitting
true
if result is open andfalse
otherwise.
-