karafka-rdkafka 0.30.1-x86_64-linux-gnu → 0.30.2-x86_64-linux-gnu

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ba50dfe1726abe16d98b287e28498a760f8c5ee1bcc142bd47b8ef2644244bd
4
- data.tar.gz: c73446fb5c031adf136cd336bd27e89cb6c209a6f757688326abd7fc0f9f26b6
3
+ metadata.gz: cbb40dd45194bfe913db2c3e4b68d8e45cca5822c26706b3546e2c1bedb2254a
4
+ data.tar.gz: 2c578200e780fa7d042838f065eea2cdaf9bba54fa8a27c4b189a85437d0326e
5
5
  SHA512:
6
- metadata.gz: afedd1b3142aa24fd07e78f33487469f0aee7798d4c34a1530908895939e96c7947c1cc0acf15c7e5303d5267b9c11e5ebc625250dab4b5206252cf2be7cdb93
7
- data.tar.gz: 255a32b0cc91f76e3bac2c51110c36820904dd51b12a50948bad518ad04e365289874684f7de22ef32c194c59dcadf6a15e59a487d26300816a4dd2d4bd5d5ba
6
+ metadata.gz: 2f3d48ebb027b44e10fc5b51ccdf12dc1b299d50a16f726c14bc842aae70efda4af0d1a98f38c672f07ee3ceecdbfa4e6eff34e259dd21a9aa80a64ca70e9377
7
+ data.tar.gz: 4ae4c8a318cd40d6029317035da005e23609e7675bf5d55040b0ff5ab100a3a577530f8f6b4ed1691c43c8c57de436bc6941badab3574ef3278585c7bf622637
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/ext/librdkafka.so CHANGED
Binary file
@@ -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}) and the native handle must never be used from a
26
- # polling thread, so only the {#close} interaction is synchronized here. {#close} may be
27
- # called from any thread and waits for in-flight calls to finish before tearing down.
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
  #
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Rdkafka
4
4
  # Current rdkafka-ruby gem version
5
- VERSION = "0.30.1"
5
+ VERSION = "0.30.2"
6
6
  # Target librdkafka version to be used
7
7
  LIBRDKAFKA_VERSION = "2.15.1"
8
8
  # SHA256 hash of the librdkafka source tarball for verification
data/renovate.json CHANGED
@@ -1,4 +1,7 @@
1
1
  {
2
+ "bundler": {
3
+ "managerFilePatterns": ["/(^|/)Gemfile\\.lint$/"]
4
+ },
2
5
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
6
  "extends": [
4
7
  "config:recommended"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karafka-rdkafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.1
4
+ version: 0.30.2
5
5
  platform: x86_64-linux-gnu
6
6
  authors:
7
7
  - Thijs Cadier