rdkafka 0.13.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +2 -0
  3. data/.github/FUNDING.yml +1 -0
  4. data/.github/workflows/ci.yml +58 -0
  5. data/.gitignore +4 -0
  6. data/.rspec +1 -0
  7. data/.ruby-gemset +1 -0
  8. data/.ruby-version +1 -0
  9. data/CHANGELOG.md +141 -111
  10. data/{LICENSE → MIT-LICENSE} +2 -1
  11. data/README.md +48 -39
  12. data/certs/cert_chain.pem +26 -0
  13. data/docker-compose.yml +18 -15
  14. data/ext/README.md +1 -1
  15. data/ext/Rakefile +1 -1
  16. data/lib/rdkafka/abstract_handle.rb +40 -26
  17. data/lib/rdkafka/admin/acl_binding_result.rb +37 -0
  18. data/lib/rdkafka/admin/create_acl_handle.rb +28 -0
  19. data/lib/rdkafka/admin/create_acl_report.rb +24 -0
  20. data/lib/rdkafka/admin/create_partitions_handle.rb +27 -0
  21. data/lib/rdkafka/admin/create_partitions_report.rb +6 -0
  22. data/lib/rdkafka/admin/delete_acl_handle.rb +30 -0
  23. data/lib/rdkafka/admin/delete_acl_report.rb +23 -0
  24. data/lib/rdkafka/admin/delete_groups_handle.rb +28 -0
  25. data/lib/rdkafka/admin/delete_groups_report.rb +24 -0
  26. data/lib/rdkafka/admin/describe_acl_handle.rb +30 -0
  27. data/lib/rdkafka/admin/describe_acl_report.rb +23 -0
  28. data/lib/rdkafka/admin.rb +449 -7
  29. data/lib/rdkafka/bindings.rb +127 -5
  30. data/lib/rdkafka/callbacks.rb +187 -0
  31. data/lib/rdkafka/config.rb +53 -19
  32. data/lib/rdkafka/consumer/headers.rb +2 -4
  33. data/lib/rdkafka/consumer/topic_partition_list.rb +11 -8
  34. data/lib/rdkafka/consumer.rb +134 -59
  35. data/lib/rdkafka/helpers/time.rb +14 -0
  36. data/lib/rdkafka/metadata.rb +22 -1
  37. data/lib/rdkafka/native_kafka.rb +6 -1
  38. data/lib/rdkafka/producer.rb +87 -9
  39. data/lib/rdkafka/version.rb +3 -3
  40. data/lib/rdkafka.rb +21 -1
  41. data/rdkafka.gemspec +17 -3
  42. data/renovate.json +6 -0
  43. data/spec/rdkafka/abstract_handle_spec.rb +0 -2
  44. data/spec/rdkafka/admin/create_acl_handle_spec.rb +56 -0
  45. data/spec/rdkafka/admin/create_acl_report_spec.rb +18 -0
  46. data/spec/rdkafka/admin/create_topic_handle_spec.rb +0 -2
  47. data/spec/rdkafka/admin/create_topic_report_spec.rb +0 -2
  48. data/spec/rdkafka/admin/delete_acl_handle_spec.rb +85 -0
  49. data/spec/rdkafka/admin/delete_acl_report_spec.rb +71 -0
  50. data/spec/rdkafka/admin/delete_topic_handle_spec.rb +0 -2
  51. data/spec/rdkafka/admin/delete_topic_report_spec.rb +0 -2
  52. data/spec/rdkafka/admin/describe_acl_handle_spec.rb +85 -0
  53. data/spec/rdkafka/admin/describe_acl_report_spec.rb +72 -0
  54. data/spec/rdkafka/admin_spec.rb +205 -2
  55. data/spec/rdkafka/bindings_spec.rb +0 -1
  56. data/spec/rdkafka/callbacks_spec.rb +0 -2
  57. data/spec/rdkafka/config_spec.rb +8 -2
  58. data/spec/rdkafka/consumer/headers_spec.rb +0 -2
  59. data/spec/rdkafka/consumer/message_spec.rb +0 -2
  60. data/spec/rdkafka/consumer/partition_spec.rb +0 -2
  61. data/spec/rdkafka/consumer/topic_partition_list_spec.rb +19 -2
  62. data/spec/rdkafka/consumer_spec.rb +212 -39
  63. data/spec/rdkafka/error_spec.rb +0 -2
  64. data/spec/rdkafka/metadata_spec.rb +2 -3
  65. data/spec/rdkafka/native_kafka_spec.rb +2 -3
  66. data/spec/rdkafka/producer/delivery_handle_spec.rb +0 -2
  67. data/spec/rdkafka/producer/delivery_report_spec.rb +0 -2
  68. data/spec/rdkafka/producer_spec.rb +157 -1
  69. data/spec/spec_helper.rb +3 -1
  70. data.tar.gz.sig +3 -0
  71. metadata +76 -13
  72. metadata.gz.sig +3 -0
  73. data/.semaphore/semaphore.yml +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4b1881445c53cdd213efd2e7ed3feb94a32a327fdf63ab35455d337f09e7320
4
- data.tar.gz: 02276df9702539c951ab392b4c5e086f87b731f7d319aedafb7b1209bc444688
3
+ metadata.gz: d906b2e71dae5b5f45459e915c48dc8cb88e0d51ebb90ded80cef3c8e5531b77
4
+ data.tar.gz: 8f0df2688bbc3b264de22b5943b18462ad41898781cc12e6e534804409133ce0
5
5
  SHA512:
6
- metadata.gz: 7f0e11a17d03091c8e13308c6998131c142349ce520473de7fec5908f0bcf2dfd59542966c3a850008f0db39e96b763b66f7b937487ba11f2fbb444e00aff25c
7
- data.tar.gz: d15c5f7cd5f4b9041da55e7e46bf05936c627517d5067a9449844e2721e752de852006f432e5fbe72549d77d8378545a671a969652b4abada8aa8182f4fa4985
6
+ metadata.gz: c35d392b326f4d47077f419bced92b929436be548651afc9364f5ada2eda51883ad75feeeb30183369aa6b15db3ac4630410f408eae449d1b0cc5a007cf011fc
7
+ data.tar.gz: 1487bb54713e6330ce55fd95f656dffd2edc34bcd8bc151d94faf2d6f043b8183276e3407d5f45c6152e99463c8323ccb83c15fff7007ebb96c4b369533002d5
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ B5��C5R�z�z�$$T~<ZX:f��c*C��͡L��s��i4�cO0*N��� �?��aeł����a[(��WY�X�R��u5,Lt\���i$�QɆ��:ܰ!�Ź w��;�j������&4X���u��?�����Yo^d#`��j�ǀ�:�q��� �F�u�������0ó8���"��LR�,[�#�K������ae���k�M��$�l��kU
2
+ ��qL����ㅂNt ����N��WU�1@��jg�BH�:X�p�dJ���c��ޥ��]��R�6��� J�:B>\�+͒�>}k� _��<��O�֏�"����ೳd�RW������7y�\{��{Hq���K�Ѭr����z���<W�f=��v}�
@@ -0,0 +1 @@
1
+ custom: ['https://karafka.io/#become-pro']
@@ -0,0 +1,58 @@
1
+ name: ci
2
+
3
+ concurrency:
4
+ group: ${{ github.workflow }}-${{ github.ref }}
5
+ cancel-in-progress: true
6
+
7
+ on:
8
+ pull_request:
9
+ push:
10
+ schedule:
11
+ - cron: '0 1 * * *'
12
+
13
+ env:
14
+ BUNDLE_RETRY: 6
15
+ BUNDLE_JOBS: 4
16
+
17
+ jobs:
18
+ specs:
19
+ timeout-minutes: 30
20
+ runs-on: ubuntu-latest
21
+ strategy:
22
+ fail-fast: false
23
+ matrix:
24
+ ruby:
25
+ - '3.3.0-preview2'
26
+ - '3.2'
27
+ - '3.1'
28
+ - '3.1.0'
29
+ - '3.0'
30
+ - '3.0.0'
31
+ - '2.7'
32
+ - '2.7.0'
33
+ include:
34
+ - ruby: '3.2'
35
+ coverage: 'true'
36
+ steps:
37
+ - uses: actions/checkout@v4
38
+ - name: Install package dependencies
39
+ run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
40
+
41
+ - name: Start Kafka with docker-compose
42
+ run: |
43
+ docker-compose up -d || (sleep 5 && docker-compose up -d)
44
+
45
+ - name: Set up Ruby
46
+ uses: ruby/setup-ruby@v1
47
+ with:
48
+ ruby-version: ${{matrix.ruby}}
49
+ bundler-cache: true
50
+
51
+ - name: Run all specs
52
+ env:
53
+ GITHUB_COVERAGE: ${{matrix.coverage}}
54
+
55
+ run: |
56
+ bundle install --path vendor/bundle
57
+ cd ext && bundle exec rake && cd ..
58
+ bundle exec rspec
data/.gitignore CHANGED
@@ -1,3 +1,6 @@
1
+ # Ignore bundler config.
2
+ /.bundle
3
+
1
4
  Gemfile.lock
2
5
  ext/ports
3
6
  ext/tmp
@@ -6,3 +9,4 @@ ext/librdkafka.*
6
9
  .yardoc
7
10
  doc
8
11
  coverage
12
+ vendor
data/.rspec CHANGED
@@ -1 +1,2 @@
1
+ --require spec_helper
1
2
  --format documentation
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ rdkafka-ruby
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.2
data/CHANGELOG.md CHANGED
@@ -1,122 +1,152 @@
1
- # 0.13.0
2
- * Support cooperative sticky partition assignment in the rebalance callback (methodmissing)
3
- * Support both string and symbol header keys (ColinDKelley)
4
- * Handle tombstone messages properly (kgalieva)
5
- * Add topic name to delivery report (maeve)
6
- * Allow string partitioner config (mollyegibson)
7
- * Fix documented type for DeliveryReport#error (jimmydo)
8
- * Bump librdkafka to 2.0.2 (lmaia)
9
- * Use finalizers to cleanly exit producer and admin (thijsc)
10
- * Lock access to the native kafka client (thijsc)
11
- * Fix potential race condition in multi-threaded producer (mensfeld)
12
- * Fix leaking FFI resources in specs (mensfeld)
13
- * Improve specs stability (mensfeld)
14
- * Make metadata request timeout configurable (mensfeld)
15
- * call_on_partitions_assigned and call_on_partitions_revoked only get a tpl passed in (thijsc)
16
-
17
- # 0.12.0
18
- * Bumps librdkafka to 1.9.0
19
- * Fix crash on empty partition key (mensfeld)
20
- * Pass the delivery handle to the callback (gvisokinskas)
21
-
22
- # 0.11.0
23
- * Upgrade librdkafka to 1.8.2
24
- * Bump supported minimum Ruby version to 2.6
25
- * Better homebrew path detection
26
-
27
- # 0.10.0
28
- * Upgrade librdkafka to 1.5.0
29
- * Add error callback config
30
-
31
- # 0.9.0
32
- * Fixes for Ruby 3.0
33
- * Allow any callable object for callbacks (gremerritt)
34
- * Reduce memory allocations in Rdkafka::Producer#produce (jturkel)
35
- * Use queue as log callback to avoid unsafe calls from trap context (breunigs)
36
- * Allow passing in topic configuration on create_topic (dezka)
37
- * Add each_batch method to consumer (mgrosso)
38
-
39
- # 0.8.1
40
- * Fix topic_flag behaviour and add tests for Metadata (geoff2k)
41
- * Add topic admin interface (geoff2k)
42
- * Raise an exception if @native_kafka is nil (geoff2k)
43
- * Option to use zstd compression (jasonmartens)
44
-
45
- # 0.8.0
46
- * Upgrade librdkafka to 1.4.0
47
- * Integrate librdkafka metadata API and add partition_key (by Adithya-copart)
48
- * Ruby 2.7 compatibility fix (by Geoff Thé)A
49
- * Add error to delivery report (by Alex Stanovsky)
50
- * Don't override CPPFLAGS and LDFLAGS if already set on Mac (by Hiroshi Hatake)
51
- * Allow use of Rake 13.x and up (by Tomasz Pajor)
52
-
53
- # 0.7.0
54
- * Bump librdkafka to 1.2.0 (by rob-as)
55
- * Allow customizing the wait time for delivery report availability (by mensfeld)
56
-
57
- # 0.6.0
58
- * Bump librdkafka to 1.1.0 (by Chris Gaffney)
59
- * Implement seek (by breunigs)
60
-
61
- # 0.5.0
62
- * Bump librdkafka to 1.0.0 (by breunigs)
63
- * Add cluster and member information (by dmexe)
64
- * Support message headers for consumer & producer (by dmexe)
65
- * Add consumer rebalance listener (by dmexe)
66
- * Implement pause/resume partitions (by dmexe)
67
-
68
- # 0.4.2
69
- * Delivery callback for producer
70
- * Document list param of commit method
71
- * Use default Homebrew openssl location if present
72
- * Consumer lag handles empty topics
73
- * End iteration in consumer when it is closed
74
- * Add support for storing message offsets
75
- * Add missing runtime dependency to rake
76
-
77
- # 0.4.1
78
- * Bump librdkafka to 0.11.6
79
-
80
- # 0.4.0
81
- * Improvements in librdkafka archive download
82
- * Add global statistics callback
83
- * Use Time for timestamps, potentially breaking change if you
1
+ # Rdkafka Changelog
2
+
3
+ ## 0.15.0 (2023-12-03)
4
+ - **[Feature]** Add `Admin#metadata` (mensfeld)
5
+ - **[Feature]** Add `Admin#create_partitions` (mensfeld)
6
+ - **[Feature]** Add `Admin#delete_group` utility (piotaixr)
7
+ - **[Feature]** Add Create and Delete ACL Feature To Admin Functions (vgnanasekaran)
8
+ - **[Feature]** Support `#assignment_lost?` on a consumer to check for involuntary assignment revocation (mensfeld)
9
+ - [Enhancement] Expose alternative way of managing consumer events via a separate queue (mensfeld)
10
+ - [Enhancement] **Bump** librdkafka to 2.3.0 (mensfeld)
11
+ - [Enhancement] Increase the `#lag` and `#query_watermark_offsets` default timeouts from 100ms to 1000ms. This will compensate for network glitches and remote clusters operations (mensfeld)
12
+ - [Change] Use `SecureRandom.uuid` instead of `random` for test consumer groups (mensfeld)
13
+
14
+ ## 0.14.0 (2023-11-21)
15
+ - [Enhancement] Add `raise_response_error` flag to the `Rdkafka::AbstractHandle`.
16
+ - [Enhancement] Allow for setting `statistics_callback` as nil to reset predefined settings configured by a different gem (mensfeld)
17
+ - [Enhancement] Get consumer position (thijsc & mensfeld)
18
+ - [Enhancement] Provide `#purge` to remove any outstanding requests from the producer (mensfeld)
19
+ - [Enhancement] Update `librdkafka` to `2.2.0` (mensfeld)
20
+ - [Enhancement] Introduce producer partitions count metadata cache (mensfeld)
21
+ - [Enhancement] Increase metadata timeout request from `250 ms` to `2000 ms` default to allow for remote cluster operations via `rdkafka-ruby` (mensfeld)
22
+ - [Enhancement] Introduce `#name` for producers and consumers (mensfeld)
23
+ - [Enhancement] Include backtrace in non-raised binded errors (mensfeld)
24
+ - [Fix] Reference to Opaque is not released when Admin, Consumer or Producer is closed (mensfeld)
25
+ - [Fix] Trigger `#poll` on native kafka creation to handle oauthbearer cb (mensfeld)
26
+ - [Fix] `#flush` does not handle the timeouts errors by making it return `true` if all flushed or `false` if failed. We do **not** raise an exception here to keep it backwards compatible (mensfeld)
27
+ - [Change] Remove support for Ruby 2.6 due to it being EOL and WeakMap incompatibilities (mensfeld)
28
+ - [Change] Update Kafka Docker with Confluent KRaft (mensfeld)
29
+ - [Change] Update librdkafka repo reference from edenhill to confluentinc (mensfeld)
30
+
31
+ ## 0.13.0 (2023-07-24)
32
+ - Support cooperative sticky partition assignment in the rebalance callback (methodmissing)
33
+ - Support both string and symbol header keys (ColinDKelley)
34
+ - Handle tombstone messages properly (kgalieva)
35
+ - Add topic name to delivery report (maeve)
36
+ - Allow string partitioner config (mollyegibson)
37
+ - Fix documented type for DeliveryReport#error (jimmydo)
38
+ - Bump librdkafka to 2.0.2 (lmaia)
39
+ - Use finalizers to cleanly exit producer and admin (thijsc)
40
+ - Lock access to the native kafka client (thijsc)
41
+ - Fix potential race condition in multi-threaded producer (mensfeld)
42
+ - Fix leaking FFI resources in specs (mensfeld)
43
+ - Improve specs stability (mensfeld)
44
+ - Make metadata request timeout configurable (mensfeld)
45
+ - call_on_partitions_assigned and call_on_partitions_revoked only get a tpl passed in (thijsc)
46
+
47
+ ## 0.12.0 (2022-06-17)
48
+ - Bumps librdkafka to 1.9.0
49
+ - Fix crash on empty partition key (mensfeld)
50
+ - Pass the delivery handle to the callback (gvisokinskas)
51
+
52
+ ## 0.11.0 (2021-11-17)
53
+ - Upgrade librdkafka to 1.8.2
54
+ - Bump supported minimum Ruby version to 2.6
55
+ - Better homebrew path detection
56
+
57
+ ## 0.10.0 (2021-09-07)
58
+ - Upgrade librdkafka to 1.5.0
59
+ - Add error callback config
60
+
61
+ ## 0.9.0 (2021-06-23)
62
+ - Fixes for Ruby 3.0
63
+ - Allow any callable object for callbacks (gremerritt)
64
+ - Reduce memory allocations in Rdkafka::Producer#produce (jturkel)
65
+ - Use queue as log callback to avoid unsafe calls from trap context (breunigs)
66
+ - Allow passing in topic configuration on create_topic (dezka)
67
+ - Add each_batch method to consumer (mgrosso)
68
+
69
+ ## 0.8.1 (2020-12-07)
70
+ - Fix topic_flag behaviour and add tests for Metadata (geoff2k)
71
+ - Add topic admin interface (geoff2k)
72
+ - Raise an exception if @native_kafka is nil (geoff2k)
73
+ - Option to use zstd compression (jasonmartens)
74
+
75
+ ## 0.8.0 (2020-06-02)
76
+ - Upgrade librdkafka to 1.4.0
77
+ - Integrate librdkafka metadata API and add partition_key (by Adithya-copart)
78
+ - Ruby 2.7 compatibility fix (by Geoff Thé)A
79
+ - Add error to delivery report (by Alex Stanovsky)
80
+ - Don't override CPPFLAGS and LDFLAGS if already set on Mac (by Hiroshi Hatake)
81
+ - Allow use of Rake 13.x and up (by Tomasz Pajor)
82
+
83
+ ## 0.7.0 (2019-09-21)
84
+ - Bump librdkafka to 1.2.0 (by rob-as)
85
+ - Allow customizing the wait time for delivery report availability (by mensfeld)
86
+
87
+ ## 0.6.0 (2019-07-23)
88
+ - Bump librdkafka to 1.1.0 (by Chris Gaffney)
89
+ - Implement seek (by breunigs)
90
+
91
+ ## 0.5.0 (2019-04-11)
92
+ - Bump librdkafka to 1.0.0 (by breunigs)
93
+ - Add cluster and member information (by dmexe)
94
+ - Support message headers for consumer & producer (by dmexe)
95
+ - Add consumer rebalance listener (by dmexe)
96
+ - Implement pause/resume partitions (by dmexe)
97
+
98
+ ## 0.4.2 (2019-01-12)
99
+ - Delivery callback for producer
100
+ - Document list param of commit method
101
+ - Use default Homebrew openssl location if present
102
+ - Consumer lag handles empty topics
103
+ - End iteration in consumer when it is closed
104
+ - Add support for storing message offsets
105
+ - Add missing runtime dependency to rake
106
+
107
+ ## 0.4.1 (2018-10-19)
108
+ - Bump librdkafka to 0.11.6
109
+
110
+ ## 0.4.0 (2018-09-24)
111
+ - Improvements in librdkafka archive download
112
+ - Add global statistics callback
113
+ - Use Time for timestamps, potentially breaking change if you
84
114
  rely on the previous behavior where it returns an integer with
85
115
  the number of milliseconds.
86
- * Bump librdkafka to 0.11.5
87
- * Implement TopicPartitionList in Ruby so we don't have to keep
116
+ - Bump librdkafka to 0.11.5
117
+ - Implement TopicPartitionList in Ruby so we don't have to keep
88
118
  track of native objects.
89
- * Support committing a topic partition list
90
- * Add consumer assignment method
119
+ - Support committing a topic partition list
120
+ - Add consumer assignment method
91
121
 
92
- # 0.3.5
93
- * Fix crash when not waiting for delivery handles
94
- * Run specs on Ruby 2.5
122
+ ## 0.3.5 (2018-01-17)
123
+ - Fix crash when not waiting for delivery handles
124
+ - Run specs on Ruby 2.5
95
125
 
96
- # 0.3.4
97
- * Bump librdkafka to 0.11.3
126
+ ## 0.3.4 (2017-12-05)
127
+ - Bump librdkafka to 0.11.3
98
128
 
99
- # 0.3.3
100
- * Fix bug that prevent display of `RdkafkaError` message
129
+ ## 0.3.3 (2017-10-27)
130
+ - Fix bug that prevent display of `RdkafkaError` message
101
131
 
102
- # 0.3.2
103
- * `add_topic` now supports using a partition count
104
- * Add way to make errors clearer with an extra message
105
- * Show topics in subscribe error message
106
- * Show partition and topic in query watermark offsets error message
132
+ ## 0.3.2 (2017-10-25)
133
+ - `add_topic` now supports using a partition count
134
+ - Add way to make errors clearer with an extra message
135
+ - Show topics in subscribe error message
136
+ - Show partition and topic in query watermark offsets error message
107
137
 
