diff --git a/pom.xml b/pom.xml index cde233bf1..3289a2e7e 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ 1.9.2 1.4.12 2.7.0 - 6.0.0.RC2 + 6.0.0.RELEASE 3.3.0 1.01 4.1.51.Final diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommands.java index 5cf234e39..cbbb6e9f9 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHashCommands.java @@ -28,6 +28,7 @@ import java.util.Map.Entry; import java.util.stream.Collectors; import org.reactivestreams.Publisher; + import org.springframework.data.redis.connection.ReactiveHashCommands; import org.springframework.data.redis.connection.ReactiveRedisConnection.BooleanResponse; import org.springframework.data.redis.connection.ReactiveRedisConnection.CommandResponse; @@ -209,9 +210,9 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands { Assert.notNull(command.getKey(), "Key must not be null!"); - Mono> result = cmd.hgetall(command.getKey()); + Flux> result = cmd.hgetall(command.getKey()); - return Mono.just(new CommandResponse<>(command, result.flatMapMany(v -> Flux.fromStream(v.entrySet().stream())))); + return Mono.just(new CommandResponse<>(command, result.map(LettuceReactiveHashCommands::toEntry))); })); } @@ -268,4 +269,25 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands { return cmd.hstrlen(command.getKey(), command.getField()).map(value -> new NumericResponse<>(command, value)); })); } + + private static Map.Entry toEntry(KeyValue kv) { + + return new Entry() { + + @Override + public ByteBuffer getKey() { + return kv.getKey(); + } + + @Override + public ByteBuffer getValue() { + return kv.getValue(); + } + + @Override + public ByteBuffer setValue(ByteBuffer value) { + throw new UnsupportedOperationException("Cannot set value for entry"); + } + }; + } }