View Source KafkaEx.Protocol.Kayrock.CreateTopics.RequestHelpers (kafka_ex v1.0.0-rc.1)
Shared helper functions for building CreateTopics requests across all versions.
Summary
Functions
Converts config entries to Kayrock format.
Converts replica assignments to Kayrock format.
Converts topic configuration to Kayrock format.
Builds a CreateTopics request for V1+ (V1-V5 have identical request schemas).
Extracts topic configurations from options.
Functions
Converts config entries to Kayrock format.
Converts replica assignments to Kayrock format.
Converts topic configuration to Kayrock format.
Builds a CreateTopics request for V1+ (V1-V5 have identical request schemas).
All V1+ versions support:
- create_topic_requests: array of topic configs
- timeout: int32
- validate_only: boolean
V3/V4 are pure version bumps with identical schemas to V1/V2. V5 is the flexible version (KIP-482) but the logical fields are the same; compact encoding is handled by Kayrock's serializer.
@spec extract_common_fields(Keyword.t()) :: %{ topics: list(), timeout: non_neg_integer() }
Extracts topic configurations from options.
Required Options
:topics- List of topic configurations, each being a map or keyword list with::topic- Topic name (required):num_partitions- Number of partitions (default: -1 for broker default):replication_factor- Replication factor (default: -1 for broker default):replica_assignment- Manual replica assignment (default: []):config_entries- Topic configuration entries (default: [])
:timeout- Request timeout in milliseconds (required)
Optional
:validate_only- If true, only validate the request without creating topics (V1+)