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

Shared utility functions for parsing FindCoordinator responses.

Summary

Functions

Checks the error code and returns success or error result.

Parses coordinator data from response into a Broker struct.

Parses a V0 response (no throttle_time_ms, no error_message).

Parses a V1 response (includes throttle_time_ms and error_message).

Functions

Link to this function

check_error(error_code, fields)

View Source
@spec check_error(integer(), Keyword.t()) ::
  {:ok, Keyword.t()} | {:error, KafkaEx.Client.Error.t()}

Checks the error code and returns success or error result.

Returns {:ok, parsed_fields} if no error, {:error, Error.t()} otherwise.

Link to this function

parse_coordinator_from_response(response)

View Source
@spec parse_coordinator_from_response(map()) :: KafkaEx.Cluster.Broker.t() | nil

Parses coordinator data from response into a Broker struct.

In kayrock v1, coordinator fields (node_id, host, port) are flattened directly on the response struct rather than nested in a coordinator field.

Link to this function

parse_v0_response(response)

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

Parses a V0 response (no throttle_time_ms, no error_message).

Link to this function

parse_v1_response(response)

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

Parses a V1 response (includes throttle_time_ms and error_message).