Feature - inactive property added to StreamConsumer object #5093

pull/5099/head
Nikita Koksharov 2 years ago
parent 30ba066050
commit 4952c80c98

@ -17,7 +17,7 @@ package org.redisson.api;
/** /**
* Object containing details about Stream Consumer * Object containing details about Stream Consumer
* *
* @author Nikita Koksharov * @author Nikita Koksharov
* *
*/ */
@ -26,25 +26,27 @@ public class StreamConsumer {
private final String name; private final String name;
private final int pending; private final int pending;
private final long idleTime; private final long idleTime;
private final long inactive;
public StreamConsumer(String name, int pending, long idleTime) {
public StreamConsumer(String name, int pending, long idleTime, long inactive) {
this.name = name; this.name = name;
this.pending = pending; this.pending = pending;
this.idleTime = idleTime; this.idleTime = idleTime;
this.inactive = inactive;
} }
/** /**
* Returns amount of pending messages for this consumer * Returns amount of pending messages for this consumer
* *
* @return amount of pending messages * @return amount of pending messages
*/ */
public int getPending() { public int getPending() {
return pending; return pending;
} }
/** /**
* Returns name of this consumer * Returns name of this consumer
* *
* @return name of consumer * @return name of consumer
*/ */
public String getName() { public String getName() {
@ -52,12 +54,20 @@ public class StreamConsumer {
} }
/** /**
* Returns idle time in milliseconds since which this consumer hasn't consumed messages * Returns idle time in milliseconds since which this consumer hasn't consumed messages
* *
* @return idle time in milliseconds * @return idle time in milliseconds
*/ */
public long getIdleTime() { public long getIdleTime() {
return idleTime; return idleTime;
} }
/**
* Returns time in milliseconds since the last successful interaction of this consumer
*
* @return time in milliseconds
*/
public long getInactive() {
return inactive;
}
} }

@ -29,8 +29,12 @@ public class StreamConsumerInfoDecoder implements MultiDecoder<StreamConsumer> {
@Override @Override
public StreamConsumer decode(List<Object> parts, State state) { public StreamConsumer decode(List<Object> parts, State state) {
return new StreamConsumer((String) parts.get(1), if (parts.size() > 6) {
((Long) parts.get(3)).intValue(), (Long) parts.get(5)); return new StreamConsumer((String) parts.get(1),
((Long) parts.get(3)).intValue(), (Long) parts.get(5), (Long) parts.get(7));
}
return new StreamConsumer((String) parts.get(1),
((Long) parts.get(3)).intValue(), (Long) parts.get(5), -1);
} }
} }

Loading…
Cancel
Save