View Source Elsa.Group.Acknowledger (Elsa.fi v3.1.0)
Handles acknowledgement of messages to the group coordinator to prevent the group manager from queuing up messages for acknowledgement when events such as a rebalance occur.
Link to this section Summary
Functions
Trigger acknowledgement of processed messages back to the cluster.
Trigger acknowledgement of processed messages back to the cluster.
Returns a specification to start this module under a supervisor.
Retrieve the latest offset for a topic and partition. Primarily used for reinitializing consumer workers to the latest unacknowledged offset after a rebalance or other disruption.
Update the latest offset for a topic and partition. Primarily used when a consumer worker gets a partition assignments with an offset, so that future calls to get_latest_offset will return an up-to-date result.
Instantiate an acknowledger process and register it to the Elsa registry.
Sync the group generation ID back to the acknowledger state for validation.
Link to this section Functions
@spec ack(Elsa.connection(), %{ topic: Elsa.topic(), partition: Elsa.partition(), generation_id: Elsa.Group.Manager.generation_id(), offset: integer() }) :: :ok
Trigger acknowledgement of processed messages back to the cluster.
@spec ack( Elsa.connection(), Elsa.topic(), Elsa.partition(), Elsa.Group.Manager.generation_id(), integer() ) :: :ok
Trigger acknowledgement of processed messages back to the cluster.
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec get_latest_offset(GenServer.server(), Elsa.topic(), Elsa.partition()) :: Elsa.Group.Manager.begin_offset() | nil
Retrieve the latest offset for a topic and partition. Primarily used for reinitializing consumer workers to the latest unacknowledged offset after a rebalance or other disruption.
@spec set_latest_offset( GenServer.server(), Elsa.topic(), Elsa.partition(), Elsa.Group.Manager.begin_offset() ) :: :ok
Update the latest offset for a topic and partition. Primarily used when a consumer worker gets a partition assignments with an offset, so that future calls to get_latest_offset will return an up-to-date result.
Failing to set this on partition assignment can cause a rewind to occur if the worker restarts before acking anything.
@spec start_link(term()) :: GenServer.on_start()
Instantiate an acknowledger process and register it to the Elsa registry.
@spec update_generation_id(GenServer.server(), Elsa.Group.Manager.generation_id()) :: :ok
Sync the group generation ID back to the acknowledger state for validation.