diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommands.java index 91f7e55d2..13bfe30aa 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterHyperLogLogCommands.java @@ -53,7 +53,7 @@ class LettuceReactiveClusterHyperLogLogCommands extends LettuceReactiveHyperLogL @Override public Flux> pfMerge(Publisher commands) { - return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> { + return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null for PFMERGE"); Assert.notEmpty(command.getSourceKeys(), "Source keys must not be null or empty for PFMERGE!"); @@ -76,7 +76,7 @@ class LettuceReactiveClusterHyperLogLogCommands extends LettuceReactiveHyperLogL @Override public Flux> pfCount(Publisher commands) { - return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> { + return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notEmpty(command.getKeys(), "Keys must be null or empty for PFCOUNT!"); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommands.java index ad38fc909..30c4ffccd 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterKeyCommands.java @@ -76,7 +76,7 @@ class LettuceReactiveClusterKeyCommands extends LettuceReactiveKeyCommands imple @Override public Flux> rename(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "key must not be null."); Assert.notNull(command.getNewName(), "NewName must not be null!"); @@ -102,7 +102,7 @@ class LettuceReactiveClusterKeyCommands extends LettuceReactiveKeyCommands imple @Override public Flux> renameNX(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null."); Assert.notNull(command.getNewName(), "NewName must not be null!"); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterListCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterListCommands.java index 207ff579c..a2d929a21 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterListCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterListCommands.java @@ -49,7 +49,7 @@ class LettuceReactiveClusterListCommands extends LettuceReactiveListCommands imp @Override public Flux bPop(Publisher commands) { - return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> { + return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKeys(), "Keys must not be null!"); Assert.notNull(command.getDirection(), "Direction must not be null!"); @@ -68,7 +68,7 @@ class LettuceReactiveClusterListCommands extends LettuceReactiveListCommands imp @Override public Flux> rPopLPush(Publisher commands) { - return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> { + return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getDestination(), "Destination key must not be null!"); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommands.java index b22c9b465..9757b01ca 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommands.java @@ -280,7 +280,7 @@ class LettuceReactiveClusterServerCommands extends LettuceReactiveServerCommands public Flux getClientList(RedisClusterNode node) { return connection.execute(node, RedisServerReactiveCommands::clientList) - .flatMapIterable(LettuceConverters.stringToRedisClientListConverter()::convert); + .concatMapIterable(LettuceConverters.stringToRedisClientListConverter()::convert); } private Collection>> executeOnAllNodes( diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterSetCommands.java index 63f4c6c81..e8f516e1f 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterSetCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterSetCommands.java @@ -53,7 +53,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple @Override public Flux>> sUnion(Publisher commands) { - return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> { + return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKeys(), "Keys must not be null!"); @@ -74,7 +74,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple @Override public Flux> sUnionStore(Publisher commands) { - return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> { + return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKeys(), "Source keys must not be null!"); Assert.notNull(command.getKey(), "Destination key must not be null!"); @@ -99,7 +99,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple @Override public Flux>> sInter(Publisher commands) { - return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> { + return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKeys(), "Keys must not be null!"); @@ -124,7 +124,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple return source; }); - return Mono.just(new CommandResponse<>(command, result.flatMap(v -> Flux.fromStream(v.stream())))); + return Mono.just(new CommandResponse<>(command, result.concatMap(v -> Flux.fromStream(v.stream())))); })); } @@ -134,7 +134,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple @Override public Flux> sInterStore(Publisher commands) { - return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> { + return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKeys(), "Source keys must not be null!"); Assert.notNull(command.getKey(), "Destination key must not be null!"); @@ -159,7 +159,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple @Override public Flux>> sDiff(Publisher commands) { - return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> { + return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKeys(), "Keys must not be null!"); @@ -185,7 +185,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple return source; }); - return Mono.just(new CommandResponse<>(command, result.flatMap(v -> Flux.fromStream(v.stream())))); + return Mono.just(new CommandResponse<>(command, result.concatMap(v -> Flux.fromStream(v.stream())))); })); } @@ -196,7 +196,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple @Override public Flux> sDiffStore(Publisher commands) { - return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> { + return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKeys(), "Source keys must not be null!"); Assert.notNull(command.getKey(), "Destination key must not be null!"); @@ -221,7 +221,7 @@ class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommands imple @Override public Flux> sMove(Publisher commands) { - return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> { + return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Source key must not be null!"); Assert.notNull(command.getDestination(), "Destination key must not be null!"); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStringCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStringCommands.java index edad273a4..691a2a56d 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStringCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterStringCommands.java @@ -51,7 +51,7 @@ class LettuceReactiveClusterStringCommands extends LettuceReactiveStringCommands @Override public Flux> bitOp(Publisher commands) { - return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> { + return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> { List keys = new ArrayList<>(command.getKeys()); keys.add(command.getDestinationKey()); @@ -71,7 +71,7 @@ class LettuceReactiveClusterStringCommands extends LettuceReactiveStringCommands @Override public Flux> mSetNX(Publisher commands) { - return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> { + return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> { if (ClusterSlotHashUtil.isSameSlotForAllKeys(command.getKeyValuePairs().keySet())) { return super.mSetNX(Mono.just(command)); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterZSetCommands.java index 81eb0b00c..f7db6d063 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterZSetCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterZSetCommands.java @@ -47,7 +47,7 @@ class LettuceReactiveClusterZSetCommands extends LettuceReactiveZSetCommands imp @Override public Flux> zUnionStore(Publisher commands) { - return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> { + return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notEmpty(command.getSourceKeys(), "Source keys must not be null or empty."); @@ -65,7 +65,7 @@ class LettuceReactiveClusterZSetCommands extends LettuceReactiveZSetCommands imp */ @Override public Flux> zInterStore(Publisher commands) { - return getConnection().execute(cmd -> Flux.from(commands).flatMap(command -> { + return getConnection().execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notEmpty(command.getSourceKeys(), "Source keys must not be null or empty."); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommands.java index 622cbb89c..177894b41 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveGeoCommands.java @@ -68,7 +68,7 @@ class LettuceReactiveGeoCommands implements ReactiveGeoCommands { @Override public Flux> geoAdd(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getGeoLocations(), "Locations must not be null!"); @@ -95,7 +95,7 @@ class LettuceReactiveGeoCommands implements ReactiveGeoCommands { @Override public Flux> geoDist(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getFrom(), "From member must not be null!"); @@ -121,7 +121,7 @@ class LettuceReactiveGeoCommands implements ReactiveGeoCommands { @Override public Flux> geoHash(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getMembers(), "Members must not be null!"); @@ -139,7 +139,7 @@ class LettuceReactiveGeoCommands implements ReactiveGeoCommands { @Override public Flux> geoPos(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getMembers(), "Members must not be null!"); @@ -160,7 +160,7 @@ class LettuceReactiveGeoCommands implements ReactiveGeoCommands { public Flux>>>> geoRadius( Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getPoint(), "Point must not be null!"); @@ -187,7 +187,7 @@ class LettuceReactiveGeoCommands implements ReactiveGeoCommands { public Flux>>>> geoRadiusByMember( Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getMember(), "Member must not be null!"); 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 326b638a0..9deaa0a74 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 @@ -63,7 +63,7 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands { @Override public Flux> hSet(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getFieldValueMap(), "FieldValueMap must not be null!"); @@ -95,7 +95,7 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands { @Override public Flux> hMGet(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getFields(), "Fields must not be null!"); @@ -122,7 +122,7 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands { @Override public Flux> hExists(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getName(), "Name must not be null!"); @@ -138,7 +138,7 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands { @Override public Flux> hDel(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getFields(), "Fields must not be null!"); @@ -155,7 +155,7 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands { @Override public Flux> hLen(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Command.getKey() must not be null!"); @@ -170,7 +170,7 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands { @Override public Flux>> hKeys(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); @@ -187,7 +187,7 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands { @Override public Flux>> hVals(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); @@ -205,7 +205,7 @@ class LettuceReactiveHashCommands implements ReactiveHashCommands { public Flux>>> hGetAll( Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommands.java index ced544faa..a1a9514ea 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveHyperLogLogCommands.java @@ -53,7 +53,7 @@ class LettuceReactiveHyperLogLogCommands implements ReactiveHyperLogLogCommands @Override public Flux> pfAdd(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "key must not be null!"); @@ -70,7 +70,7 @@ class LettuceReactiveHyperLogLogCommands implements ReactiveHyperLogLogCommands @Override public Flux> pfCount(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notEmpty(command.getKeys(), "Keys must not be empty for PFCOUNT."); @@ -86,7 +86,7 @@ class LettuceReactiveHyperLogLogCommands implements ReactiveHyperLogLogCommands @Override public Flux> pfMerge(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Destination key must not be null for PFMERGE."); Assert.notEmpty(command.getSourceKeys(), "Source keys must not be null for PFMERGE."); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommands.java index 6a7465b50..c38239b5e 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveKeyCommands.java @@ -61,7 +61,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands { @Override public Flux> exists(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap((command) -> { + return connection.execute(cmd -> Flux.from(commands).concatMap((command) -> { Assert.notNull(command.getKey(), "Key must not be null!"); @@ -77,7 +77,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands { @Override public Flux> type(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); @@ -93,7 +93,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands { @Override public Flux> keys(Publisher patterns) { - return connection.execute(cmd -> Flux.from(patterns).flatMap(pattern -> { + return connection.execute(cmd -> Flux.from(patterns).concatMap(pattern -> { Assert.notNull(pattern, "Pattern must not be null!"); // TODO: stream elements instead of collection @@ -117,7 +117,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands { @Override public Flux> rename(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getNewName(), "New name must not be null!"); @@ -134,7 +134,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands { @Override public Flux> renameNX(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getNewName(), "New name must not be null!"); @@ -150,7 +150,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands { @Override public Flux> del(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap((command) -> { + return connection.execute(cmd -> Flux.from(commands).concatMap((command) -> { Assert.notNull(command.getKey(), "Key must not be null!"); @@ -165,7 +165,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands { @Override public Flux, Long>> mDel(Publisher> keysCollection) { - return connection.execute(cmd -> Flux.from(keysCollection).flatMap((keys) -> { + return connection.execute(cmd -> Flux.from(keysCollection).concatMap((keys) -> { Assert.notEmpty(keys, "Keys must not be null!"); @@ -180,7 +180,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands { @Override public Flux> expire(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getTimeout(), "Timeout must not be null!"); @@ -196,7 +196,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands { @Override public Flux> pExpire(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getTimeout(), "Timeout must not be null!"); @@ -212,7 +212,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands { @Override public Flux> expireAt(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getExpireAt(), "Expire at must not be null!"); @@ -228,7 +228,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands { @Override public Flux> pExpireAt(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getExpireAt(), "Expire at must not be null!"); @@ -244,7 +244,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands { @Override public Flux> persist(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); @@ -258,7 +258,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands { @Override public Flux> ttl(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); @@ -272,7 +272,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands { @Override public Flux> pTtl(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); @@ -286,7 +286,7 @@ class LettuceReactiveKeyCommands implements ReactiveKeyCommands { @Override public Flux> move(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getDatabase(), "Database must not be null!"); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java index 8496ef807..cffc92974 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveListCommands.java @@ -63,7 +63,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands { @Override public Flux> push(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notEmpty(command.getValues(), "Values must not be null or empty!"); @@ -96,7 +96,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands { @Override public Flux> lLen(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); @@ -111,7 +111,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands { @Override public Flux>> lRange(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getRange(), "Range must not be null!"); @@ -129,7 +129,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands { @Override public Flux> lTrim(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getRange(), "Range must not be null!"); @@ -148,7 +148,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands { @Override public Flux> lIndex(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getIndex(), "Index value must not be null!"); @@ -164,7 +164,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands { @Override public Flux> lInsert(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "Value must not be null!"); @@ -185,7 +185,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands { return connection.execute(cmd -> { - return Flux.from(commands).flatMap(command -> { + return Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "value must not be null!"); @@ -204,7 +204,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands { @Override public Flux> lRem(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "Value must not be null!"); @@ -222,7 +222,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands { @Override public Flux> pop(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getDirection(), "Direction must not be null!"); @@ -241,7 +241,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands { @Override public Flux bPop(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKeys(), "Keys must not be null!"); Assert.notNull(command.getDirection(), "Direction must not be null!"); @@ -264,7 +264,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands { @Override public Flux> rPopLPush(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getDestination(), "Destination key must not be null!"); @@ -281,7 +281,7 @@ class LettuceReactiveListCommands implements ReactiveListCommands { @Override public Flux> bRPopLPush(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getDestination(), "Destination key must not be null!"); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveNumberCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveNumberCommands.java index 165cc8410..bd2d42624 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveNumberCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveNumberCommands.java @@ -53,7 +53,7 @@ class LettuceReactiveNumberCommands implements ReactiveNumberCommands { @Override public Flux> incr(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); @@ -68,7 +68,7 @@ class LettuceReactiveNumberCommands implements ReactiveNumberCommands { @Override public Flux, T>> incrBy(Publisher> commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "Value for INCRBY must not be null."); @@ -94,7 +94,7 @@ class LettuceReactiveNumberCommands implements ReactiveNumberCommands { @Override public Flux> decr(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); @@ -109,7 +109,7 @@ class LettuceReactiveNumberCommands implements ReactiveNumberCommands { @Override public Flux, T>> decrBy(Publisher> commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "Value for DECRBY must not be null."); @@ -135,7 +135,7 @@ class LettuceReactiveNumberCommands implements ReactiveNumberCommands { @Override public Flux, T>> hIncrBy(Publisher> commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "Value must not be null!"); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisConnection.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisConnection.java index d7de15b5f..2be8cedad 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisConnection.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveRedisConnection.java @@ -31,6 +31,7 @@ import org.reactivestreams.Publisher; import org.springframework.dao.DataAccessException; import org.springframework.dao.InvalidDataAccessResourceUsageException; import org.springframework.data.redis.connection.*; +import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** @@ -44,7 +45,7 @@ class LettuceReactiveRedisConnection implements ReactiveRedisConnection { private final LettuceConnectionProvider connectionProvider; - private StatefulConnection connection; + private @Nullable StatefulConnection connection; /** * Creates new {@link LettuceReactiveRedisConnection}. @@ -53,6 +54,7 @@ class LettuceReactiveRedisConnection implements ReactiveRedisConnection { * @throws IllegalArgumentException when {@code client} is {@literal null}. * @throws InvalidDataAccessResourceUsageException when {@code client} is not suitable for connection. */ + @SuppressWarnings("unchecked") LettuceReactiveRedisConnection(LettuceConnectionProvider connectionProvider) { Assert.notNull(connectionProvider, "LettuceConnectionProvider must not be null!"); @@ -183,14 +185,21 @@ class LettuceReactiveRedisConnection implements ReactiveRedisConnection { @Override public void close() { - synchronized (connectionProvider) { - connectionProvider.release(connection); - connection = null; + if (connection != null) { + synchronized (connectionProvider) { + connectionProvider.release(connection); + connection = null; + } } } protected StatefulConnection getConnection() { - return connection; + + if (connection != null) { + return connection; + } + + throw new IllegalStateException("Connection is closed"); } protected RedisClusterReactiveCommands getCommands() { diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveScriptingCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveScriptingCommands.java index ca5ca94ad..686a996e1 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveScriptingCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveScriptingCommands.java @@ -140,7 +140,7 @@ class LettuceReactiveScriptingCommands implements ReactiveScriptingCommands { if (returnType == ReturnType.MULTI) { - return eval.flatMap(t -> { + return eval.concatMap(t -> { return t instanceof Exception ? Flux.error(connection.translateException().apply((Exception) t)) : Flux.just(t); }); } diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java index 4ea0b28f3..657048636 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommands.java @@ -233,6 +233,6 @@ class LettuceReactiveServerCommands implements ReactiveServerCommands { public Flux getClientList() { return connection.execute(RedisServerReactiveCommands::clientList) - .flatMapIterable(s -> LettuceConverters.stringToRedisClientListConverter().convert(s)); + .concatMapIterable(s -> LettuceConverters.stringToRedisClientListConverter().convert(s)); } } diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSetCommands.java index f915b2e15..c1e3dd3f4 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSetCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveSetCommands.java @@ -57,7 +57,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands { @Override public Flux> sAdd(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValues(), "Values must not be null!"); @@ -74,7 +74,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands { @Override public Flux> sRem(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValues(), "Values must not be null!"); @@ -91,7 +91,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands { @Override public Flux> sPop(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); @@ -119,7 +119,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands { @Override public Flux> sMove(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getDestination(), "Destination key must not be null!"); @@ -137,7 +137,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands { @Override public Flux> sCard(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); @@ -152,7 +152,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands { @Override public Flux> sIsMember(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "Value must not be null!"); @@ -168,7 +168,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands { @Override public Flux>> sInter(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKeys(), "Keys must not be null!"); @@ -184,7 +184,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands { @Override public Flux> sInterStore(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKeys(), "Keys must not be null!"); Assert.notNull(command.getKey(), "Destination key must not be null!"); @@ -201,7 +201,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands { @Override public Flux>> sUnion(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKeys(), "Keys must not be null!"); @@ -217,7 +217,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands { @Override public Flux> sUnionStore(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKeys(), "Keys must not be null!"); Assert.notNull(command.getKey(), "Destination key must not be null!"); @@ -234,7 +234,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands { @Override public Flux>> sDiff(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKeys(), "Keys must not be null!"); @@ -250,7 +250,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands { @Override public Flux> sDiffStore(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKeys(), "Keys must not be null!"); Assert.notNull(command.getKey(), "Destination key must not be null!"); @@ -267,7 +267,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands { @Override public Flux>> sMembers(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); @@ -284,7 +284,7 @@ class LettuceReactiveSetCommands implements ReactiveSetCommands { public Flux>> sRandMember( Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommands.java index 0a5ba80c0..862582556 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommands.java @@ -63,7 +63,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands { @Override public Flux, ByteBuffer>> mGet(Publisher> keyCollections) { - return connection.execute(cmd -> Flux.from(keyCollections).flatMap((keys) -> { + return connection.execute(cmd -> Flux.from(keyCollections).concatMap((keys) -> { Assert.notNull(keys, "Keys must not be null!"); @@ -79,7 +79,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands { @Override public Flux> set(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap((command) -> { + return connection.execute(cmd -> Flux.from(commands).concatMap((command) -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "Value must not be null!"); @@ -104,7 +104,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands { @Override public Flux> getSet(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap((command) -> { + return connection.execute(cmd -> Flux.from(commands).concatMap((command) -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "Value must not be null!"); @@ -125,7 +125,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands { @Override public Flux> get(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap((command) -> { + return connection.execute(cmd -> Flux.from(commands).concatMap((command) -> { Assert.notNull(command.getKey(), "Key must not be null!"); @@ -141,7 +141,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands { @Override public Flux> setNX(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "Value must not be null!"); @@ -156,7 +156,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands { */ @Override public Flux> setEX(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "Value must not be null!"); @@ -174,7 +174,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands { @Override public Flux> pSetEX(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "Value must not be null!"); @@ -193,7 +193,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands { @Override public Flux> mSet(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notEmpty(command.getKeyValuePairs(), "Pairs must not be null or empty!"); @@ -209,7 +209,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands { @Override public Flux> mSetNX(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notEmpty(command.getKeyValuePairs(), "Pairs must not be null or empty!"); @@ -224,7 +224,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands { @Override public Flux> append(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "Value must not be null!"); @@ -240,7 +240,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands { @Override public Flux> getRange(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getRange(), "Range must not be null!"); @@ -259,7 +259,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands { @Override public Flux> setRange(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "Value must not be null!"); @@ -277,7 +277,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands { @Override public Flux> getBit(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getOffset(), "Offset must not be null!"); @@ -294,7 +294,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands { @Override public Flux> setBit(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "Value must not be null!"); @@ -312,7 +312,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands { @Override public Flux> bitCount(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); @@ -331,7 +331,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands { @Override public Flux> bitOp(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getDestinationKey(), "DestinationKey must not be null!"); Assert.notEmpty(command.getKeys(), "Keys must not be null or empty"); @@ -373,7 +373,7 @@ class LettuceReactiveStringCommands implements ReactiveStringCommands { return connection.execute(cmd -> { - return Flux.from(commands).flatMap(command -> { + return Flux.from(commands).concatMap(command -> { return cmd.strlen(command.getKey()).map(respValue -> new NumericResponse<>(command, respValue)); }); }); diff --git a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommands.java b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommands.java index 33d7d8252..3590465f3 100644 --- a/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommands.java +++ b/src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveZSetCommands.java @@ -72,7 +72,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands { @SuppressWarnings("unchecked") public Flux> zAdd(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notEmpty(command.getTuples(), "Tuples must not be empty or null!"); @@ -121,7 +121,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands { @Override public Flux> zRem(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notEmpty(command.getValues(), "Values must not be null or empty!"); @@ -138,7 +138,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands { @Override public Flux> zIncrBy(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "Member must not be null!"); @@ -156,7 +156,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands { @Override public Flux> zRank(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "Value must not be null!"); @@ -175,7 +175,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands { @Override public Flux>> zRange(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getRange(), "Range must not be null!"); @@ -224,7 +224,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands { public Flux>> zRangeByScore( Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getRange(), "Range must not be null!"); @@ -298,7 +298,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands { @Override public Flux> zCount(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getRange(), "Range must not be null!"); @@ -317,7 +317,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands { @Override public Flux> zCard(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); @@ -332,7 +332,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands { @Override public Flux> zScore(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getValue(), "Value must not be null!"); @@ -349,7 +349,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands { public Flux> zRemRangeByRank( Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getRange(), "Range must not be null!"); @@ -369,7 +369,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands { public Flux> zRemRangeByScore( Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Key must not be null!"); Assert.notNull(command.getRange(), "Range must not be null!"); @@ -388,7 +388,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands { @Override public Flux> zUnionStore(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Destination key must not be null!"); Assert.notEmpty(command.getSourceKeys(), "Source keys must not be null or empty!"); @@ -413,7 +413,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands { @Override public Flux> zInterStore(Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Destination key must not be null!"); Assert.notEmpty(command.getSourceKeys(), "Source keys must not be null or empty!"); @@ -439,7 +439,7 @@ class LettuceReactiveZSetCommands implements ReactiveZSetCommands { public Flux>> zRangeByLex( Publisher commands) { - return connection.execute(cmd -> Flux.from(commands).flatMap(command -> { + return connection.execute(cmd -> Flux.from(commands).concatMap(command -> { Assert.notNull(command.getKey(), "Destination key must not be null!"); diff --git a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommandsTests.java b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommandsTests.java index 0f9698f86..c5613f88e 100644 --- a/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommandsTests.java +++ b/src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommandsTests.java @@ -19,6 +19,7 @@ import static org.hamcrest.Matchers.*; import static org.junit.Assert.*; import static org.junit.Assume.*; +import org.springframework.data.redis.util.ByteUtils; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -116,8 +117,8 @@ public class LettuceReactiveStringCommandsTests extends LettuceReactiveCommandsT Stream stream = Stream.of(new KeyCommand(KEY_1_BBUFFER), new KeyCommand(KEY_2_BBUFFER)); Flux> result = connection.stringCommands().get(Flux.fromStream(stream)); - StepVerifier.create(result.map(CommandResponse::getOutput)) // - .expectNext(VALUE_1_BBUFFER, VALUE_2_BBUFFER) // + StepVerifier.create(result.map(CommandResponse::getOutput).map(ByteUtils::getBytes).map(String::new)) // + .expectNext(new String(ByteUtils.getBytes(VALUE_1_BBUFFER)), new String(ByteUtils.getBytes(VALUE_2_BBUFFER))) // .verifyComplete(); }