karafka-rdkafka 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +1 -0
  4. data/dist/{librdkafka-2.11.0.tar.gz → librdkafka-2.11.1.tar.gz} +0 -0
  5. data/karafka-rdkafka.gemspec +33 -6
  6. data/lib/rdkafka/version.rb +3 -3
  7. data/renovate.json +5 -17
  8. metadata +3 -67
  9. data/.github/CODEOWNERS +0 -3
  10. data/.github/FUNDING.yml +0 -1
  11. data/.github/workflows/ci_linux_alpine_x86_64_musl.yml +0 -197
  12. data/.github/workflows/ci_linux_alpine_x86_64_musl_complementary.yml +0 -264
  13. data/.github/workflows/ci_linux_debian_x86_64_gnu.yml +0 -271
  14. data/.github/workflows/ci_linux_debian_x86_64_gnu_complementary.yml +0 -334
  15. data/.github/workflows/ci_linux_ubuntu_aarch64_gnu.yml +0 -271
  16. data/.github/workflows/ci_linux_ubuntu_aarch64_gnu_complementary.yml +0 -295
  17. data/.github/workflows/ci_linux_ubuntu_x86_64_gnu.yml +0 -281
  18. data/.github/workflows/ci_linux_ubuntu_x86_64_gnu_complementary.yml +0 -294
  19. data/.github/workflows/ci_macos_arm64.yml +0 -284
  20. data/.github/workflows/push_linux_aarch64_gnu.yml +0 -65
  21. data/.github/workflows/push_linux_x86_64_gnu.yml +0 -65
  22. data/.github/workflows/push_linux_x86_64_musl.yml +0 -79
  23. data/.github/workflows/push_macos_arm64.yml +0 -54
  24. data/.github/workflows/push_ruby.yml +0 -37
  25. data/.github/workflows/trigger-wiki-refresh.yml +0 -30
  26. data/.github/workflows/verify-action-pins.yml +0 -16
  27. data/.gitignore +0 -16
  28. data/.rspec +0 -3
  29. data/.ruby-gemset +0 -1
  30. data/.ruby-version +0 -1
  31. data/.yardopts +0 -2
  32. data/dist/cyrus-sasl-2.1.28.tar.gz +0 -0
  33. data/dist/krb5-1.21.3.tar.gz +0 -0
  34. data/dist/openssl-3.0.16.tar.gz +0 -0
  35. data/dist/zlib-1.3.1.tar.gz +0 -0
  36. data/dist/zstd-1.5.7.tar.gz +0 -0
  37. data/ext/README.md +0 -19
  38. data/ext/build_common.sh +0 -376
  39. data/ext/build_linux_aarch64_gnu.sh +0 -326
  40. data/ext/build_linux_x86_64_gnu.sh +0 -317
  41. data/ext/build_linux_x86_64_musl.sh +0 -773
  42. data/ext/build_macos_arm64.sh +0 -557
  43. data/ext/generate-ssl-certs.sh +0 -109
  44. data/spec/integrations/ssl_stress_spec.rb +0 -121
  45. data/spec/lib/rdkafka/abstract_handle_spec.rb +0 -117
  46. data/spec/lib/rdkafka/admin/create_acl_handle_spec.rb +0 -56
  47. data/spec/lib/rdkafka/admin/create_acl_report_spec.rb +0 -18
  48. data/spec/lib/rdkafka/admin/create_topic_handle_spec.rb +0 -54
  49. data/spec/lib/rdkafka/admin/create_topic_report_spec.rb +0 -16
  50. data/spec/lib/rdkafka/admin/delete_acl_handle_spec.rb +0 -85
  51. data/spec/lib/rdkafka/admin/delete_acl_report_spec.rb +0 -72
  52. data/spec/lib/rdkafka/admin/delete_topic_handle_spec.rb +0 -54
  53. data/spec/lib/rdkafka/admin/delete_topic_report_spec.rb +0 -16
  54. data/spec/lib/rdkafka/admin/describe_acl_handle_spec.rb +0 -85
  55. data/spec/lib/rdkafka/admin/describe_acl_report_spec.rb +0 -73
  56. data/spec/lib/rdkafka/admin_spec.rb +0 -982
  57. data/spec/lib/rdkafka/bindings_spec.rb +0 -198
  58. data/spec/lib/rdkafka/callbacks_spec.rb +0 -20
  59. data/spec/lib/rdkafka/config_spec.rb +0 -258
  60. data/spec/lib/rdkafka/consumer/headers_spec.rb +0 -73
  61. data/spec/lib/rdkafka/consumer/message_spec.rb +0 -139
  62. data/spec/lib/rdkafka/consumer/partition_spec.rb +0 -57
  63. data/spec/lib/rdkafka/consumer/topic_partition_list_spec.rb +0 -248
  64. data/spec/lib/rdkafka/consumer_spec.rb +0 -1343
  65. data/spec/lib/rdkafka/error_spec.rb +0 -95
  66. data/spec/lib/rdkafka/metadata_spec.rb +0 -79
  67. data/spec/lib/rdkafka/native_kafka_spec.rb +0 -130
  68. data/spec/lib/rdkafka/producer/delivery_handle_spec.rb +0 -60
  69. data/spec/lib/rdkafka/producer/delivery_report_spec.rb +0 -25
  70. data/spec/lib/rdkafka/producer/partitions_count_cache_spec.rb +0 -359
  71. data/spec/lib/rdkafka/producer_spec.rb +0 -1527
  72. data/spec/spec_helper.rb +0 -230
