Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The streaming query API has no possibility to cancel query and to be notified about finished stream #515

Closed
rhajek opened this issue Sep 7, 2018 · 0 comments
Milestone

Comments

@rhajek
Copy link
Contributor

rhajek commented Sep 7, 2018

We have following issues with influxdb-java async query API:

  1. If we are querying large data sets using async query, there is no proper way how to cancel async processing and stop streaming of next chunks.

  2. Current "tricky" implementation of done (all chunks were processed) is not working with MessagePack.

influxDB.query(query, 1_000, result -> {
   if (result.getError().equals(“DONE”)) {
       System.out.println(“All chunks arrived”);
   } else {
       System.out.println(“Processing”);
   }
})

Suggested solution - adding new method with cancelleble BiConsumer and onComplete notification. It will be backward compatible and will also work with msgpack.

 /**
   * Execute a streaming query against a database.
   *
   * @param query
   *            the query to execute.
   * @param chunkSize
   *            the number of QueryResults to process in one chunk.
   * @param onNext
   *            the consumer to invoke for each received QueryResult; with capability to discontinue a streaming query
   * @param onComplete
   *            the onComplete to invoke for successfully end of stream
   */
  public void query(Query query, int chunkSize, BiConsumer<Cancellable, QueryResult> onNext, Runnable onComplete);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants