tidwall / tile38

Real-time Geospatial and Geofencing
https://tile38.com
MIT License
9.15k stars 570 forks source link

ERR unknown command 'COMMAND' when use lettuce to connect to tile38 #256

Open pujian1984 opened 6 years ago

pujian1984 commented 6 years ago

hello,i use lettuce to connect to tile38,but there is some exception. i can use normal with the tile38-cli. my tile38 version is 1.10.0, lettuce version is lettuce-core 5.0.1.RELEASE. my java code is

package com.hdnav;
import io.lettuce.core.dynamic.Commands;

public interface KeyCommands extends Commands{
    String get(String key);
}

package com.hdnav;
import io.lettuce.core.RedisClient;
import io.lettuce.core.dynamic.RedisCommandFactory;

public class Tile{
    public static void main(String[] args) {
        RedisClient client = RedisClient.create("redis://190.0.0.35:9851");
        RedisCommandFactory factory = new RedisCommandFactory(client.connect());
            KeyCommands commands  = factory.getCommands(KeyCommands.class);
        String value = commands.get("Walter");
        System.out.println(value);
    }

}

my log is Exception in thread "main" io.lettuce.core.RedisCommandExecutionException: ERR unknown command 'COMMAND' at io.lettuce.core.LettuceFutures.awaitOrCancel(LettuceFutures.java:122) at io.lettuce.core.FutureSyncInvocationHandler.handleInvocation(FutureSyncInvocationHandler.java:62) at io.lettuce.core.internal.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:80) at com.sun.proxy.$Proxy0.command(Unknown Source) at io.lettuce.core.dynamic.RedisCommandFactory.getCommands(RedisCommandFactory.java:129) at io.lettuce.core.dynamic.RedisCommandFactory.<init>(RedisCommandFactory.java:121) at io.lettuce.core.dynamic.RedisCommandFactory.<init>(RedisCommandFactory.java:104) at com.hdnav.Tile.main(Tile.java:16) Caused by: io.lettuce.core.RedisCommandExecutionException: ERR unknown command 'COMMAND' at io.lettuce.core.protocol.AsyncCommand.completeResult(AsyncCommand.java:118) at io.lettuce.core.protocol.AsyncCommand.complete(AsyncCommand.java:109) at io.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:558) at io.lettuce.core.protocol.CommandHandler.channelRead(CommandHandler.java:511) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1359) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:935) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:138) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138) at java.lang.Thread.run(Thread.java:745)

the exception run at this line RedisCommandFactory factory = new RedisCommandFactory(client.connect());

mp911de commented 6 years ago

It would make sense to provide the COMMAND command to obtain command details.

tidwall commented 6 years ago

@mp911de I totally agree. I'll need to familiarize myself with the Redis COMMAND output, but I can see a lot of good from adding this command.