data/spec/spec_helper.rb DELETED
@@ -1,230 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Warning[:performance] = true if RUBY_VERSION >= '3.3'
4
- Warning[:deprecated] = true
5
- $VERBOSE = true
6
-
7
- require 'warning'
8
-
9
- Warning.process do |warning|
10
- next unless warning.include?(Dir.pwd)
11
- # Allow OpenStruct usage only in specs
12
- next if warning.include?('OpenStruct use') && warning.include?('_spec')
13
-
14
- raise "Warning in your code: #{warning}"
15
- end
16
-
17
- unless ENV["CI"] == "true"
18
- require "simplecov"
19
- SimpleCov.start do
20
- add_filter "/spec/"
21
- end
22
- end
23
-
24
- require "pry"
25
- require "rspec"
26
- require "rdkafka"
27
- require "timeout"
28
- require "securerandom"
29
-
30
- def rdkafka_base_config
31
- if ENV['KAFKA_SSL_ENABLED'] == 'true'
32
- {
33
- :"bootstrap.servers" => "localhost:9093",
34
- # Display statistics and refresh often just to cover those in specs
35
- :'statistics.interval.ms' => 1_000,
36
- :'topic.metadata.refresh.interval.ms' => 1_000,
37
- # SSL Configuration
38
- :'security.protocol' => 'SSL',
39
- :'ssl.ca.location' => './ssl/ca-cert',
40
- :'ssl.endpoint.identification.algorithm' => 'none'
41
- }
42
- else
43
- {
44
- :"bootstrap.servers" => "localhost:9092",
45
- # Display statistics and refresh often just to cover those in specs
46
- :'statistics.interval.ms' => 1_000,
47
- :'topic.metadata.refresh.interval.ms' => 1_000
48
- }
49
- end
50
- end
51
-
52
- def rdkafka_config(config_overrides={})
53
- # Generate the base config
54
- config = rdkafka_base_config
55
- # Merge overrides
56
- config.merge!(config_overrides)
57
- # Return it
58
- Rdkafka::Config.new(config)
59
- end
60
-
61
- def rdkafka_consumer_config(config_overrides={})
62
- # Generate the base config
63
- config = rdkafka_base_config
64
- # Add consumer specific fields to it
65
- config[:"auto.offset.reset"] = "earliest"
66
- config[:"enable.partition.eof"] = false
67
- config[:"group.id"] = "ruby-test-#{SecureRandom.uuid}"
68
- # Enable debug mode if required
69
- if ENV["DEBUG_CONSUMER"]
70
- config[:debug] = "cgrp,topic,fetch"
71
- end
72
- # Merge overrides
73
- config.merge!(config_overrides)
74
- # Return it
75
- Rdkafka::Config.new(config)
76
- end
77
-
78
- def rdkafka_producer_config(config_overrides={})
79
- # Generate the base config
80
- config = rdkafka_base_config
81
- # Enable debug mode if required
82
- if ENV["DEBUG_PRODUCER"]
83
- config[:debug] = "broker,topic,msg"
84
- end
85
- # Merge overrides
86
- config.merge!(config_overrides)
87
- # Return it
88
- Rdkafka::Config.new(config)
89
- end
90
-
91
- def new_native_client
92
- config = rdkafka_consumer_config
93
- config.send(:native_kafka, config.send(:native_config), :rd_kafka_producer)
94
- end
95
-
96
- def new_native_topic(topic_name="topic_name", native_client: )
97
- Rdkafka::Bindings.rd_kafka_topic_new(
98
- native_client,
99
- topic_name,
100
- nil
101
- )
102
- end
103
-
104
- def wait_for_message(topic:, delivery_report:, timeout_in_seconds: 30, consumer: nil)
105
- new_consumer = consumer.nil?
106
- consumer ||= rdkafka_consumer_config('allow.auto.create.topics': true).consumer
107
- consumer.subscribe(topic)
108
- timeout = Time.now.to_i + timeout_in_seconds
109
- retry_count = 0
110
- max_retries = 10
111
-
112
- loop do
113
- if timeout <= Time.now.to_i
114
- raise "Timeout of #{timeout_in_seconds} seconds reached in wait_for_message"
115
- end
116
-
117
- begin
118
- message = consumer.poll(100)
119
- if message &&
120
- message.partition == delivery_report.partition &&
121
- message.offset == delivery_report.offset
122
- return message
123
- end
124
- rescue Rdkafka::RdkafkaError => e
125
- if e.code == :unknown_topic_or_part && retry_count < max_retries
126
- retry_count += 1
127
- sleep(0.1) # Small delay before retry
128
- next
129
- else
130
- raise
131
- end
132
- end
133
- end
134
- ensure
135
- consumer.close if new_consumer
136
- end
137
-
138
- def wait_for_assignment(consumer)
139
- 10.times do
140
- break if !consumer.assignment.empty?
141
- sleep 1
142
- end
143
- end
144
-
145
- def wait_for_unassignment(consumer)
146
- 10.times do
147
- break if consumer.assignment.empty?
148
- sleep 1
149
- end
150
- end
151
-
152
- def wait_for_topic(admin, topic)
153
- admin.metadata(topic)
154
- rescue Rdkafka::RdkafkaError => e
155
- raise unless e.code == :unknown_topic_or_part
156
-
157
- sleep(0.5)
158
-
159
- retry
160
- end
161
-
162
- def notify_listener(listener, &block)
163
- # 1. subscribe and poll
164
- consumer.subscribe("consume_test_topic")
165
- wait_for_assignment(consumer)
166
- consumer.poll(100)
167
-
168
- block.call if block
169
-
170
- # 2. unsubscribe
171
- consumer.unsubscribe
172
- wait_for_unassignment(consumer)
173
- consumer.close
174
- end
175
-
176
- RSpec.configure do |config|
177
- config.filter_run focus: true
178
- config.run_all_when_everything_filtered = true
179
-
180
- config.before(:each) do
181
- Rdkafka::Config.statistics_callback = nil
182
- # We need to clear it so state does not leak between specs
183
- Rdkafka::Producer.partitions_count_cache.to_h.clear
184
- end
185
-
186
- config.before(:suite) do
187
- admin = rdkafka_config.admin
188
- {
189
- consume_test_topic: 3,
190
- empty_test_topic: 3,
191
- load_test_topic: 3,
192
- produce_test_topic: 3,
193
- rake_test_topic: 3,
194
- watermarks_test_topic: 3,
195
- partitioner_test_topic: 25,
196
- example_topic: 1
197
- }.each do |topic, partitions|
198
- create_topic_handle = admin.create_topic(topic.to_s, partitions, 1)
199
- begin
200
- create_topic_handle.wait(max_wait_timeout: 1.0)
201
- rescue Rdkafka::RdkafkaError => ex
202
- raise unless ex.message.match?(/topic_already_exists/)
203
- end
204
- end
205
- admin.close
206
- end
207
-
208
- config.around(:each) do |example|
209
- # Timeout specs after 1.5 minute. If they take longer
210
- # they are probably stuck
211
- Timeout::timeout(90) do
212
- example.run
213
- end
214
- end
215
- end
216
-
217
- class RdKafkaTestConsumer
218
- def self.with
219
- consumer = Rdkafka::Bindings.rd_kafka_new(
220
- :rd_kafka_consumer,
221
- nil,
222
- nil,
223
- 0
224
- )
225
- yield consumer
226
- ensure
227
- Rdkafka::Bindings.rd_kafka_consumer_close(consumer)
228
- Rdkafka::Bindings.rd_kafka_destroy(consumer)
229
- end
230
- end