diff --git a/CHANGELOG.md b/CHANGELOG.md index d697493c..7e562a58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Changelog +- 4.5.0 + - Expose `create_partitions` from the underlying kafka_protocol + - Allow partitions to automatically have producers started for newly discovered partitions. - 4.4.6 - Upgrade to `kafka_protocol-4.2.8` for dependency (`crc32cer-1.0.4`) to fix its link error. diff --git a/src/brod.erl b/src/brod.erl index 415ad28c..d49dba5f 100644 --- a/src/brod.erl +++ b/src/brod.erl @@ -96,6 +96,8 @@ %% Topic APIs -export([ create_topics/3 , create_topics/4 + , create_partitions/3 + , create_partitions/4 , delete_topics/3 , delete_topics/4 ]). @@ -190,6 +192,7 @@ -type endpoint() :: {hostname(), portnum()}. -type topic() :: kpro:topic(). -type topic_config() :: kpro:struct(). +-type topic_partition_config() :: kpro:struct(). -type partition() :: kpro:partition(). -type topic_partition() :: {topic(), partition()}. -type offset() :: kpro:offset(). %% Physical offset (an integer) @@ -1049,6 +1052,44 @@ create_topics(Hosts, TopicConfigs, RequestConfigs) -> create_topics(Hosts, TopicConfigs, RequestConfigs, Options) -> brod_utils:create_topics(Hosts, TopicConfigs, RequestConfigs, Options). +%% @equiv create_partitions(Hosts, TopicPartitionConfigs, RequestConfigs, []) +-spec create_partitions([endpoint()], [topic_partition_config()], #{timeout => kpro:int32()}) -> + ok | {error, any()}. +create_partitions(Hosts, TopicPartitionConfigs, RequestConfigs) -> + brod_utils:create_partitions(Hosts, TopicPartitionConfigs, RequestConfigs). + +%% @doc Create partitions(s) in kafka. +%%