v5.5.0 - Feedback wanted on QueryTask #1374
Closed
injectives
announced in
Preview features
Replies: 1 comment
-
This API has been graduated to GA status in the 5.8.0 release. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Introduction
Java driver version 5.5.0 introduced a new high-level query execution API. It comes as experimental at this stage, meaning it is subject to more flexible updates than a mature API.
The objective of this API is to provide an opinionated, managed and convenient query execution option. The new API does not require the Result object management and ensures automatic query retries should retryable conditions occur, like a change of leadership in causal cluster. It is not meant to replace nor match all capabilities of lower level APIs.
The new QueryTask class is the central part of this new API. It offers a Fluent style API and is responsible for query setup and managed execution.
Basic usage
The code below illustrates a basis usage of the new API:
The
execute()
method returns an object of a new EagerResult class. This new type contains an in-memory result of executing a Cypher query that has been consumed in full. It's interface is presented below:The example above is functionally similar to the following use of the lower-level API:
Collector support
In addition to the basic usage, it is possible to collect query Records by using a supplied java.util.stream.Collector implementation. Some implementations are available in the java.util.stream.Collectors class.
It is strongly recommended to use Cypher query language capabilities where possible. The examples below just provide a sample usage of the API.
Should access to the Result.keys() and/or ResultSummary values be needed, another method option is available:
Feedback wanted
It would be great to get some feedback on this new API. Please let us know what you think, this includes API suggestions and even just general comments with usage experience.
Beta Was this translation helpful? Give feedback.
All reactions