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

Represents the API versions supported by a Kafka broker.

This struct contains information about which Kafka API versions the broker supports, enabling the client to negotiate compatible API versions for all operations.

Summary

Types

The Kafka API key identifier (e.g., 0 for Produce, 1 for Fetch, 3 for Metadata, 18 for ApiVersions)

A single API version entry

t()

Functions

Builds an ApiVersions struct from response data.

Finds the maximum supported version for a given API.

Finds the minimum supported version for a given API.

Checks if a specific API version is supported.

Types

@type api_key() :: non_neg_integer()

The Kafka API key identifier (e.g., 0 for Produce, 1 for Fetch, 3 for Metadata, 18 for ApiVersions)

@type api_version() :: %{
  min_version: non_neg_integer(),
  max_version: non_neg_integer()
}

A single API version entry

  • min_version: Minimum supported version for this API
  • max_version: Maximum supported version for this API
@type t() :: %KafkaEx.Messages.ApiVersions{
  api_versions: %{required(api_key()) => api_version()},
  throttle_time_ms: nil | non_neg_integer()
}

Functions

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

Builds an ApiVersions struct from response data.

Link to this function

max_version_for_api(api_versions, api_key)

View Source
@spec max_version_for_api(t(), non_neg_integer()) ::
  {:ok, non_neg_integer()} | {:error, :unsupported_api}

Finds the maximum supported version for a given API.

Link to this function

min_version_for_api(api_versions, api_key)

View Source
@spec min_version_for_api(t(), non_neg_integer()) ::
  {:ok, non_neg_integer()} | {:error, :unsupported_api}

Finds the minimum supported version for a given API.

Link to this function

version_supported?(api_versions, api_key, version)

View Source
@spec version_supported?(t(), non_neg_integer(), non_neg_integer()) :: boolean()

Checks if a specific API version is supported.