refactor: rename `{first_,}key_dispatch` partition strategy option

This commit is contained in:
Thales Macedo Garitezi 2023-04-20 11:00:48 -03:00
parent 631863d843
commit 4f2262129b
2 changed files with 6 additions and 3 deletions

View File

@ -83,7 +83,7 @@ fields(producer_opts) ->
{pulsar_topic, mk(binary(), #{required => true, desc => ?DESC("producer_pulsar_topic")})},
{strategy,
mk(
hoconsc:enum([random, roundrobin, first_key_dispatch]),
hoconsc:enum([random, roundrobin, key_dispatch]),
#{default => random, desc => ?DESC("producer_strategy")}
)},
{buffer, mk(ref(producer_buffer), #{required => false, desc => ?DESC("producer_buffer")})},

View File

@ -28,7 +28,7 @@
}.
-type buffer_mode() :: memory | disk | hybrid.
-type compression_mode() :: no_compression | snappy | zlib.
-type partition_strategy() :: random | roundrobin | first_key_dispatch.
-type partition_strategy() :: random | roundrobin | key_dispatch.
-type message_template_raw() :: #{
key := binary(),
value := binary()
@ -290,7 +290,7 @@ start_producer(Config, InstanceId, ClientId, ClientOpts) ->
name => ProducerName,
retention_period => RetentionPeriod,
ssl_opts => SSLOpts,
strategy => Strategy,
strategy => partition_strategy(Strategy),
tcp_opts => [{sndbuf, SendBuffer}]
},
ProducerOpts = maps:merge(ReplayQOpts, ProducerOpts0),
@ -394,3 +394,6 @@ get_producer_status(Producers) ->
true -> connected;
false -> connecting
end.
partition_strategy(key_dispatch) -> first_key_dispatch;
partition_strategy(Strategy) -> Strategy.