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

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

Version differences:

  • V0: No throttle_time_ms field. Returns {:ok, :no_error} on success.
  • V1-V3: Adds throttle_time_ms to the response. Returns {:ok, %Heartbeat{}} on success.
  • V4: Flexible version (KIP-482) -- Kayrock handles compact encoding/decoding
    transparently. Domain-relevant fields are identical to V1-V3.

Summary

Functions

Parses a V0 response (no throttle_time_ms).

Parses a V1+ response (includes throttle_time_ms).

Functions

Link to this function

parse_v0_response(response)

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

Parses a V0 response (no throttle_time_ms).

Returns {:ok, :no_error} on success to preserve the existing V0 contract.

Link to this function

parse_v1_plus_response(response)

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

Parses a V1+ response (includes throttle_time_ms).

Returns {:ok, %Heartbeat{}} on success with throttle_time_ms populated.