jdeppe-pivotal commented on a change in pull request #6616:
URL: https://github.com/apache/geode/pull/6616#discussion_r654871282
##########
File path:
geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/executor/pubsub/PubSubExecutor.java
##########
@@ -33,28 +32,42 @@
@Override
public RedisResponse executeCommand(Command command, ExecutionHandlerContext
context) {
- byte[] subCommand = command.getProcessedCommand().get(1);
+ List<byte[]> processedCommand = command.getProcessedCommand();
+ String subCommand =
Coder.bytesToString(processedCommand.get(1)).toLowerCase();
- if (!Arrays.equals(subCommand, Coder.stringToBytes("channels"))) {
- return RedisResponse
- .error(String.format(ERROR_UNKNOWN_PUBSUB_SUBCOMMAND, new
String(subCommand)));
- }
+ switch (subCommand) {
+ case "channels":
+ if (processedCommand.size() > 3) {
+ return
RedisResponse.error(String.format(ERROR_UNKNOWN_PUBSUB_SUBCOMMAND, subCommand));
+ }
+
+ List<byte[]> channelsResponse = doChannels(processedCommand, context);
+ return RedisResponse.array(channelsResponse);
- // in a subsequent story, a new parameter requirement class
- // specific to subCommands might be a better way to do this
- if (command.getProcessedCommand().size() > 3) {
- return RedisResponse
- .error(String.format(ERROR_UNKNOWN_PUBSUB_SUBCOMMAND, new
String(subCommand)));
+ case "numsub":
Review comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]