brod_group_member
behaviour callbacks to allow a
process to act as a group member without having to deal with Kafka
group protocol details.
This module defines the brod_group_member behaviour.
Required callback functions: get_committed_offsets/2, assignments_received/4, assignments_revoked/1.
Optional callback functions: assign_partitions/3, user_data/1.
Implement brod_group_member
behaviour callbacks to allow a
process to act as a group member without having to deal with Kafka
group protocol details. A typical workflow:
1. Spawn a group coordinator by calling
brod_group_coordinator:start_link/6
.
2. Subscribe to partitions received in the assignments from
assignments_received/4
callback.
3. Receive messages from the assigned partitions (delivered by
the partition workers (the pollers) implemented in brod_consumer
).
4. Unsubscribe from all previously subscribed partitions when
assignments_revoked/1
is called.
For group members that commit offsets to Kafka, do:
1. Call brod_group_coordinator:ack/4
. to acknowledge sucessful
consumption of the messages. Group coordinator will commit the
acknowledged offsets at configured interval.
2. Call brod_group_coordinator:commit_offsets/2
to force an immediate offset commit if necessary.
For group members that manage offsets locally, do:
1. Implement theget_committed_offsets/2
callback.
This callback is evaluated every time when new assignments are received.Generated by EDoc