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

Provide a lazy wrapper for QuarkusCqlSession #106

Closed
adutra opened this issue Jun 30, 2020 · 2 comments · Fixed by #127
Closed

Provide a lazy wrapper for QuarkusCqlSession #106

adutra opened this issue Jun 30, 2020 · 2 comments · Fixed by #127
Assignees
Labels
priority:major Imported from JIRA status:done Imported from JIRA type:new-feature Imported from JIRA

Comments

@adutra
Copy link
Contributor

adutra commented Jun 30, 2020

Instead of injecting CompletionStage<QuarkusCqlSession> we could provide a session wrapper so that users can inject QuarkusCqlSession directly and avoid blocking Vertx threads even if they opt out from eager init at startup.

┆Issue is synchronized with this Jira Task by Unito

@adutra adutra added priority:major Imported from JIRA status:open Imported from JIRA type:new-feature Imported from JIRA labels Jun 30, 2020
@adutra
Copy link
Contributor Author

adutra commented Jun 30, 2020

Alternatively we can explore the idea of exposing two beans: CompletionStage<QuarkusCqlSession> and QuarkusCqlSession, something like:

  @Produces
  @ApplicationScoped
  @Unremovable
  public CompletionStage<QuarkusCqlSession> createCassandraClientAsync() {
    ...
    QuarkusCqlSessionBuilder builder =
        new QuarkusCqlSessionBuilder()
            .withMetricRegistry(metricRegistry)
            .withQuarkusEventLoop(mainEventLoop)
            .withConfigLoader(configLoaderBuilder.build());
    return builder.buildAsync();
  }

  @Produces
  @ApplicationScoped
  @Unremovable
  public QuarkusCqlSession createCassandraClient(CompletionStage<QuarkusCqlSession> sessionFuture) {
    return CompletableFutures.getUninterruptibly(sessionFuture);
  }

@adutra
Copy link
Contributor Author

adutra commented Aug 27, 2020

Note that this may be complicated by the presence of mapper/daos, since these components would have to be produced as CompletionStage<...> as well.

@tomekl007 tomekl007 self-assigned this Aug 28, 2020
@tomekl007 tomekl007 linked a pull request Sep 1, 2020 that will close this issue
5 tasks
@adutra adutra added status:done Imported from JIRA and removed status:open Imported from JIRA labels Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:major Imported from JIRA status:done Imported from JIRA type:new-feature Imported from JIRA
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants