Skip to content

Commit 2dece8b

Browse files
authored
Merge pull request #501 from dipendra-singh/rdkafka_idempotency
out_rdkafka2: enable idempotency for kafka producers
2 parents b6b50a0 + a223581 commit 2dece8b

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ If `ruby-kafka` doesn't fit your kafka environment, check `rdkafka2` plugin inst
212212
discard_kafka_delivery_failed (bool) :default => false (No discard)
213213
partitioner_hash_function (enum) (crc32|murmur2) :default => 'crc32'
214214
share_producer (bool) :default => false
215+
idempotent (bool) :default => false
215216

216217
# If you intend to rely on AWS IAM auth to MSK with long lived credentials
217218
# https://docs.aws.amazon.com/msk/latest/developerguide/iam-access-control.html

lib/fluent/plugin/out_rdkafka2.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class Fluent::Rdkafka2Output < Output
4242
config_param :default_message_key, :string, :default => nil
4343
config_param :partition_key, :string, :default => 'partition', :desc => "Field for kafka partition"
4444
config_param :default_partition, :integer, :default => nil
45+
config_param :idempotent, :bool, :default => false, :desc => 'Enable idempotent producer'
4546
config_param :output_data_type, :string, :default => 'json', :obsoleted => "Use <format> section instead"
4647
config_param :output_include_tag, :bool, :default => false, :obsoleted => "Use <inject> section instead"
4748
config_param :output_include_time, :bool, :default => false, :obsoleted => "Use <inject> section instead"
@@ -286,6 +287,7 @@ def build_config
286287
config[:"batch.num.messages"] = @rdkafka_message_max_num if @rdkafka_message_max_num
287288
config[:"sasl.username"] = @username if @username
288289
config[:"sasl.password"] = @password if @password
290+
config[:"enable.idempotence"] = @idempotent if @idempotent
289291

290292
@rdkafka_options.each { |k, v|
291293
config[k.to_sym] = v

0 commit comments

Comments
 (0)