Skip to content

Commit a1c43f8

Browse files
authored
expose rd_kafka_global_init (#515)
* expose rd_kafka_global_init * fix patch reference
1 parent c1b6105 commit a1c43f8

File tree

5 files changed

+26
-1
lines changed

5 files changed

+26
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Rdkafka Changelog
22

3+
## 0.19.1 (Unreleased)
4+
- [Enhancement] Expose `rd_kafka_global_init` to mitigate macos forking issues.
5+
36
## 0.19.0 (2024-10-01)
47
- **[Breaking]** Drop Ruby 3.0 support
58
- [Enhancement] Update `librdkafka` to `2.5.3`
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This patch is released under the 2-clause BSD license, same as librdkafka
2+
#
3+
--- librdkafka_2.5.3/src/rdkafka.h
4+
+++ librdkafka_2.5.3/src/rdkafka.h
5+
@@ -1101,6 +1101,10 @@ rd_kafka_topic_partition_t *rd_kafka_topic_partition_list_find(
6+
const char *topic,
7+
int32_t partition);
8+
9+
+/**
10+
+ * @brief Allows for the global init of rdkafka when required in the Ruby process.
11+
+ */
12+
+RD_EXPORT void rd_kafka_global_init(void);
13+
14+
/**
15+
* @brief Sort list using comparator \p cmp.

lib/rdkafka.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,5 @@
4949
# Main Rdkafka namespace of this gem
5050
module Rdkafka
5151
end
52+
53+
Rdkafka::Bindings.rd_kafka_global_init

lib/rdkafka/bindings.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ class SizePtr < FFI::Struct
3030
layout :value, :size_t
3131
end
3232

33+
# This function comes from our patch on top of librdkafka. It allows os to load all the
34+
# librdkafka components without initializing the client
35+
# @see https://github.com/confluentinc/librdkafka/issues/4590
36+
attach_function :rd_kafka_global_init, [], :void
37+
3338
# Polling
3439

3540
attach_function :rd_kafka_flush, [:pointer, :int], :int, blocking: true

lib/rdkafka/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
module Rdkafka
4-
VERSION = "0.19.0"
4+
VERSION = "0.19.1"
55
LIBRDKAFKA_VERSION = "2.5.3"
66
LIBRDKAFKA_SOURCE_SHA256 = "eaa1213fdddf9c43e28834d9a832d9dd732377d35121e42f875966305f52b8ff"
77
end

0 commit comments

Comments
 (0)