View Source KafkaEx.Protocol.Kayrock.SyncGroup.ResponseHelpers (kafka_ex v1.0.0-rc.1)

Shared helper functions for parsing SyncGroup responses across all versions (V0-V4).

Version differences:

  • V0: No throttle_time_ms field
  • V1-V3: Adds throttle_time_ms to the response
  • V4: Flexible version (KIP-482) -- Kayrock handles compact bytes deserialization
    transparently. The `assignment` field may be raw binary instead of
    `%Kayrock.MemberAssignment{}` -- `extract_partition_assignments/1` handles both.

Summary

Functions

Extracts partition assignments from a member assignment.

Parses a SyncGroup response using the provided throttle_time extractor.

Parses a V0 response (no throttle_time_ms).

Parses a V1+ response (includes throttle_time_ms).

Functions

Link to this function

extract_partition_assignments(arg1)

View Source

Extracts partition assignments from a member assignment.

Handles both %Kayrock.MemberAssignment{} structs (V0-V3) and raw binary or other formats (V4 compact_bytes or edge cases). Returns empty list for unrecognized formats.

Link to this function

parse_response(response, throttle_time_extractor)

View Source
@spec parse_response(map(), (map() -> non_neg_integer() | nil)) ::
  {:ok, KafkaEx.Messages.SyncGroup.t()} | {:error, KafkaEx.Client.Error.t()}

Parses a SyncGroup response using the provided throttle_time extractor.

Link to this function

parse_v0_response(response)

View Source
@spec parse_v0_response(map()) ::
  {:ok, KafkaEx.Messages.SyncGroup.t()} | {:error, KafkaEx.Client.Error.t()}

Parses a V0 response (no throttle_time_ms).

Link to this function

parse_v1_plus_response(response)

View Source
@spec parse_v1_plus_response(map()) ::
  {:ok, KafkaEx.Messages.SyncGroup.t()} | {:error, KafkaEx.Client.Error.t()}

Parses a V1+ response (includes throttle_time_ms).