View Source KafkaEx.Protocol.Kayrock.LeaveGroup.RequestHelpers (kafka_ex v1.0.0-rc.1)

Shared helper functions for building LeaveGroup requests across all versions.

Version differences:

  • V0-V2: group_id, member_id (all schema-identical)
  • V3-V4: STRUCTURAL CHANGE (KIP-345 batch leave) -- replaces member_id with members array. Each member has member_id and group_instance_id.
  • V4: Flexible version (KIP-482) with compact encoding -- Kayrock handles encoding

Summary

Functions

Builds a LeaveGroup V0-V2 request by populating the request template with extracted fields. This is shared logic between V0-V2 requests as they have identical structure.

Builds a LeaveGroup V3+ request (KIP-345 batch leave).

Extracts common fields from request options (V0-V2).

Functions

Link to this function

build_request_from_template(request_template, opts)

View Source
@spec build_request_from_template(map(), Keyword.t()) :: map()

Builds a LeaveGroup V0-V2 request by populating the request template with extracted fields. This is shared logic between V0-V2 requests as they have identical structure.

Link to this function

build_v3_plus_request(request_template, opts)

View Source
@spec build_v3_plus_request(map(), Keyword.t()) :: map()

Builds a LeaveGroup V3+ request (KIP-345 batch leave).

V3 introduces a structural change: the single member_id field is replaced with a members array. Each member in the array has:

  • member_id (required)
  • group_instance_id (optional, for static membership)

V4 is the flexible version (KIP-482) with the same logical fields -- Kayrock handles compact encoding.

Options

  • group_id (required): The consumer group ID
  • members (required): List of member maps, each with :member_id and optionally :group_instance_id
Link to this function

extract_common_fields(opts)

View Source
@spec extract_common_fields(Keyword.t()) :: %{
  group_id: String.t(),
  member_id: String.t()
}

Extracts common fields from request options (V0-V2).