Skip to content

Commit

Permalink
align patches with naming from rdkafka (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
mensfeld authored Jun 17, 2022
1 parent fef12a0 commit ac39b30
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# WaterDrop changelog

## 2.3.1 (2022-06-17)
- Update rdkafka patches to align with `0.12.0` and `0.11.1` support.

## 2.3.0 (2022-04-03)
- Rename StdoutListener to LoggerListener (#240)

Expand Down
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
waterdrop (2.3.0)
waterdrop (2.3.1)
concurrent-ruby (>= 1.1)
dry-configurable (~> 0.13)
dry-monitor (~> 0.5)
Expand Down Expand Up @@ -66,9 +66,9 @@ GEM
i18n (1.10.0)
concurrent-ruby (~> 1.0)
mini_portile2 (2.8.0)
minitest (5.15.0)
minitest (5.16.0)
rake (13.0.6)
rdkafka (0.11.1)
rdkafka (0.12.0)
ffi (~> 1.15)
mini_portile2 (~> 2.6)
rake (> 12)
Expand All @@ -93,7 +93,7 @@ GEM
simplecov_json_formatter (0.1.4)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
zeitwerk (2.5.4)
zeitwerk (2.6.0)

PLATFORMS
arm64-darwin-21
Expand Down
10 changes: 9 additions & 1 deletion lib/waterdrop/patches/rdkafka/producer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ module Producer
# Adds a method that allows us to get the native kafka producer name
# @return [String] producer instance name
def name
::Rdkafka::Bindings.rd_kafka_name(@native_kafka)
unless @_native
version = ::Gem::Version.new(::Rdkafka::VERSION)
change = ::Gem::Version.new('0.12.0')
# 0.12.0 changed how the native producer client reference works.
# This code supports both older and newer versions of rdkafka
@_native = version >= change ? @client.native : @native_kafka
end

::Rdkafka::Bindings.rd_kafka_name(@_native)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/waterdrop/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
# WaterDrop library
module WaterDrop
# Current WaterDrop version
VERSION = '2.3.0'
VERSION = '2.3.1'
end

0 comments on commit ac39b30

Please sign in to comment.