View Source KlifeProtocol.Messages.CreateTopics (Klife Protocol v0.7.0)

Kafka protocol CreateTopics message

Request versions summary:

  • Version 1 adds validateOnly.
  • Version 4 makes partitions/replicationFactor optional even when assignments are not present (KIP-464)
  • Version 5 is the first flexible version. Version 5 also returns topic configs in the response (KIP-525).
  • Version 6 is identical to version 5 but may return a THROTTLING_QUOTA_EXCEEDED error in the response if the topics creation is throttled (KIP-599).
  • Version 7 is the same as version 6.

Response versions summary:

  • Version 1 adds a per-topic error message string.
  • Version 2 adds the throttle time.
  • Starting in version 3, on quota violation, brokers send out responses before throttling.
  • Version 4 makes partitions/replicationFactor optional even when assignments are not present (KIP-464).
  • Version 5 is the first flexible version. Version 5 also returns topic configs in the response (KIP-525).
  • Version 6 is identical to version 5 but may return a THROTTLING_QUOTA_EXCEEDED error in the response if the topics creation is throttled (KIP-599).
  • Version 7 returns the topic ID of the newly created topic if creation is successful.

Link to this section Summary

Functions

Returns the message api key number.

Receive a binary in the kafka wire format and deserialize it into a map.

Returns the current max supported version of this message.

Returns the current min supported version of this message.

Receives a map and serialize it to kafka wire format of the given version.

Link to this section Functions

Returns the message api key number.

Link to this function

deserialize_response(data, version, with_header? \\ true)

View Source

Receive a binary in the kafka wire format and deserialize it into a map.

Response content fields:

  • throttle_time_ms: The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota. (int32 | versions 2+)

  • topics: Results for each topic we tried to create. ([]CreatableTopicResult | versions 0+)

    • name: The topic name. (string | versions 0+)

    • topic_id: The unique topic ID (uuid | versions 7+)

    • error_code: The error code, or 0 if there was no error. (int16 | versions 0+)

    • error_message: The error message, or null if there was no error. (string | versions 1+)

    • topic_config_error_code: Optional topic config error returned if configs are not returned in the response. (int16 | versions 5+)

    • num_partitions: Number of partitions of the topic. (int32 | versions 5+)

    • replication_factor: Replication factor of the topic. (int16 | versions 5+)

    • configs: Configuration of the topic. ([]CreatableTopicConfigs | versions 5+)

      • name: The configuration name. (string | versions 5+)

      • value: The configuration value. (string | versions 5+)

      • read_only: True if the configuration is read-only. (bool | versions 5+)

      • config_source: The configuration source. (int8 | versions 5+)

      • is_sensitive: True if this configuration is sensitive. (bool | versions 5+)

Returns the current max supported version of this message.

Returns the current min supported version of this message.

Link to this function

serialize_request(map, version)

View Source

Receives a map and serialize it to kafka wire format of the given version.

Input content fields:

  • topics: The topics to create. ([]CreatableTopic | versions 0+)

    • name: The topic name. (string | versions 0+)

    • num_partitions: The number of partitions to create in the topic, or -1 if we are either specifying a manual partition assignment or using the default partitions. (int32 | versions 0+)

    • replication_factor: The number of replicas to create for each partition in the topic, or -1 if we are either specifying a manual partition assignment or using the default replication factor. (int16 | versions 0+)

    • assignments: The manual partition assignment, or the empty array if we are using automatic assignment. ([]CreatableReplicaAssignment | versions 0+)

      • partition_index: The partition index. (int32 | versions 0+)

      • broker_ids: The brokers to place the partition on. ([]int32 | versions 0+)

    • configs: The custom topic configurations to set. ([]CreateableTopicConfig | versions 0+)

      • name: The configuration name. (string | versions 0+)

      • value: The configuration value. (string | versions 0+)

  • timeout_ms: How long to wait in milliseconds before timing out the request. (int32 | versions 0+)

  • validate_only: If true, check that the topics can be created as specified, but don't create anything. (bool | versions 1+)