Enum Class MemberState

java.lang.Object
java.lang.Enum<MemberState>
org.apache.kafka.clients.consumer.internals.MemberState
All Implemented Interfaces:
Serializable, Comparable<MemberState>, Constable

public enum MemberState extends Enum<MemberState>
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Member has completed reconciling an assignment received, and stays in this state only until the next heartbeat request is sent out to acknowledge the assignment to the server.
    The member failed with an unrecoverable error received in a heartbeat response.
    Member transitions to this state when it receives a Errors.UNKNOWN_MEMBER_ID or Errors.FENCED_MEMBER_EPOCH error from the broker, indicating that it has been left out of the group.
    Member is attempting to join a consumer group.
    Member has committed offsets and releases its assignment, so it stays in this state until the next heartbeat request is sent out with epoch -1 or -2 to effectively leave the group.
    The member transitions to this state after a call to unsubscribe.
    Member has received a new target assignment (partitions could have been assigned or revoked), and it is processing it.
    Member is active in a group and has processed all assignments received.
    An intermediate state indicating the consumer is staled because the user has not polled the consumer within the max.poll.interval.ms time bound; therefore causing the member to leave the group.
    Member has a group id, but it is not subscribed to any topic to receive automatic assignments.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
     
    Returns the enum constant of this class with the specified name.
    static MemberState[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • UNSUBSCRIBED

      public static final MemberState UNSUBSCRIBED
      Member has a group id, but it is not subscribed to any topic to receive automatic assignments. This will be the state when the member has never subscribed, or when it has unsubscribed from all topics. While in this state the member can commit offsets but won't be an active member of the consumer group (no heartbeats sent).
    • JOINING

      public static final MemberState JOINING
      Member is attempting to join a consumer group. While in this state, the member will send heartbeat requests on the interval, with epoch 0, until it gets a response with an epoch > 0 or a fatal failure. A member transitions to this state when it tries to join the group for the first time with a call to subscribe, or when it has been fenced and tries to re-join.
    • RECONCILING

      public static final MemberState RECONCILING
      Member has received a new target assignment (partitions could have been assigned or revoked), and it is processing it. While in this state, the member will continue to send heartbeat on the interval, and reconcile the assignment (it will commit offsets if needed, invoke the user callbacks for onPartitionsAssigned or onPartitionsRevoked, and make the new assignment effective). Note that while in this state the member may be trying to resolve metadata for the target assignment, or triggering commits/callbacks if topic names already resolved.
    • ACKNOWLEDGING

      public static final MemberState ACKNOWLEDGING
      Member has completed reconciling an assignment received, and stays in this state only until the next heartbeat request is sent out to acknowledge the assignment to the server. This state indicates that the next heartbeat request must be sent without waiting for the heartbeat interval to expire. Note that once the ack is sent, the member could go back to RECONCILING if it still has assignment waiting to be reconciled (assignments waiting for metadata, assignments for which metadata was resolved, or new assignments received from the broker)
    • STABLE

      public static final MemberState STABLE
      Member is active in a group and has processed all assignments received. While in this state, the member will send heartbeats on the interval.
    • FENCED

      public static final MemberState FENCED
      Member transitions to this state when it receives a Errors.UNKNOWN_MEMBER_ID or Errors.FENCED_MEMBER_EPOCH error from the broker, indicating that it has been left out of the group. While in this state, the member will stop sending heartbeats, it will give up its partitions by invoking the user callbacks for onPartitionsLost, and then transition to JOINING to re-join the group as a new member.
    • PREPARE_LEAVING

      public static final MemberState PREPARE_LEAVING
      The member transitions to this state after a call to unsubscribe. While in this state, the member will stop sending heartbeats, will commit offsets if needed and release its assignment (calling user's callback for partitions revoked or lost). When all these actions complete, the member will transition out of this state into LEAVING to effectively leave the group.
    • LEAVING

      public static final MemberState LEAVING
      Member has committed offsets and releases its assignment, so it stays in this state until the next heartbeat request is sent out with epoch -1 or -2 to effectively leave the group. This state indicates that the next heartbeat request must be sent without waiting for the heartbeat interval to expire.
    • FATAL

      public static final MemberState FATAL
      The member failed with an unrecoverable error received in a heartbeat response. This in an unrecoverable state where the member won't send any requests to the broker and cannot perform any other transition.
    • STALE

      public static final MemberState STALE
      An intermediate state indicating the consumer is staled because the user has not polled the consumer within the max.poll.interval.ms time bound; therefore causing the member to leave the group. The member rejoins on the next poll.
  • Method Details

    • values

      public static MemberState[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MemberState valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getPreviousValidStates

      public List<MemberState> getPreviousValidStates()
    • canHandleNewAssignment

      public boolean canHandleNewAssignment()
      Returns:
      True if the member is in a state where it should reconcile the new assignment. Expected to be true whenever the member is part of the group and intends of staying in it (ex. false when the member is preparing to leave the group).