Skip to content

Commit

Permalink
Merge pull request #2 from madebydna/aws_msk_iam_improvements
Browse files Browse the repository at this point in the history
Fixing CI failures with Ruby 2.7
  • Loading branch information
madebydna authored Dec 8, 2024
2 parents ed87e48 + a0fac67 commit c966002
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@ source 'https://rubygems.org'

# Specify your gem's dependencies in fluent-plugin-kafka.gemspec
gemspec

gem 'json', '2.7.3' # override of 2.7.4 version
gem 'rdkafka', ENV['RDKAFKA_VERSION_MIN_RANGE'], ENV['RDKAFKA_VERSION_MAX_RANGE'] if ENV['USE_RDKAFKA']
10 changes: 8 additions & 2 deletions fluent-plugin-kafka.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ Gem::Specification.new do |gem|
gem.add_dependency "fluentd", [">= 0.10.58", "< 2"]
gem.add_dependency 'ltsv'
gem.add_dependency 'ruby-kafka', '>= 1.5.0', '< 2'
gem.add_dependency 'rdkafka'
gem.add_dependency 'aws-msk-iam-sasl-signer'

if ENV['USE_RDKAFKA']
gem.add_dependency 'rdkafka', [ENV['RDKAFKA_VERSION_MIN_RANGE'], ENV['RDKAFKA_VERSION_MAX_RANGE']]
if Gem::Version.new('3.0' >= Gem::Version.new(RUBY_VERSION)
gem.add_dependency 'aws-msk-iam-sasl-signer', '~> 0.1.1'
end
end

gem.add_development_dependency "rake", ">= 0.9.2"
gem.add_development_dependency "test-unit", ">= 3.0.8"
gem.add_development_dependency "test-unit-rr", "~> 1.0"
Expand Down
7 changes: 4 additions & 3 deletions lib/fluent/plugin/out_rdkafka2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
require 'fluent/plugin/kafka_plugin_util'

require 'rdkafka'
require 'aws_msk_iam_sasl_signer'

begin
rdkafka_version = Gem::Version::create(Rdkafka::VERSION)
Expand All @@ -21,6 +20,10 @@
raise "unable to patch rdkafka."
end

if Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('3.0')
require 'aws-msk-iam-sasl-signer'
end

module Fluent::Plugin
class Fluent::Rdkafka2Output < Output
Fluent::Plugin.register_output('rdkafka2', self)
Expand Down Expand Up @@ -208,7 +211,6 @@ def add(level, message = nil)
end
end
}
# HERE -----------------
Rdkafka::Config.logger = log
config = build_config
@rdkafka = Rdkafka::Config.new(config)
Expand All @@ -217,7 +219,6 @@ def add(level, message = nil)
if config[:"security.protocol"] == "sasl_ssl" && config[:"sasl.mechanisms"] == "OAUTHBEARER"
Rdkafka::Config.oauthbearer_token_refresh_callback = method(:refresh_token)
end
# HERE -----------------

if @default_topic.nil?
if @use_default_for_unknown_topic || @use_default_for_unknown_partition_error
Expand Down

0 comments on commit c966002

Please sign in to comment.