108
- # 0.3.1
109
- * Bump librdkafka to 0.11.1
110
- * Officially support ranges in `add_topic` for topic partition list.
111
- * Add consumer lag calculator
138
+ ## 0.3.1 (2017-10-23)
139
+ - Bump librdkafka to 0.11.1
140
+ - Officially support ranges in `add_topic` for topic partition list.
141
+ - Add consumer lag calculator
112
142
 
113
- # 0.3.0
114
- * Move both add topic methods to one `add_topic` in `TopicPartitionList`
115
- * Add committed offsets to consumer
116
- * Add query watermark offset to consumer
143
+ ## 0.3.0 (2017-10-17)
144
+ - Move both add topic methods to one `add_topic` in `TopicPartitionList`
145
+ - Add committed offsets to consumer
146
+ - Add query watermark offset to consumer
117
147
 
118
- # 0.2.0
119
- * Some refactoring and add inline documentation
148
+ ## 0.2.0 (2017-10-13)
149
+ - Some refactoring and add inline documentation
120
150
 
121
- # 0.1.x
122
- * Initial working version including producing and consuming
151
+ ## 0.1.x (2017-09-10)
152
+ - Initial working version including producing and consuming
@@ -1,6 +1,7 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017 Thijs Cadier
3
+ Copyright (c) 2017-2023 Thijs Cadier
4
+ 2023, Maciej Mensfeld
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,51 +1,59 @@
1
1
  # Rdkafka
2
2
 
