|
18 | 18 | import io.lettuce.core.XAddArgs;
|
19 | 19 | import io.lettuce.core.XClaimArgs;
|
20 | 20 | import io.lettuce.core.XGroupCreateArgs;
|
| 21 | +import io.lettuce.core.XPendingArgs; |
21 | 22 | import io.lettuce.core.XReadArgs;
|
22 | 23 | import io.lettuce.core.api.async.RedisStreamAsyncCommands;
|
23 | 24 | import io.lettuce.core.cluster.api.async.RedisClusterAsyncCommands;
|
|
50 | 51 | * @author Dejan Jankov
|
51 | 52 | * @author Dengliming
|
52 | 53 | * @author Mark John Moreno
|
| 54 | + * @author Jeonggyu Choi |
53 | 55 | * @since 2.2
|
54 | 56 | */
|
55 | 57 | class LettuceStreamCommands implements RedisStreamCommands {
|
@@ -217,15 +219,17 @@ public PendingMessages xPending(byte[] key, String groupName, XPendingOptions op
|
217 | 219 | io.lettuce.core.Limit limit = options.isLimited() ? io.lettuce.core.Limit.from(options.getCount())
|
218 | 220 | : io.lettuce.core.Limit.unlimited();
|
219 | 221 |
|
| 222 | + XPendingArgs<byte[]> xPendingArgs = XPendingArgs.Builder.xpending(group, range, limit); |
220 | 223 | if (options.hasConsumer()) {
|
221 |
| - |
222 |
| - return connection.invoke() |
223 |
| - .from(RedisStreamAsyncCommands::xpending, key, |
224 |
| - io.lettuce.core.Consumer.from(group, LettuceConverters.toBytes(options.getConsumerName())), range, limit) |
225 |
| - .get(it -> StreamConverters.toPendingMessages(groupName, options.getRange(), it)); |
| 224 | + io.lettuce.core.Consumer<byte[]> consumer = io.lettuce.core.Consumer.from(group, |
| 225 | + LettuceConverters.toBytes(options.getConsumerName())); |
| 226 | + xPendingArgs.consumer(consumer); |
| 227 | + } |
| 228 | + if (options.hasIdle()) { |
| 229 | + xPendingArgs.idle(options.getIdle()); |
226 | 230 | }
|
227 | 231 |
|
228 |
| - return connection.invoke().from(RedisStreamAsyncCommands::xpending, key, group, range, limit) |
| 232 | + return connection.invoke().from(RedisStreamAsyncCommands::xpending, key, xPendingArgs) |
229 | 233 | .get(it -> StreamConverters.toPendingMessages(groupName, options.getRange(), it));
|
230 | 234 | }
|
231 | 235 |
|
|
0 commit comments