File tree 3 files changed +28
-0
lines changed
main/java/org/springframework/data/redis/connection/stream
test/java/org/springframework/data/redis/connection
3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -361,6 +361,26 @@ public Long pendingCount() {
361
361
public String lastDeliveredId () {
362
362
return getRequired ("last-delivered-id" , String .class );
363
363
}
364
+
365
+ /**
366
+ * The logical "read counter" of the last entry delivered to the group's consumers. Corresponds to {@literal entries-read}.
367
+ *
368
+ * @return
369
+ */
370
+ public Long entriesRead () {
371
+ return getRequired ("entries-read" , Long .class );
372
+ }
373
+
374
+ /**
375
+ * The number of entries in the stream that are still waiting to be delivered to the group's consumers,
376
+ * or a NULL when that number can't be determined. Corresponds to {@literal lag}.
377
+ *
378
+ * @return
379
+ */
380
+ @ Nullable
381
+ public Long lag () {
382
+ return get ("entries-read" , Long .class );
383
+ }
364
384
}
365
385
366
386
public static class XInfoConsumers implements Streamable <XInfoConsumer > {
Original file line number Diff line number Diff line change @@ -4017,6 +4017,8 @@ public void xinfoGroups() {
4017
4017
assertThat (info .get (0 ).groupName ()).isEqualTo ("my-group" );
4018
4018
assertThat (info .get (0 ).consumerCount ()).isEqualTo (1L );
4019
4019
assertThat (info .get (0 ).pendingCount ()).isEqualTo (2L );
4020
+ assertThat (info .get (0 ).lag ()).isEqualTo (0L );
4021
+ assertThat (info .get (0 ).entriesRead ()).isEqualTo (2L );
4020
4022
assertThat (info .get (0 ).lastDeliveredId ()).isEqualTo (lastRecord .getValue ());
4021
4023
}
4022
4024
@@ -4055,6 +4057,8 @@ public void xinfoGroupsNoConsumer() {
4055
4057
assertThat (info .get (0 ).groupName ()).isEqualTo ("my-group" );
4056
4058
assertThat (info .get (0 ).consumerCount ()).isZero ();
4057
4059
assertThat (info .get (0 ).pendingCount ()).isZero ();
4060
+ assertThat (info .get (0 ).lag ()).isZero ();
4061
+ assertThat (info .get (0 ).entriesRead ()).isZero ();
4058
4062
assertThat (info .get (0 ).lastDeliveredId ()).isEqualTo ("0-0" );
4059
4063
}
4060
4064
Original file line number Diff line number Diff line change @@ -429,6 +429,8 @@ void xinfoGroups() {
429
429
assertThat (info .groupName ()).isEqualTo ("my-group" );
430
430
assertThat (info .consumerCount ()).isEqualTo (1L );
431
431
assertThat (info .pendingCount ()).isEqualTo (2L );
432
+ assertThat (info .lag ()).isZero ();
433
+ assertThat (info .entriesRead ()).isEqualTo (2L );
432
434
assertThat (info .lastDeliveredId ()).isEqualTo (lastRecord );
433
435
}).verifyComplete ();
434
436
}
@@ -455,6 +457,8 @@ void xinfoGroupsNoConsumer() {
455
457
assertThat (info .groupName ()).isEqualTo ("my-group" );
456
458
assertThat (info .consumerCount ()).isZero ();
457
459
assertThat (info .pendingCount ()).isZero ();
460
+ assertThat (info .entriesRead ()).isZero ();
461
+ assertThat (info .lag ()).isZero ();
458
462
assertThat (info .lastDeliveredId ()).isEqualTo ("0-0" );
459
463
}).verifyComplete ();
460
464
}
You can’t perform that action at this time.
0 commit comments