diff --git a/src/main/java/com/lambdaworks/redis/cluster/ClusterDistributionChannelWriter.java b/src/main/java/com/lambdaworks/redis/cluster/ClusterDistributionChannelWriter.java index 048d160f78..b380aaa178 100644 --- a/src/main/java/com/lambdaworks/redis/cluster/ClusterDistributionChannelWriter.java +++ b/src/main/java/com/lambdaworks/redis/cluster/ClusterDistributionChannelWriter.java @@ -96,7 +96,10 @@ public > C write(C command) { channelWriter = writer.defaultWriter; } - commandToSend.getOutput().setError((String) null); + if(command.getOutput() != null){ + commandToSend.getOutput().setError((String) null); + } + if (channelWriter != null && channelWriter != this && channelWriter != defaultWriter) { return channelWriter.write((C) commandToSend); } diff --git a/src/test/java/com/lambdaworks/redis/cluster/AdvancedClusterClientTest.java b/src/test/java/com/lambdaworks/redis/cluster/AdvancedClusterClientTest.java index ef76d7478d..37cea23a28 100644 --- a/src/test/java/com/lambdaworks/redis/cluster/AdvancedClusterClientTest.java +++ b/src/test/java/com/lambdaworks/redis/cluster/AdvancedClusterClientTest.java @@ -484,6 +484,19 @@ public void pipelining() throws Exception { } + + @Test + public void transactions() throws Exception { + + commands.multi(); + commands.set(key, value); + commands.discard(); + + commands.multi(); + commands.set(key, value); + commands.exec(); + } + protected String value(int i) { return value + "-" + i; }