All Downloads are FREE. Search and download functionalities are using the official Maven repository.

redis.clients.jedis.resps.StreamGroupInfo Maven / Gradle / Ivy

The newest version!
package redis.clients.jedis.resps;

import java.io.Serializable;
import java.util.Map;
import redis.clients.jedis.StreamEntryID;

/**
 * This class holds information about a stream group. They can be accessed via getters. There is also
 * {@link StreamGroupInfo#getGroupInfo()} method that returns a generic {@code Map} in case more
 * info are returned from the server.
 */
public class StreamGroupInfo 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";

  private final String name;
  private final long consumers;
  private final long pending;
  private final StreamEntryID lastDeliveredId;
  private final Map groupInfo;

  /**
   * @param map contains key-value pairs with group info
   */
  public StreamGroupInfo(Map map) {

    groupInfo = map;
    name = (String) map.get(NAME);
    consumers = (long) map.get(CONSUMERS);
    pending = (long) map.get(PENDING);
    lastDeliveredId = (StreamEntryID) map.get(LAST_DELIVERED);

  }

  public String getName() {
    return name;
  }

  public long getConsumers() {
    return consumers;
  }

  public long getPending() {
    return pending;
  }

  public StreamEntryID getLastDeliveredId() {
    return lastDeliveredId;
  }

  /**
   * @return Generic map containing all key-value pairs returned by the server
   */
  public Map getGroupInfo() {
    return groupInfo;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy