karafka-rdkafka 0.30.1 → 0.30.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/rdkafka/defaults.rb +4 -0
- data/lib/rdkafka/share_consumer.rb +48 -3
- data/lib/rdkafka/version.rb +1 -1
- data/renovate.json +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7b68458fe1759b2645cce196bd5a602c236fe36853e428940641301272d5ecaf
|
|
4
|
+
data.tar.gz: 6248362a62a402e6004286abc9a7c1f7f29baa9ac375983fa1fc0a2d64159fc3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c69f725864465b708ac3159db0df5a8597e8cf6894f6108ed5ca34654bb4e905fc6dc1e79bd6689bbd2ff4378f4e7bb2f1edfb1bda4416e944912154fda608de
|
|
7
|
+
data.tar.gz: e0193cf81b907d704b97a27c1d0998f14b83ffb12361b8f0557e87b4345ae58c29caa2d2544192e8524a9feb719b3d707bb42b24cf2d4079ace9d481075277db
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Rdkafka Changelog
|
|
2
2
|
|
|
3
|
+
## 0.30.2 (2026-10-01)
|
|
4
|
+
- [Feature] Add `ShareConsumer#events_poll` (and `#events_poll_nb`) to service the statistics, error, log and OAuthBearer callbacks without acquiring records.
|
|
5
|
+
|
|
3
6
|
## 0.30.1 (2026-09-30)
|
|
4
7
|
- [Fix] Derive `ShareConsumer#name` from the native handle at creation (mirroring `Consumer#name`) instead of leaving it `nil` until an OAuthBearer callback happened to set it. A `nil` name meant downstreams that route the global statistics and error callbacks by client name (e.g. Karafka) silently dropped every share-consumer statistic and background error.
|
|
5
8
|
|
data/lib/rdkafka/defaults.rb
CHANGED
|
@@ -51,6 +51,10 @@ module Rdkafka
|
|
|
51
51
|
# @see ShareConsumer#poll
|
|
52
52
|
SHARE_CONSUMER_POLL_TIMEOUT_MS = 250
|
|
53
53
|
|
|
54
|
+
# Share consumer timeout for events_poll (0 = non-blocking async)
|
|
55
|
+
# @see ShareConsumer#events_poll
|
|
56
|
+
SHARE_CONSUMER_EVENTS_POLL_TIMEOUT_MS = 0
|
|
57
|
+
|
|
54
58
|
# Share consumer timeout for synchronous acknowledgement commits
|
|
55
59
|
# @see ShareConsumer#commit_sync
|
|
56
60
|
SHARE_CONSUMER_COMMIT_SYNC_TIMEOUT_MS = 5_000
|
|
@@ -22,9 +22,10 @@ module Rdkafka
|
|
|
22
22
|
# share consumer per thread. librdkafka enforces this and calls from a second thread raise
|
|
23
23
|
# an `RdkafkaError` with code `conflict`. This class is deliberately not built on
|
|
24
24
|
# {NativeKafka}: there is no background polling thread (statistics, error and log callbacks
|
|
25
|
-
# are all serviced from within {#poll}
|
|
26
|
-
#
|
|
27
|
-
#
|
|
25
|
+
# are all serviced from within {#poll}, or from {#events_poll} when the caller is not polling
|
|
26
|
+
# for records) and the native handle must never be used from a polling thread, so only the
|
|
27
|
+
# {#close} interaction is synchronized here. {#close} may be called from any thread and waits
|
|
28
|
+
# for in-flight calls to finish before tearing down.
|
|
28
29
|
#
|
|
29
30
|
# Preview limitations inherited from librdkafka worth knowing at this layer:
|
|
30
31
|
# - `max.poll.records` (default 500) is a soft bound
|
|
@@ -264,6 +265,50 @@ module Rdkafka
|
|
|
264
265
|
end
|
|
265
266
|
end
|
|
266
267
|
|
|
268
|
+
# Polls the main rdkafka queue (not the share one), serving queued global callbacks without
|
|
269
|
+
# acquiring any records.
|
|
270
|
+
#
|
|
271
|
+
# Events will cause application-provided callbacks to be called:
|
|
272
|
+
# - error callbacks
|
|
273
|
+
# - stats callbacks
|
|
274
|
+
# - log and OAuthBearer token refresh callbacks
|
|
275
|
+
#
|
|
276
|
+
# Lets a caller keep those callbacks flowing while it is not polling for records (waiting on
|
|
277
|
+
# in-flight work, quieting, or draining on shutdown). Does **NOT** replace {#poll}, which
|
|
278
|
+
# drains the same queue while acquiring records; the "one share consumer per thread" rule
|
|
279
|
+
# means the two never run concurrently.
|
|
280
|
+
#
|
|
281
|
+
# @param timeout_ms [Integer] poll timeout. If set to 0 will run async, when set to -1 will
|
|
282
|
+
# block until any events available.
|
|
283
|
+
# @return [Integer] number of events served
|
|
284
|
+
# @raise [ClosedConsumerError] when the consumer is closed or closing
|
|
285
|
+
def events_poll(timeout_ms = Defaults::SHARE_CONSUMER_EVENTS_POLL_TIMEOUT_MS)
|
|
286
|
+
with_native(__method__) do |native|
|
|
287
|
+
# The main queue lives on the rd_kafka_t the share handle wraps (rkshare_rk), which is the
|
|
288
|
+
# handle librdkafka hands the callbacks; rd_kafka_poll has to run against it (see #name).
|
|
289
|
+
inner = Rdkafka::Bindings::NativeShareConsumer.new(native)[:rkshare_rk]
|
|
290
|
+
Rdkafka::Bindings.rd_kafka_poll(inner, timeout_ms)
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
# Polls the main rdkafka queue without releasing the GVL (Global VM Lock).
|
|
295
|
+
#
|
|
296
|
+
# This is more efficient than {#events_poll} for non-blocking `poll(0)` calls, particularly
|
|
297
|
+
# useful in fiber scheduler contexts where GVL release/reacquire overhead is wasteful since we
|
|
298
|
+
# don't expect to wait.
|
|
299
|
+
#
|
|
300
|
+
# @param timeout_ms [Integer] poll timeout (default: 0 for non-blocking)
|
|
301
|
+
# @return [Integer] number of events served
|
|
302
|
+
# @raise [ClosedConsumerError] when the consumer is closed or closing
|
|
303
|
+
#
|
|
304
|
+
# @see #events_poll for more details on when to use this method
|
|
305
|
+
def events_poll_nb(timeout_ms = 0)
|
|
306
|
+
with_native(__method__) do |native|
|
|
307
|
+
inner = Rdkafka::Bindings::NativeShareConsumer.new(native)[:rkshare_rk]
|
|
308
|
+
Rdkafka::Bindings.rd_kafka_poll_nb(inner, timeout_ms)
|
|
309
|
+
end
|
|
310
|
+
end
|
|
311
|
+
|
|
267
312
|
# Acknowledges a message delivered by {#poll} in explicit acknowledgement mode
|
|
268
313
|
# (`share.acknowledgement.mode` set to `explicit`).
|
|
269
314
|
#
|
data/lib/rdkafka/version.rb
CHANGED
data/renovate.json
CHANGED