3
- [![Build Status](https://appsignal.semaphoreci.com/badges/rdkafka-ruby/branches/master.svg?style=shields)](https://appsignal.semaphoreci.com/projects/rdkafka-ruby)
3
+ [![Build Status](https://github.com/karafka/rdkafka-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/karafka/rdkafka-ruby/actions/workflows/ci.yml)
4
4
  [![Gem Version](https://badge.fury.io/rb/rdkafka.svg)](https://badge.fury.io/rb/rdkafka)
5
- [![Maintainability](https://api.codeclimate.com/v1/badges/ecb1765f81571cccdb0e/maintainability)](https://codeclimate.com/github/appsignal/rdkafka-ruby/maintainability)
5
+ [![Join the chat at https://slack.karafka.io](https://raw.githubusercontent.com/karafka/misc/master/slack.svg)](https://slack.karafka.io)
6
+
7
+ > [!NOTE]
8
+ > The `rdkafka-ruby` gem was created and developed by [AppSignal](https://www.appsignal.com/). Their impactful contributions have significantly shaped the Ruby Kafka and Karafka ecosystems. For robust monitoring, we highly recommend AppSignal.
9
+
10
+ ---
6
11
 
7
12
  The `rdkafka` gem is a modern Kafka client library for Ruby based on
8
- [librdkafka](https://github.com/edenhill/librdkafka/).
13
+ [librdkafka](https://github.com/confluentinc/librdkafka/).
9
14
  It wraps the production-ready C client using the [ffi](https://github.com/ffi/ffi)
10
- gem and targets Kafka 1.0+ and Ruby versions that are under security or
11
- active maintenance. We remove Ruby version from our CI builds if they
15
+ gem and targets Kafka 1.0+ and Ruby versions under security or
16
+ active maintenance. We remove a Ruby version from our CI builds when they
12
17
  become EOL.
13
18
 
14
- `rdkafka` was written because we needed a reliable Ruby client for
15
- Kafka that supports modern Kafka at [AppSignal](https://appsignal.com).
16
- We run it in production on very high traffic systems.
17
-
18
- This gem only provides a high-level Kafka consumer. If you are running
19
- an older version of Kafka and/or need the legacy simple consumer we
20
- suggest using the [Hermann](https://github.com/reiseburo/hermann) gem.
19
+ `rdkafka` was written because of the need for a reliable Ruby client for Kafka that supports modern Kafka at [AppSignal](https://appsignal.com). AppSignal runs it in production on very high-traffic systems.
21
20
 
22
- The most important pieces of a Kafka client are implemented. We're
23
- working towards feature completeness, you can track that here:
24
- https://github.com/appsignal/rdkafka-ruby/milestone/1
21
+ The most important pieces of a Kafka client are implemented, and we aim to provide all relevant consumer, producer, and admin APIs.
25
22
 
26
23
  ## Table of content
27
24
 
25
+ - [Project Scope](#project-scope)
28
26
  - [Installation](#installation)
29
27
  - [Usage](#usage)
30
- * [Consuming messages](#consuming-messages)
31
- * [Producing messages](#producing-messages)
32
- - [Higher level libraries](#higher-level-libraries)
33
- * [Message processing frameworks](#message-processing-frameworks)
34
- * [Message publishing libraries](#message-publishing-libraries)
28
+ * [Consuming Messages](#consuming-messages)
29
+ * [Producing Messages](#producing-messages)
30
+ - [Higher Level Libraries](#higher-level-libraries)
31
+ * [Message Processing Frameworks](#message-processing-frameworks)
32
+ * [Message Publishing Libraries](#message-publishing-libraries)
35
33
  - [Development](#development)
36
34
  - [Example](#example)
37
35
 
36
+ ## Project Scope
37
+
38
+ While rdkafka-ruby aims to simplify the use of librdkafka in Ruby applications, it's important to understand the limitations of this library:
39
+
40
+ - **No Complex Producers/Consumers**: This library does not intend to offer complex producers or consumers. The aim is to stick closely to the functionalities provided by librdkafka itself.
41
+
42
+ - **Focus on librdkafka Capabilities**: Features that can be achieved directly in Ruby, without specific needs from librdkafka, are outside the scope of this library.
43
+
44
+ - **Existing High-Level Functionalities**: Certain high-level functionalities like producer metadata cache and simple consumer are already part of the library. Although they fall slightly outside the primary goal, they will remain part of the contract, given their existing usage.
45
+
38
46
 
39
47
  ## Installation
40
48
 
41
49
  This gem downloads and compiles librdkafka when it is installed. If you
42
- have any problems installing the gem please open an issue.
50
+ If you have any problems installing the gem, please open an issue.
43
51
 
44
52
  ## Usage
45
53
 
46
- See the [documentation](https://www.rubydoc.info/github/appsignal/rdkafka-ruby) for full details on how to use this gem. Two quick examples:
54
+ See the [documentation](https://karafka.io/docs/code/rdkafka-ruby/) for full details on how to use this gem. Two quick examples:
47
55
 
48
- ### Consuming messages
56
+ ### Consuming Messages
49
57
 
50
58
  Subscribe to a topic and get messages. Kafka will automatically spread
51
59
  the available partitions over consumers with the same group id.
@@ -63,11 +71,11 @@ consumer.each do |message|
63
71
  end
64
72
  ```
65
73
 
66
- ### Producing messages
74
+ ### Producing Messages
67
75
 
68
- Produce a number of messages, put the delivery handles in an array and
76
+ Produce a number of messages, put the delivery handles in an array, and
69
77
  wait for them before exiting. This way the messages will be batched and
70
- sent to Kafka in an efficient way.
78
+ efficiently sent to Kafka.
71
79
 
72
80
  ```ruby
73
81
  config = {:"bootstrap.servers" => "localhost:9092"}
@@ -90,41 +98,42 @@ Note that creating a producer consumes some resources that will not be
90
98
  released until it `#close` is explicitly called, so be sure to call
91
99
  `Config#producer` only as necessary.
92
100
 
93
- ## Higher level libraries
101
+ ## Higher Level Libraries
94
102
 
95
- Currently, there are two actively developed frameworks based on rdkafka-ruby, that provide higher level API that can be used to work with Kafka messages and one library for publishing messages.
103
+ Currently, there are two actively developed frameworks based on rdkafka-ruby, that provide higher-level API that can be used to work with Kafka messages and one library for publishing messages.
96
104
 
97
- ### Message processing frameworks
105
+ ### Message Processing Frameworks
98
106
 
99
107
  * [Karafka](https://github.com/karafka/karafka) - Ruby and Rails efficient Kafka processing framework.
100
108
  * [Racecar](https://github.com/zendesk/racecar) - A simple framework for Kafka consumers in Ruby
101
109
 
102
- ### Message publishing libraries
110
+ ### Message Publishing Libraries
103
111
 
104
112
  * [WaterDrop](https://github.com/karafka/waterdrop) – Standalone Karafka library for producing Kafka messages.
105
113
 
106
114
  ## Development
107
115
 
108
- A Docker Compose file is included to run Kafka and Zookeeper. To run
109
- that:
116
+ Contributors are encouraged to focus on enhancements that align with the core goal of the library. We appreciate contributions but will likely not accept pull requests for features that:
117
+
118
+ - Implement functionalities that can achieved using standard Ruby capabilities without changes to the underlying rdkafka-ruby bindings.
119
+ - Deviate significantly from the primary aim of providing librdkafka bindings with Ruby-friendly interfaces.
120
+
121
+ A Docker Compose file is included to run Kafka. To run that:
110
122
 
111
123
  ```
112
124
  docker-compose up
113
125
  ```
114
126
 
115
- Run `bundle` and `cd ext && bundle exec rake && cd ..` to download and
116
- compile `librdkafka`.
127
+ Run `bundle` and `cd ext && bundle exec rake && cd ..` to download and compile `librdkafka`.
117
128
 
118
- You can then run `bundle exec rspec` to run the tests. To see rdkafka
119
- debug output:
129
+ You can then run `bundle exec rspec` to run the tests. To see rdkafka debug output:
120
130
 
121
131
  ```
122
132
  DEBUG_PRODUCER=true bundle exec rspec
123
133
  DEBUG_CONSUMER=true bundle exec rspec
124
134
  ```
125
135
 
126
- After running the tests you can bring the cluster down to start with a
127
- clean slate:
136
+ After running the tests, you can bring the cluster down to start with a clean slate:
128
137
 
129
138
  ```
130
139
  docker-compose down
@@ -132,7 +141,7 @@ docker-compose down
132
141
 
133
142
  ## Example
134
143
 
135
- To see everything working run these in separate tabs:
144
+ To see everything working, run these in separate tabs:
136
145
 
137
146
  ```
138
147
  bundle exec rake consume_messages
@@ -0,0 +1,26 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MRAwDgYDVQQDDAdjb250
3
+ YWN0MRcwFQYKCZImiZPyLGQBGRYHa2FyYWZrYTESMBAGCgmSJomT8ixkARkWAmlv
4
+ MB4XDTIzMDgyMTA3MjU1NFoXDTI0MDgyMDA3MjU1NFowPzEQMA4GA1UEAwwHY29u
5
+ dGFjdDEXMBUGCgmSJomT8ixkARkWB2thcmFma2ExEjAQBgoJkiaJk/IsZAEZFgJp
6
+ bzCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBAOuZpyQKEwsTG9plLat7
7
+ 8bUaNuNBEnouTsNMr6X+XTgvyrAxTuocdsyP1sNCjdS1B8RiiDH1/Nt9qpvlBWon
8
+ sdJ1SYhaWNVfqiYStTDnCx3PRMmHRdD4KqUWKpN6VpZ1O/Zu+9Mw0COmvXgZuuO9
9
+ wMSJkXRo6dTCfMedLAIxjMeBIxtoLR2e6Jm6MR8+8WYYVWrO9kSOOt5eKQLBY7aK
10
+ b/Dc40EcJKPg3Z30Pia1M9ZyRlb6SOj6SKpHRqc7vbVQxjEw6Jjal1lZ49m3YZMd
11
+ ArMAs9lQZNdSw5/UX6HWWURLowg6k10RnhTUtYyzO9BFev0JFJftHnmuk8vtb+SD
12
+ 5VPmjFXg2VOcw0B7FtG75Vackk8QKfgVe3nSPhVpew2CSPlbJzH80wChbr19+e3+
13
+ YGr1tOiaJrL6c+PNmb0F31NXMKpj/r+n15HwlTMRxQrzFcgjBlxf2XFGnPQXHhBm
14
+ kp1OFnEq4GG9sON4glRldkwzi/f/fGcZmo5fm3d+0ZdNgwIDAQABo3cwdTAJBgNV
15
+ HRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUPVH5+dLA80A1kJ2Uz5iGwfOa
16
+ 1+swHQYDVR0RBBYwFIESY29udGFjdEBrYXJhZmthLmlvMB0GA1UdEgQWMBSBEmNv
17
+ bnRhY3RAa2FyYWZrYS5pbzANBgkqhkiG9w0BAQsFAAOCAYEAnpa0jcN7JzREHMTQ
18
+ bfZ+xcvlrzuROMY6A3zIZmQgbnoZZNuX4cMRrT1p1HuwXpxdpHPw7dDjYqWw3+1h
19
+ 3mXLeMuk7amjQpYoSWU/OIZMhIsARra22UN8qkkUlUj3AwTaChVKN/bPJOM2DzfU
20
+ kz9vUgLeYYFfQbZqeI6SsM7ltilRV4W8D9yNUQQvOxCFxtLOetJ00fC/E7zMUzbK
21
+ IBwYFQYsbI6XQzgAIPW6nGSYKgRhkfpmquXSNKZRIQ4V6bFrufa+DzD0bt2ZA3ah
22
+ fMmJguyb5L2Gf1zpDXzFSPMG7YQFLzwYz1zZZvOU7/UCpQsHpID/YxqDp4+Dgb+Y
23
+ qma0whX8UG/gXFV2pYWpYOfpatvahwi+A1TwPQsuZwkkhi1OyF1At3RY+hjSXyav
24
+ AnG1dJU+yL2BK7vaVytLTstJME5mepSZ46qqIJXMuWob/YPDmVaBF39TDSG9e34s
25
+ msG3BiCqgOgHAnL23+CN3Rt8MsuRfEtoTKpJVcCfoEoNHOkc
26
+ -----END CERTIFICATE-----
data/docker-compose.yml CHANGED
@@ -1,24 +1,27 @@
1
- ---
2
-
3
1
  version: '2'
4
2
 
5
3
  services:
6
- zookeeper:
7
- image: confluentinc/cp-zookeeper:5.2.6
8
- environment:
9
- ZOOKEEPER_CLIENT_PORT: 2181
10
- ZOOKEEPER_TICK_TIME: 2000
11
-
12
4
  kafka:
13
- image: confluentinc/cp-kafka:5.2.5-10
14
- depends_on:
15
- - zookeeper
5
+ container_name: kafka
6
+ image: confluentinc/cp-kafka:7.5.2
7
+
16
8
  ports:
17
9
  - 9092:9092
10
+
18
11
  environment:
19
- KAFKA_BROKER_ID: 1
20
- KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
21
- KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:29092,PLAINTEXT_HOST://localhost:9092
22
- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
12
+ CLUSTER_ID: kafka-docker-cluster-1
23
13
  KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
24
14
  KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
15
+ KAFKA_PROCESS_ROLES: broker,controller
16
+ KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
17
+ KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093
18
+ KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
19
+ KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://127.0.0.1:9092
20
+ KAFKA_BROKER_ID: 1
21
+ KAFKA_CONTROLLER_QUORUM_VOTERS: 1@127.0.0.1:9093
22
+ ALLOW_PLAINTEXT_LISTENER: 'yes'
23
+ KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
24
+ KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
25
+ KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
26
+ KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true"
27
+ KAFKA_AUTHORIZER_CLASS_NAME: org.apache.kafka.metadata.authorizer.StandardAuthorizer
data/ext/README.md CHANGED
@@ -5,7 +5,7 @@ this gem is installed.
5
5
 
6
6
  To update the `librdkafka` version follow the following steps:
7
7
 
8
- * Go to https://github.com/edenhill/librdkafka/releases to get the new
8
+ * Go to https://github.com/confluentinc/librdkafka/releases to get the new
9
9
  version number and asset checksum for `tar.gz`.
10
10
  * Change the version in `lib/rdkafka/version.rb`
11
11
  * Change the `sha256` in `lib/rdkafka/version.rb`
data/ext/Rakefile CHANGED
@@ -17,7 +17,7 @@ task :default => :clean do
17
17
  end
18
18
 
19
19
  recipe.files << {
20
- :url => "https://codeload.github.com/edenhill/librdkafka/tar.gz/v#{Rdkafka::LIBRDKAFKA_VERSION}",
20
+ :url => "https://codeload.github.com/confluentinc/librdkafka/tar.gz/v#{Rdkafka::LIBRDKAFKA_VERSION}",
21
21
  :sha256 => Rdkafka::LIBRDKAFKA_SOURCE_SHA256
22
22
  }
23
23
  recipe.configure_options = ["--host=#{recipe.host}"]