View Source KafkaEx.Consumer.ConsumerGroup.Heartbeat (kafka_ex v1.0.1)

GenServer to send heartbeats to the broker

A HeartbeatRequest is sent periodically by each active group member (after completing the join/sync phase) to inform the broker that the member is still alive and participating in the group. If a group member fails to send a heartbeat before the group's session timeout expires, the coordinator removes that member from the group and initiates a rebalance.

HeartbeatResponse allows the coordinating broker to communicate the group's status to each member:

  • :no_error indicates that the group is up to date and no action is needed.
  • :rebalance_in_progress a rebalance has been initiated, so each member should re-join.
  • :unknown_member_id means the coordinator has forgotten this member; it must re-join with a fresh (reset) member_id.
  • :illegal_generation means this member's generation is stale; it must re-join (keeping its member_id) to pick up the new generation.
  • :fenced_instance_id (another member claimed this member's static group.instance.id) and :group_authorization_failed (no access to the group) are terminal; the member stops rather than re-joining.

For the recoverable conditions the heartbeat process exits with a {:shutdown, _} reason that the KafkaEx.Consumer.ConsumerGroup.Manager traps and turns into a re-join (resetting identity per the reason) or a clean terminal stop. (see KafkaEx.Consumer.ConsumerGroup.Manager)

Summary

Functions

Returns a specification to start this module under a supervisor.

Callback implementation for GenServer.init/1.

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Callback implementation for GenServer.init/1.