Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

out_kafka2: Broker pool to take care of fetching metadata #503

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/fluent/plugin/kafka_producer_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ def initialize(cluster:, transaction_manager:, logger:, instrumenter:, compresso
@max_buffer_bytesize = max_buffer_bytesize
@compressor = compressor
@partitioner = partitioner

# The set of topics that are produced to.
@target_topics = Set.new

# A buffer organized by topic/partition.
@buffer = MessageBuffer.new

Expand All @@ -116,7 +120,8 @@ def produce(value, key: nil, partition: nil, partition_key: nil, headers: EMPTY_
if @transaction_manager.transactional? && !@transaction_manager.in_transaction?
raise 'You must trigger begin_transaction before producing messages'
end


@target_topics.add(topic)
@pending_message_queue.write(message)

nil
Expand Down Expand Up @@ -187,7 +192,7 @@ def transaction
def deliver_messages_with_retries
attempt = 0

#@cluster.add_target_topics(@target_topics)
@cluster.add_target_topics(@target_topics)

operation = ProduceOperation.new(
cluster: @cluster,
Expand Down