vipshop / hiredis-vip

Support redis cluster. Maintained and used at vipshop.
BSD 3-Clause "New" or "Revised" License
322 stars 173 forks source link

hiredis cluster subscribe does't work! who can help me , show me a example? #93

Open czn911 opened 6 years ago

czn911 commented 6 years ago

1、redisClusterLibeventAttach(c,base); 2、redisClusterAsyncSetConnectCallback(c,connect_callback); 3、redisClusterAsyncSetDisconnectCallback(c,disconnect_callback); 4、redisClusterAsyncCommand(c, sub_callback, (char*) "xushan", "SUBSCRIBE abcd");

line 4 is wrong,executed wrong, the call stack below: redisClustervAsyncCommand->redisClusterAsyncFormattedCommand->command_format_by_slot->redis_parse_cmd->case 9 When the code is executed here, it goes wrong. beacuse in func "redis_parse_cmd " case 9 ,there is no key-work subsribe .

anybody can help me ?

case 9: if (str9icmp(m, 'p', 'e', 'x', 'p', 'i', 'r', 'e', 'a', 't')) { r->type = CMD_REQ_REDIS_PEXPIREAT; break; }

            if (str9icmp(m, 'r', 'p', 'o', 'p', 'l', 'p', 'u', 's', 'h')) {
                r->type = CMD_REQ_REDIS_RPOPLPUSH;
                break;
            }

            if (str9icmp(m, 's', 'i', 's', 'm', 'e', 'm', 'b', 'e', 'r')) {
                r->type = CMD_REQ_REDIS_SISMEMBER;
                break;
            }

            if (str9icmp(m, 'z', 'r', 'e', 'v', 'r', 'a', 'n', 'g', 'e')) {
                r->type = CMD_REQ_REDIS_ZREVRANGE;
                break;
            }

            if (str9icmp(m, 'z', 'l', 'e', 'x', 'c', 'o', 'u', 'n', 't')) {
                r->type = CMD_REQ_REDIS_ZLEXCOUNT;
                break;
            }
thakurajayL commented 5 years ago

i don't see subscribe command support in the hiredis-vip.