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

Asynchronous fetching for queries #178

Closed
lvca opened this issue Oct 30, 2021 Discussed in #177 · 0 comments
Closed

Asynchronous fetching for queries #178

lvca opened this issue Oct 30, 2021 Discussed in #177 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@lvca
Copy link
Contributor

lvca commented Oct 30, 2021

Discussed in #177

Originally posted by lvca October 29, 2021
ArcadeDB provides the powerful db.async().command() API to execute a command asynchronously. Unfortunately, the callback has only onOk(Resultset) and onError() but it would be nice having callbacks per single result of the result set. This makes easier integration with reactive frameworks like RxJava.

The proposal is to enrich AsyncResultsetCallback by adding additional method to support both one time call onStart(resultset) and per result with onNext(Result) and onComplete() when done.

public interface AsyncResultsetCallback {
  /**
   * Invoked as soon as the command has been executed.
   *
   * @param resultset Resultset to fetch
   */
  void onStart(ResultSet resultset);

  /**
   * Invoked per single result in the result set.
   *
   * @return true to continue fetching otherwise false. If false is returned, the fetching stops and the {@link #onComplete()} method is never invoked.
   */
  boolean onNext(Result result);

  /**
   * Invoked when the fetching of the entire result set has been completed.
   */
  void onComplete();

  /**
   * Invoked in case of an error in the execution or fetching of the result set.
   *
   * @param exception The exception caught
   */
  void onError(Exception exception);
}
@lvca lvca added the enhancement New feature or request label Oct 30, 2021
@lvca lvca added this to the 21.11.1 milestone Oct 30, 2021
@lvca lvca self-assigned this Oct 30, 2021
lvca added a commit that referenced this issue Oct 30, 2021
lvca added a commit that referenced this issue Oct 30, 2021
@lvca lvca closed this as completed Oct 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant