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

Represents the result of a CreateTopics API call.

This struct contains the results for all topics that were requested to be created, including any errors that occurred during creation.

Fields

  • topic_results - List of TopicResult structs, one for each topic
  • throttle_time_ms - Time in milliseconds the request was throttled (V2+)

Example

%CreateTopics{
  topic_results: [
    %TopicResult{topic: "my-topic", error: :no_error, error_message: nil},
    %TopicResult{topic: "existing-topic", error: :topic_already_exists, error_message: "Topic already exists"}
  ],
  throttle_time_ms: 0
}

Summary

Functions

Builds a CreateTopics struct from response data.

Returns the list of topics that failed to be created.

Returns the result for a specific topic.

Returns true if all topics were created successfully.

Returns the list of topics that were created successfully.

Types

@type t() :: %KafkaEx.Messages.CreateTopics{
  throttle_time_ms: non_neg_integer() | nil,
  topic_results: [KafkaEx.Messages.CreateTopics.TopicResult.t()]
}

Functions

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

Builds a CreateTopics struct from response data.

Link to this function

failed_topics(create_topics)

View Source
@spec failed_topics(t()) :: [KafkaEx.Messages.CreateTopics.TopicResult.t()]

Returns the list of topics that failed to be created.

Link to this function

get_topic_result(create_topics, topic_name)

View Source
@spec get_topic_result(t(), String.t()) ::
  KafkaEx.Messages.CreateTopics.TopicResult.t() | nil

Returns the result for a specific topic.

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

Returns true if all topics were created successfully.

Link to this function

successful_topics(create_topics)

View Source
@spec successful_topics(t()) :: [KafkaEx.Messages.CreateTopics.TopicResult.t()]

Returns the list of topics that were created successfully.