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

AsyncPool, AsyncConnectionPoolSupport are nowhere to be found #739

Closed
fabienrenaud opened this issue Mar 21, 2018 · 3 comments
Closed

AsyncPool, AsyncConnectionPoolSupport are nowhere to be found #739

fabienrenaud opened this issue Mar 21, 2018 · 3 comments
Labels
type: bug A general bug
Milestone

Comments

@fabienrenaud
Copy link

Official documentation says there are no dependency required to implement async connection pooling with lettuce.

RedisClusterClient clusterClient = RedisClusterClient.create(RedisURI.create(host, port));

AsyncPool<StatefulRedisConnection<String, String>> pool = AsyncConnectionPoolSupport.createBoundedObjectPool(
        () -> clusterClient.connectAsync(StringCodec.UTF8), BoundedPoolConfig.create());

// execute work
CompletableFuture<String> setResult = pool.acquire().thenCompose(connection -> {

    RedisAsyncCommands<String, String> async = connection.async();

    async.set("key", "value");
    return async.async.set("key2", "value2").whenComplete((s, throwable) -> pool.release(c));
});

// terminating
pool.closeAsync();

// after pool completion
client.shutdownAsync();

I copied that code with lettuce 4 and 5 but AsyncPool, AsyncConnectionPoolSupport, BoundedPoolConfig are nowhere to be found. The closest thing I found was io.lettuce.core.support.ConnectionPoolSupport but its methods are very different from the docs.

Only synchronous connection pooling has a dependency on commons-pool2 according to the docs.

Which is it?

@mp911de
Copy link
Collaborator

mp911de commented Mar 22, 2018

The mentioned documentation reference originates from snapshot builds which built from version 5.1.0 (branch 5.x). 5.1.0 is not yet released therefore you can't find non-blocking pooling in 5.0.2.RELEASE. Non-blocking pooling was implemented with #631 for the 5.x line only as Lettuce 4.x does not provide asynchronous connect methods.

ConnectionPoolSupport is the blocking pooling implementation based on commons-pool2.

@mp911de mp911de added for: stackoverflow A question that is better suited to stackoverflow.com status: waiting-for-feedback We need additional information before we can continue labels Mar 22, 2018
@fabienrenaud
Copy link
Author

I noticed that right after posting this issue yesterday so I checked the release docs too but they are identical: https://lettuce.io/core/release/reference/#connection-pooling.asynchronous.usage ...

@mp911de
Copy link
Collaborator

mp911de commented Mar 23, 2018

I adjusted the documentation. All Lettuce 5 builds include content from the Wiki which isn't specific to a version. The docs however mention:

Asynchronous/Non-Blocking via a Lettuce-specific pool implementation (since version 5.1)

@mp911de mp911de added type: bug A general bug and removed status: waiting-for-feedback We need additional information before we can continue for: stackoverflow A question that is better suited to stackoverflow.com labels Mar 23, 2018
@mp911de mp911de modified the milestones: Lettuce 5.1.0, Lettuce 5.0.3 Mar 23, 2018
@mp911de mp911de closed this as completed Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants