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

Sends periodic HeartbeatRequests for a joined consumer-group member.

The Manager starts this process linked and trapping exits. Every failure this process can catch is turned into a structured {:shutdown, reason} exit that the Manager maps to a rejoin or a terminal stop. The one failure it cannot catch — :kill (untrappable; no callback runs) — reaches the Manager as a plain :killed EXIT.

Lifecycle

Manager start_link (linked) Heartbeat
                                      loop: every heartbeat_interval
                                    
                      send HeartbeatRequest to the broker
                                    
                 :no_error  error / crash
                                                  
              keep ticking                exit {:shutdown, reason}

exit reason                                   Manager action

:rebalance                                    rejoin
{:rejoin, :illegal_generation}                rejoin, keep member_id
{:rejoin, :unknown_member_id}                 rejoin, reset member_id
{:error, recoverable}  (e.g. :timeout)        rejoin
{:error, non-recoverable} | {:terminal, _}    terminal stop
:killed  (uncatchable)                        rejoin

See KafkaEx.Consumer.ConsumerGroup.Manager for the EXIT-clause handling.

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.