Skip to content

Commit

Permalink
remove max_bytes_per_partition hardcoded config
Browse files Browse the repository at this point in the history
  • Loading branch information
leonmaia committed May 30, 2022
1 parent 73f424f commit d85ab18
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
7 changes: 2 additions & 5 deletions lib/racecar/consumer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module Racecar
class Consumer
Subscription = Struct.new(:topic, :start_from_beginning, :max_bytes_per_partition, :additional_config)
Subscription = Struct.new(:topic, :start_from_beginning, :additional_config)

class << self
attr_accessor :max_wait_time
Expand All @@ -22,19 +22,16 @@ def subscriptions
# @param topics [String] one or more topics to subscribe to.
# @param start_from_beginning [Boolean] whether to start from the beginning or the end
# of each partition.
# @param max_bytes_per_partition [Integer] the maximum number of bytes to fetch from
# each partition at a time.
# @param additional_config [Hash] Configuration properties for consumer.
# See https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md
# @return [nil]
def subscribes_to(
*topics,
start_from_beginning: true,
max_bytes_per_partition: 1048576,
additional_config: {}
)
topics.each do |topic|
subscriptions << Subscription.new(topic, start_from_beginning, max_bytes_per_partition, additional_config)
subscriptions << Subscription.new(topic, start_from_beginning, additional_config)
end
end
end
Expand Down
1 change: 0 additions & 1 deletion lib/racecar/consumer_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ def rdkafka_config(subscription)
"client.id" => @config.client_id,
"enable.partition.eof" => false,
"fetch.max.bytes" => @config.max_bytes,
"message.max.bytes" => subscription.max_bytes_per_partition,
"fetch.min.bytes" => @config.fetch_min_bytes,
"fetch.wait.max.ms" => @config.max_wait_time_ms,
"group.id" => @config.group_id,
Expand Down

0 comments on commit d85ab18

Please sign in to comment.