redis.clients.jedis.resps.StreamGroupFullInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jedis_preview Show documentation
Show all versions of jedis_preview Show documentation
Jedis is a blazingly small and sane Redis java client.
The newest version!
package redis.clients.jedis.resps;
import redis.clients.jedis.StreamEntryID;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* This class holds information about a stream group with command {@code xinfo stream mystream full}.
* They can be accessed via getters. There is also {@link StreamGroupFullInfo#getGroupFullInfo()}
* method that returns a generic {@link Map} in case more info are returned from the server.
*/
public class StreamGroupFullInfo implements Serializable {
public static final String NAME = "name";
public static final String CONSUMERS = "consumers";
public static final String PENDING = "pending";
public static final String LAST_DELIVERED = "last-delivered-id";
public static final String PEL_COUNT = "pel-count";
private final String name;
private final List consumers;
private final List> pending;
private final Long pelCount;
private final StreamEntryID lastDeliveredId;
private final Map groupFullInfo;
/**
* @param map contains key-value pairs with group info
*/
@SuppressWarnings("unchecked")
public StreamGroupFullInfo(Map map) {
groupFullInfo = map;
name = (String) map.get(NAME);
consumers = (List) map.get(CONSUMERS);
pending = (List>) map.get(PENDING);
lastDeliveredId = (StreamEntryID) map.get(LAST_DELIVERED);
pelCount = (Long) map.get(PEL_COUNT);
pending.stream().forEach(entry -> entry.set(0, new StreamEntryID((String) entry.get(0))));
}
public String getName() {
return name;
}
public List getConsumers() {
return consumers;
}
public List> getPending() {
return pending;
}
public StreamEntryID getLastDeliveredId() {
return lastDeliveredId;
}
/**
* @return Generic map containing all key-value pairs returned by the server
*/
public Map getGroupFullInfo() {
return groupFullInfo;
}
public Long getPelCount() {
return pelCount;
}
}