View Source KafkaEx.Messages.FindCoordinator (kafka_ex v1.0.0-rc.1)

This module represents FindCoordinator response from Kafka.

FindCoordinator is used to discover the coordinator broker for a consumer group or transactional producer.

Coordinator Types

  • 0 (:group) - Consumer group coordinator
  • 1 (:transaction) - Transaction coordinator

API Version Differences

  • V0: Uses group_id parameter, returns coordinator info with error_code
  • V1: Uses coordinator_key + coordinator_type, adds throttle_time_ms and error_message

Summary

Functions

Builds a FindCoordinator struct from response data.

Returns the node_id of the coordinator if successful, nil otherwise.

Converts a coordinator type atom to its integer value.

Converts an integer coordinator type to its atom representation.

Returns true if the response indicates success (no error).

Types

@type coordinator_type() :: :group | :transaction
@type t() :: %KafkaEx.Messages.FindCoordinator{
  coordinator: KafkaEx.Cluster.Broker.t() | nil,
  error_code: atom(),
  error_message: binary() | nil,
  throttle_time_ms: non_neg_integer() | nil
}

Functions

@spec build(Keyword.t()) :: t()

Builds a FindCoordinator struct from response data.

Link to this function

coordinator_node_id(find_coordinator)

View Source
@spec coordinator_node_id(t()) :: non_neg_integer() | nil

Returns the node_id of the coordinator if successful, nil otherwise.

Link to this function

coordinator_type_to_int(atom)

View Source
@spec coordinator_type_to_int(coordinator_type()) :: 0 | 1

Converts a coordinator type atom to its integer value.

Link to this function

int_to_coordinator_type(int)

View Source
@spec int_to_coordinator_type(0 | 1) :: coordinator_type()

Converts an integer coordinator type to its atom representation.

Link to this function

success?(find_coordinator)

View Source
@spec success?(t()) :: boolean()

Returns true if the response indicates success (no error).