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

Cluster API does not implement the Geo commands interface #154

Closed
IdanFridman opened this issue Nov 18, 2015 · 5 comments
Closed

Cluster API does not implement the Geo commands interface #154

IdanFridman opened this issue Nov 18, 2015 · 5 comments
Labels
type: bug A general bug
Milestone

Comments

@IdanFridman
Copy link

I am trying to figure out how to use the geolocation async cluster client of your library.

before geolocation I used it this way:

RedisClient client = new RedisClient(REDIS_HOST, REDIS_PORT);
RedisGeoAsyncCommands<String, String> geoAsyncCommand = client.connect().async();;

.....

I cant figure out how to do it using the RedisClusterClient. Tried this:

RedisClusterClient clusterClient = new RedisClusterClient(new RedisURI(REDIS_HOST,REDIS_PORT,60, TimeUnit.SECONDS));

//doesnt compile
geoAsyncCommand = clusterClient.connect().async();
//

the async client return RedisAdvancedClusterAsyncCommands which RedisGeoAsyncCommands doesnt support

Thanks,
Idan.

@mp911de
Copy link
Collaborator

mp911de commented Nov 18, 2015

Hi @IdanFridman
thanks for reporting the issue. That's a bug. The RedisClusterAsyncCommands interface does not implement the RedisGeoAsyncCommands interface. You can cast the API object as workaround to RedisGeoAsyncCommands but it's not nice. I'll include the fix in a 3.3.2 4.0.1 release.

@mp911de mp911de added the type: bug A general bug label Nov 18, 2015
@IdanFridman
Copy link
Author

Could you show an example how what exactly to cast?

btw: do I need to add into it all the cluster ip's nodes?(by constructing it with list of RedisURI's or one uri of the host would be enough to enable the cluster)? thank you.

@mp911de
Copy link
Collaborator

mp911de commented Nov 18, 2015

To your first question:

RedisClusterClient clusterClient = new RedisClusterClient(new RedisURI(
                          REDIS_HOST,REDIS_PORT,60, TimeUnit.SECONDS));

StatefulRedisClusterConnection<String, String> clusterConnection = redisClusterClient.connect();
RedisGeoAsyncCommands<String, String> geoAsync = 
                         (RedisGeoAsyncCommands<String, String>) clusterConnection.async();

geoAsync.geoadd(...);

Second question:
You are required to specify at least one node. The topology is determined by the client itself but it's always safer (especially in setups where you use slaves/auto-failover) to provide more than one connection points to the clients. If one node is down and you provide multiple connection points you still are able to connect to the cluster because the nodes are used in sequence to attempt a connection.

@mp911de mp911de added this to the Lettuce 3.4 milestone Nov 18, 2015
@mp911de mp911de changed the title How to use the new geolocation api using the ClusterClient Cluster API does not implement the Geo commands interface Nov 18, 2015
mp911de added a commit that referenced this issue Nov 18, 2015
The Cluster APIs (deprecated Connection API and regular Command API) did not declare the Geo commands/connection interface in the extension list. Altough the Geo commands were available on the async/reactive API (because the API object implements all Geo methods) the API was not exposed and the Geo methods were not usable. This commit adds the GeoCommands/GeoConnection interfaces to the cluster commands/connection interfaces.
mp911de added a commit that referenced this issue Nov 18, 2015
The Cluster APIs (deprecated Connection API and regular Command API) did not declare the Geo commands/connection interface in the extension list. Altough the Geo commands were available on the async/reactive API (because the API object implements all Geo methods) the API was not exposed and the Geo methods were not usable. This commit adds the GeoCommands/GeoConnection interfaces to the cluster commands/connection interfaces.
mp911de added a commit that referenced this issue Nov 18, 2015
@mp911de
Copy link
Collaborator

mp911de commented Nov 18, 2015

Fixed, will be released with 4.0.1.Final end of November.

@mp911de
Copy link
Collaborator

mp911de commented Nov 30, 2015

Released 4.0.1.Final to Maven Central

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