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
@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.
@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.
@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).
@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).