Skip to content

Commit af0a267

Browse files
committed
feat(reactive): Support Lettuce
1 parent b7fb631 commit af0a267

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStreamCommands.java

+12-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import io.lettuce.core.XAddArgs;
1919
import io.lettuce.core.XClaimArgs;
2020
import io.lettuce.core.XGroupCreateArgs;
21+
import io.lettuce.core.XPendingArgs;
2122
import io.lettuce.core.XReadArgs;
2223
import io.lettuce.core.XReadArgs.StreamOffset;
2324
import io.lettuce.core.cluster.api.reactive.RedisClusterReactiveCommands;
@@ -56,6 +57,7 @@
5657
* @author Tugdual Grall
5758
* @author Dengliming
5859
* @author Mark John Moreno
60+
* @author Jeonggyu Choi
5961
* @since 2.2
6062
*/
6163
class LettuceReactiveStreamCommands implements ReactiveStreamCommands {
@@ -235,9 +237,16 @@ public Flux<CommandResponse<PendingRecordsCommand, PendingMessages>> xPending(
235237
io.lettuce.core.Limit limit = command.isLimited() ? io.lettuce.core.Limit.from(command.getCount())
236238
: io.lettuce.core.Limit.unlimited();
237239

238-
Flux<PendingMessage> publisher = command.hasConsumer() ? cmd.xpending(command.getKey(),
239-
io.lettuce.core.Consumer.from(groupName, ByteUtils.getByteBuffer(command.getConsumerName())), range, limit)
240-
: cmd.xpending(command.getKey(), groupName, range, limit);
240+
XPendingArgs<ByteBuffer> xPendingArgs = XPendingArgs.Builder.xpending(groupName, range, limit);
241+
if (command.hasConsumer()) {
242+
io.lettuce.core.Consumer<ByteBuffer> consumer = io.lettuce.core.Consumer.from(groupName, ByteUtils.getByteBuffer(command.getConsumerName()));
243+
xPendingArgs.consumer(consumer);
244+
}
245+
if (command.hasIdle()) {
246+
xPendingArgs.idle(command.getIdle());
247+
}
248+
249+
Flux<PendingMessage> publisher = cmd.xpending(command.getKey(), xPendingArgs);
241250

242251
return publisher.collectList().map(it -> {
243252

0 commit comments

Comments
 (0)