@platformatic/rdkafka 4.0.0 → 4.1.0-alpha.1

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 (293) hide show
  1. package/README.md +5 -5
  2. package/bench/seed.sh +0 -0
  3. package/binding.gyp +3 -3
  4. package/ci/prepublish.js +4 -3
  5. package/ci/update-version.js +123 -0
  6. package/config.d.ts +126 -10
  7. package/configure +0 -0
  8. package/deps/librdkafka/.semaphore/run-all-tests.yml +77 -0
  9. package/deps/librdkafka/.semaphore/semaphore-integration.yml +250 -0
  10. package/deps/librdkafka/.semaphore/semaphore.yml +67 -44
  11. package/deps/librdkafka/.semaphore/verify-linux-packages.yml +41 -0
  12. package/deps/librdkafka/CHANGELOG.md +471 -1
  13. package/deps/librdkafka/CONFIGURATION.md +29 -9
  14. package/deps/librdkafka/INTRODUCTION.md +909 -601
  15. package/deps/librdkafka/Makefile +2 -1
  16. package/deps/librdkafka/configure +0 -0
  17. package/deps/librdkafka/debian/rules +0 -0
  18. package/deps/librdkafka/dev-conf.sh +0 -0
  19. package/deps/librdkafka/examples/consumer.c +18 -8
  20. package/deps/librdkafka/examples/describe_consumer_groups.c +25 -6
  21. package/deps/librdkafka/examples/incremental_alter_configs.c +4 -5
  22. package/deps/librdkafka/examples/kafkatest_verifiable_client.cpp +26 -42
  23. package/deps/librdkafka/examples/openssl_engine_example.cpp +3 -4
  24. package/deps/librdkafka/examples/producer.cpp +2 -2
  25. package/deps/librdkafka/examples/user_scram.c +4 -5
  26. package/deps/librdkafka/examples/win_ssl_cert_store.cpp +4 -3
  27. package/deps/librdkafka/lds-gen.py +0 -0
  28. package/deps/librdkafka/mklove/Makefile.base +0 -0
  29. package/deps/librdkafka/packaging/RELEASE.md +8 -0
  30. package/deps/librdkafka/packaging/alpine/build-alpine.sh +0 -0
  31. package/deps/librdkafka/packaging/cp/README.md +4 -1
  32. package/deps/librdkafka/packaging/cp/check_features.c +12 -4
  33. package/deps/librdkafka/packaging/cp/verify-deb.sh +6 -6
  34. package/deps/librdkafka/packaging/cp/verify-packages.sh +52 -31
  35. package/deps/librdkafka/packaging/cp/verify-rpm.sh +6 -13
  36. package/deps/librdkafka/packaging/debian/docs +5 -0
  37. package/deps/librdkafka/packaging/debian/rules +0 -0
  38. package/deps/librdkafka/packaging/get_version.py +0 -0
  39. package/deps/librdkafka/packaging/homebrew/brew-update-pr.sh +0 -0
  40. package/deps/librdkafka/packaging/mingw-w64/{travis-before-install.sh → export-variables.sh} +0 -7
  41. package/deps/librdkafka/packaging/mingw-w64/semaphoreci-build.sh +1 -1
  42. package/deps/librdkafka/packaging/nuget/artifact.py +0 -0
  43. package/deps/librdkafka/packaging/nuget/cleanup-s3.py +0 -0
  44. package/deps/librdkafka/packaging/nuget/nuget.sh +0 -0
  45. package/deps/librdkafka/packaging/nuget/packaging.py +0 -0
  46. package/deps/librdkafka/packaging/nuget/push-to-nuget.sh +0 -0
  47. package/deps/librdkafka/packaging/nuget/release.py +0 -0
  48. package/deps/librdkafka/packaging/nuget/requirements.txt +3 -3
  49. package/deps/librdkafka/packaging/rpm/mock-on-docker.sh +0 -0
  50. package/deps/librdkafka/packaging/rpm/tests/run-test.sh +0 -0
  51. package/deps/librdkafka/packaging/rpm/tests/test-on-docker.sh +0 -0
  52. package/deps/librdkafka/packaging/tools/build-configurations-checks.sh +3 -1
  53. package/deps/librdkafka/packaging/tools/build-deb-package.sh +0 -0
  54. package/deps/librdkafka/packaging/tools/build-debian.sh +0 -0
  55. package/deps/librdkafka/packaging/tools/build-manylinux.sh +0 -0
  56. package/deps/librdkafka/packaging/tools/build-release-artifacts.sh +0 -0
  57. package/deps/librdkafka/packaging/tools/distro-build.sh +0 -0
  58. package/deps/librdkafka/packaging/tools/gh-release-checksums.py +0 -0
  59. package/deps/librdkafka/packaging/tools/rdutcoverage.sh +0 -0
  60. package/deps/librdkafka/packaging/tools/run-in-docker.sh +28 -0
  61. package/deps/librdkafka/packaging/tools/run-integration-tests.sh +31 -0
  62. package/deps/librdkafka/packaging/tools/run-style-check.sh +4 -0
  63. package/deps/librdkafka/packaging/tools/style-format.sh +6 -5
  64. package/deps/librdkafka/packaging/tools/update_rpcs_max_versions.py +100 -0
  65. package/deps/librdkafka/service.yml +154 -0
  66. package/deps/librdkafka/src/generate_proto.sh +0 -0
  67. package/deps/librdkafka/src/rd.h +145 -2
  68. package/deps/librdkafka/src/rdaddr.h +6 -7
  69. package/deps/librdkafka/src/rdatomic.h +15 -11
  70. package/deps/librdkafka/src/rdavg.h +3 -2
  71. package/deps/librdkafka/src/rdbase64.c +33 -2
  72. package/deps/librdkafka/src/rdbase64.h +2 -0
  73. package/deps/librdkafka/src/rdendian.h +10 -9
  74. package/deps/librdkafka/src/rdhttp.c +418 -100
  75. package/deps/librdkafka/src/rdhttp.h +23 -5
  76. package/deps/librdkafka/src/rdkafka.c +299 -145
  77. package/deps/librdkafka/src/rdkafka.h +89 -6
  78. package/deps/librdkafka/src/rdkafka_admin.c +482 -105
  79. package/deps/librdkafka/src/rdkafka_admin.h +42 -0
  80. package/deps/librdkafka/src/rdkafka_broker.c +463 -312
  81. package/deps/librdkafka/src/rdkafka_broker.h +68 -10
  82. package/deps/librdkafka/src/rdkafka_buf.c +8 -5
  83. package/deps/librdkafka/src/rdkafka_buf.h +4 -3
  84. package/deps/librdkafka/src/rdkafka_cert.c +25 -1
  85. package/deps/librdkafka/src/rdkafka_cert.h +4 -3
  86. package/deps/librdkafka/src/rdkafka_cgrp.c +468 -143
  87. package/deps/librdkafka/src/rdkafka_cgrp.h +36 -2
  88. package/deps/librdkafka/src/rdkafka_conf.c +526 -102
  89. package/deps/librdkafka/src/rdkafka_conf.h +68 -4
  90. package/deps/librdkafka/src/rdkafka_feature.c +472 -35
  91. package/deps/librdkafka/src/rdkafka_feature.h +2 -0
  92. package/deps/librdkafka/src/rdkafka_fetcher.c +22 -2
  93. package/deps/librdkafka/src/rdkafka_fetcher.h +2 -2
  94. package/deps/librdkafka/src/rdkafka_int.h +84 -46
  95. package/deps/librdkafka/src/rdkafka_metadata.c +221 -136
  96. package/deps/librdkafka/src/rdkafka_metadata.h +15 -11
  97. package/deps/librdkafka/src/rdkafka_metadata_cache.c +279 -73
  98. package/deps/librdkafka/src/rdkafka_mock.c +795 -19
  99. package/deps/librdkafka/src/rdkafka_mock.h +119 -0
  100. package/deps/librdkafka/src/rdkafka_mock_cgrp.c +1298 -132
  101. package/deps/librdkafka/src/rdkafka_mock_handlers.c +345 -49
  102. package/deps/librdkafka/src/rdkafka_mock_int.h +180 -61
  103. package/deps/librdkafka/src/rdkafka_msg.c +35 -19
  104. package/deps/librdkafka/src/rdkafka_msg.h +3 -3
  105. package/deps/librdkafka/src/rdkafka_msgset_writer.c +14 -10
  106. package/deps/librdkafka/src/rdkafka_offset.c +33 -5
  107. package/deps/librdkafka/src/rdkafka_op.c +1 -1
  108. package/deps/librdkafka/src/rdkafka_op.h +45 -21
  109. package/deps/librdkafka/src/rdkafka_partition.c +118 -23
  110. package/deps/librdkafka/src/rdkafka_partition.h +16 -7
  111. package/deps/librdkafka/src/rdkafka_proto.h +4 -1
  112. package/deps/librdkafka/src/rdkafka_protocol.h +1 -0
  113. package/deps/librdkafka/src/rdkafka_queue.c +125 -48
  114. package/deps/librdkafka/src/rdkafka_queue.h +19 -0
  115. package/deps/librdkafka/src/rdkafka_range_assignor.c +1 -1
  116. package/deps/librdkafka/src/rdkafka_request.c +336 -64
  117. package/deps/librdkafka/src/rdkafka_request.h +24 -1
  118. package/deps/librdkafka/src/rdkafka_sasl.c +5 -3
  119. package/deps/librdkafka/src/rdkafka_sasl_oauthbearer.c +14 -10
  120. package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.c +1166 -89
  121. package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.h +13 -3
  122. package/deps/librdkafka/src/rdkafka_sasl_plain.c +3 -3
  123. package/deps/librdkafka/src/rdkafka_sasl_scram.c +4 -3
  124. package/deps/librdkafka/src/rdkafka_ssl.c +306 -81
  125. package/deps/librdkafka/src/rdkafka_ssl.h +22 -0
  126. package/deps/librdkafka/src/rdkafka_sticky_assignor.c +4 -0
  127. package/deps/librdkafka/src/rdkafka_telemetry.c +80 -23
  128. package/deps/librdkafka/src/rdkafka_telemetry_encode.c +5 -1
  129. package/deps/librdkafka/src/rdkafka_telemetry_encode.h +20 -20
  130. package/deps/librdkafka/src/rdkafka_topic.c +220 -137
  131. package/deps/librdkafka/src/rdkafka_topic.h +14 -8
  132. package/deps/librdkafka/src/rdkafka_transport.c +59 -47
  133. package/deps/librdkafka/src/rdkafka_transport.h +5 -0
  134. package/deps/librdkafka/src/rdkafka_txnmgr.c +6 -1
  135. package/deps/librdkafka/src/rdmap.c +6 -1
  136. package/deps/librdkafka/src/rdrand.c +11 -1
  137. package/deps/librdkafka/src/rdtime.h +48 -17
  138. package/deps/librdkafka/src/rdunittest.c +42 -25
  139. package/deps/librdkafka/src/rdunittest.h +2 -0
  140. package/deps/librdkafka/src/rdwin32.h +1 -1
  141. package/deps/librdkafka/src/regexp.c +47 -42
  142. package/deps/librdkafka/src/tinycthread_extra.c +45 -21
  143. package/deps/librdkafka/src/tinycthread_extra.h +7 -3
  144. package/deps/librdkafka/src-cpp/rdkafkacpp.h +28 -2
  145. package/deps/librdkafka/tests/0001-multiobj.c +4 -0
  146. package/deps/librdkafka/tests/0004-conf.c +103 -36
  147. package/deps/librdkafka/tests/0009-mock_cluster.c +1 -0
  148. package/deps/librdkafka/tests/0011-produce_batch.c +2 -1
  149. package/deps/librdkafka/tests/0016-client_swname.c +18 -3
  150. package/deps/librdkafka/tests/0017-compression.c +6 -8
  151. package/deps/librdkafka/tests/0018-cgrp_term.c +8 -3
  152. package/deps/librdkafka/tests/0021-rkt_destroy.c +1 -0
  153. package/deps/librdkafka/tests/0022-consume_batch.c +4 -1
  154. package/deps/librdkafka/tests/0026-consume_pause.c +12 -14
  155. package/deps/librdkafka/tests/0028-long_topicnames.c +1 -1
  156. package/deps/librdkafka/tests/0029-assign_offset.c +6 -8
  157. package/deps/librdkafka/tests/0030-offset_commit.c +2 -2
  158. package/deps/librdkafka/tests/0033-regex_subscribe.c +33 -17
  159. package/deps/librdkafka/tests/0034-offset_reset.c +25 -4
  160. package/deps/librdkafka/tests/0036-partial_fetch.c +1 -0
  161. package/deps/librdkafka/tests/0038-performance.c +1 -0
  162. package/deps/librdkafka/tests/0040-io_event.c +11 -5
  163. package/deps/librdkafka/tests/0041-fetch_max_bytes.c +1 -0
  164. package/deps/librdkafka/tests/0044-partition_cnt.c +3 -2
  165. package/deps/librdkafka/tests/0045-subscribe_update.c +284 -20
  166. package/deps/librdkafka/tests/0047-partial_buf_tmout.c +1 -0
  167. package/deps/librdkafka/tests/0048-partitioner.c +1 -1
  168. package/deps/librdkafka/tests/0050-subscribe_adds.c +1 -0
  169. package/deps/librdkafka/tests/0051-assign_adds.c +1 -0
  170. package/deps/librdkafka/tests/0052-msg_timestamps.c +22 -4
  171. package/deps/librdkafka/tests/0053-stats_cb.cpp +12 -20
  172. package/deps/librdkafka/tests/0055-producer_latency.c +176 -3
  173. package/deps/librdkafka/tests/0056-balanced_group_mt.c +6 -2
  174. package/deps/librdkafka/tests/0058-log.cpp +3 -3
  175. package/deps/librdkafka/tests/0059-bsearch.cpp +8 -4
  176. package/deps/librdkafka/tests/0061-consumer_lag.cpp +25 -5
  177. package/deps/librdkafka/tests/0067-empty_topic.cpp +3 -0
  178. package/deps/librdkafka/tests/0068-produce_timeout.c +21 -23
  179. package/deps/librdkafka/tests/0069-consumer_add_parts.c +3 -7
  180. package/deps/librdkafka/tests/0075-retry.c +38 -1
  181. package/deps/librdkafka/tests/0076-produce_retry.c +2 -0
  182. package/deps/librdkafka/tests/0077-compaction.c +8 -2
  183. package/deps/librdkafka/tests/0080-admin_ut.c +34 -4
  184. package/deps/librdkafka/tests/0081-admin.c +455 -155
  185. package/deps/librdkafka/tests/0082-fetch_max_bytes.cpp +4 -0
  186. package/deps/librdkafka/tests/0083-cb_event.c +8 -3
  187. package/deps/librdkafka/tests/0084-destroy_flags.c +14 -18
  188. package/deps/librdkafka/tests/0085-headers.cpp +4 -0
  189. package/deps/librdkafka/tests/0086-purge.c +40 -7
  190. package/deps/librdkafka/tests/0088-produce_metadata_timeout.c +1 -1
  191. package/deps/librdkafka/tests/0089-max_poll_interval.c +12 -7
  192. package/deps/librdkafka/tests/0090-idempotence.c +1 -2
  193. package/deps/librdkafka/tests/0091-max_poll_interval_timeout.c +5 -7
  194. package/deps/librdkafka/tests/0092-mixed_msgver.c +6 -0
  195. package/deps/librdkafka/tests/0093-holb.c +8 -5
  196. package/deps/librdkafka/tests/0094-idempotence_msg_timeout.c +1 -0
  197. package/deps/librdkafka/tests/0097-ssl_verify.cpp +262 -70
  198. package/deps/librdkafka/tests/0098-consumer-txn.cpp +16 -16
  199. package/deps/librdkafka/tests/0099-commit_metadata.c +1 -1
  200. package/deps/librdkafka/tests/0101-fetch-from-follower.cpp +1 -1
  201. package/deps/librdkafka/tests/0102-static_group_rebalance.c +317 -16
  202. package/deps/librdkafka/tests/0103-transactions.c +7 -7
  203. package/deps/librdkafka/tests/0104-fetch_from_follower_mock.c +1 -0
  204. package/deps/librdkafka/tests/0105-transactions_mock.c +18 -11
  205. package/deps/librdkafka/tests/0106-cgrp_sess_timeout.c +35 -14
  206. package/deps/librdkafka/tests/0107-topic_recreate.c +2 -2
  207. package/deps/librdkafka/tests/0109-auto_create_topics.cpp +86 -26
  208. package/deps/librdkafka/tests/0110-batch_size.cpp +1 -2
  209. package/deps/librdkafka/tests/0112-assign_unknown_part.c +3 -14
  210. package/deps/librdkafka/tests/0113-cooperative_rebalance.cpp +248 -104
  211. package/deps/librdkafka/tests/0114-sticky_partitioning.cpp +3 -3
  212. package/deps/librdkafka/tests/0115-producer_auth.cpp +4 -1
  213. package/deps/librdkafka/tests/0116-kafkaconsumer_close.cpp +7 -5
  214. package/deps/librdkafka/tests/0117-mock_errors.c +15 -5
  215. package/deps/librdkafka/tests/0118-commit_rebalance.c +41 -8
  216. package/deps/librdkafka/tests/0119-consumer_auth.cpp +20 -1
  217. package/deps/librdkafka/tests/0120-asymmetric_subscription.c +8 -3
  218. package/deps/librdkafka/tests/0125-immediate_flush.c +1 -1
  219. package/deps/librdkafka/tests/0126-oauthbearer_oidc.c +323 -8
  220. package/deps/librdkafka/tests/0129-fetch_aborted_msgs.c +1 -0
  221. package/deps/librdkafka/tests/0132-strategy_ordering.c +12 -4
  222. package/deps/librdkafka/tests/0133-ssl_keys.c +28 -6
  223. package/deps/librdkafka/tests/0137-barrier_batch_consume.c +24 -14
  224. package/deps/librdkafka/tests/0139-offset_validation_mock.c +510 -2
  225. package/deps/librdkafka/tests/0140-commit_metadata.cpp +1 -1
  226. package/deps/librdkafka/tests/0142-reauthentication.c +37 -17
  227. package/deps/librdkafka/tests/0143-exponential_backoff_mock.c +39 -40
  228. package/deps/librdkafka/tests/0146-metadata_mock.c +76 -15
  229. package/deps/librdkafka/tests/0147-consumer_group_consumer_mock.c +952 -0
  230. package/deps/librdkafka/tests/0148-offset_fetch_commit_error_mock.c +563 -0
  231. package/deps/librdkafka/tests/0149-broker-same-host-port.c +140 -0
  232. package/deps/librdkafka/tests/0150-telemetry_mock.c +9 -6
  233. package/deps/librdkafka/tests/0151-purge-brokers.c +566 -0
  234. package/deps/librdkafka/tests/0152-rebootstrap.c +59 -0
  235. package/deps/librdkafka/tests/0153-memberid.c +128 -0
  236. package/deps/librdkafka/tests/CMakeLists.txt +6 -0
  237. package/deps/librdkafka/tests/LibrdkafkaTestApp.py +34 -9
  238. package/deps/librdkafka/tests/autotest.sh +0 -0
  239. package/deps/librdkafka/tests/broker_version_tests.py +0 -0
  240. package/deps/librdkafka/tests/buildbox.sh +0 -0
  241. package/deps/librdkafka/tests/cleanup-checker-tests.sh +0 -0
  242. package/deps/librdkafka/tests/cluster_testing.py +0 -0
  243. package/deps/librdkafka/tests/delete-test-topics.sh +0 -0
  244. package/deps/librdkafka/tests/fixtures/oauthbearer/jwt_assertion_template.json +10 -0
  245. package/deps/librdkafka/tests/fixtures/ssl/client.keystore.intermediate.p12 +0 -0
  246. package/deps/librdkafka/tests/fixtures/ssl/client.keystore.p12 +0 -0
  247. package/deps/librdkafka/tests/fixtures/ssl/client2.certificate.intermediate.pem +72 -0
  248. package/deps/librdkafka/tests/fixtures/ssl/client2.certificate.pem +42 -101
  249. package/deps/librdkafka/tests/fixtures/ssl/client2.intermediate.key +46 -0
  250. package/deps/librdkafka/tests/fixtures/ssl/client2.key +41 -29
  251. package/deps/librdkafka/tests/fixtures/ssl/create_keys.sh +112 -37
  252. package/deps/librdkafka/tests/gen-ssl-certs.sh +0 -0
  253. package/deps/librdkafka/tests/interactive_broker_version.py +0 -0
  254. package/deps/librdkafka/tests/java/Makefile +2 -1
  255. package/deps/librdkafka/tests/java/run-class.sh +0 -0
  256. package/deps/librdkafka/tests/lz4_manual_test.sh +0 -0
  257. package/deps/librdkafka/tests/multi-broker-version-test.sh +0 -0
  258. package/deps/librdkafka/tests/parse-refcnt.sh +0 -0
  259. package/deps/librdkafka/tests/performance_plot.py +0 -0
  260. package/deps/librdkafka/tests/requirements.txt +1 -1
  261. package/deps/librdkafka/tests/run-all-tests.sh +79 -0
  262. package/deps/librdkafka/tests/run-consumer-tests.sh +0 -0
  263. package/deps/librdkafka/tests/run-producer-tests.sh +0 -0
  264. package/deps/librdkafka/tests/run-test-batches.py +157 -0
  265. package/deps/librdkafka/tests/run-test.sh +0 -0
  266. package/deps/librdkafka/tests/sasl_test.py +0 -0
  267. package/deps/librdkafka/tests/test.c +478 -18
  268. package/deps/librdkafka/tests/test.h +62 -13
  269. package/deps/librdkafka/tests/testcpp.cpp +6 -1
  270. package/deps/librdkafka/tests/testcpp.h +30 -2
  271. package/deps/librdkafka/tests/testshared.h +16 -2
  272. package/deps/librdkafka/tests/tools/stats/graph.py +0 -0
  273. package/deps/librdkafka/tests/tools/stats/to_csv.py +1 -1
  274. package/deps/librdkafka/tests/trivup/trivup-0.14.0.tar.gz +0 -0
  275. package/deps/librdkafka/tests/until-fail.sh +0 -0
  276. package/deps/librdkafka/tests/xxxx-metadata.cpp +1 -1
  277. package/deps/librdkafka/vcpkg.json +1 -1
  278. package/deps/librdkafka/win32/setup-msys2.ps1 +24 -8
  279. package/deps/librdkafka/win32/setup-vcpkg.ps1 +28 -6
  280. package/deps/librdkafka/win32/tests/tests.vcxproj +6 -0
  281. package/deps/librdkafka/win32/wingetopt.h +5 -4
  282. package/errors.d.ts +27 -1
  283. package/lib/error.js +29 -3
  284. package/make_docs.sh +0 -0
  285. package/package.json +12 -13
  286. package/run_docker.sh +0 -0
  287. package/src/callbacks.cc +6 -9
  288. package/src/callbacks.h +1 -5
  289. package/test/kafka-consumer-worker.js +10 -7
  290. package/test/kafka-consumer.spec.js +32 -21
  291. package/deps/librdkafka/.semaphore/project.yml +0 -43
  292. package/deps/librdkafka/.semaphore/project_public.yml +0 -20
  293. package/deps/librdkafka/win32/install-openssl.ps1 +0 -33
@@ -2,6 +2,7 @@
2
2
  * librdkafka - Apache Kafka C library
3
3
  *
4
4
  * Copyright (c) 2016-2022, Magnus Edenhill
5
+ * 2025, Confluent Inc.
5
6
  * All rights reserved.
6
7
  *
7
8
  * Redistribution and use in source and binary forms, with or without
@@ -87,6 +88,9 @@ static void do_test_fetch_max_bytes(void) {
87
88
  Test::Fail("Failed to create KafkaConsumer: " + errstr);
88
89
  delete conf;
89
90
 
91
+ /* For next consumer */
92
+ test_wait_topic_exists(c->c_ptr(), topic.c_str(), 5000);
93
+
90
94
  /* Subscribe */
91
95
  std::vector<std::string> topics;
92
96
  topics.push_back(topic);
@@ -2,6 +2,7 @@
2
2
  * librdkafka - Apache Kafka C library
3
3
  *
4
4
  * Copyright (c) 2018-2022, Magnus Edenhill
5
+ * 2025, Confluent Inc.
5
6
  * All rights reserved.
6
7
  *
7
8
  * Redistribution and use in source and binary forms, with or without
@@ -101,6 +102,7 @@ int main_0083_cb_event(int argc, char **argv) {
101
102
  err = test_auto_create_topic_rkt(rk_p, rkt_p, tmout_multip(5000));
102
103
  TEST_ASSERT(!err, "Topic auto creation failed: %s",
103
104
  rd_kafka_err2str(err));
105
+ test_wait_topic_exists(rk_p, topic, 5000);
104
106
 
105
107
  test_conf_init(&conf, &tconf, 0);
106
108
  rd_kafka_conf_set_events(conf, RD_KAFKA_EVENT_REBALANCE);
@@ -152,13 +154,16 @@ int main_0083_cb_event(int argc, char **argv) {
152
154
  "expecting message\n");
153
155
  if (rd_kafka_event_error(rkev) ==
154
156
  RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS) {
155
- rd_kafka_assign(
156
- rk_c,
157
+ test_consumer_assign_by_rebalance_protocol(
158
+ "rebalance event", rk_c,
157
159
  rd_kafka_event_topic_partition_list(
158
160
  rkev));
159
161
  expecting_io = _NOPE;
160
162
  } else
161
- rd_kafka_assign(rk_c, NULL);
163
+ test_consumer_unassign_by_rebalance_protocol(
164
+ "rebalance event", rk_c,
165
+ rd_kafka_event_topic_partition_list(
166
+ rkev));
162
167
  break;
163
168
 
164
169
  case RD_KAFKA_EVENT_FETCH:
@@ -42,22 +42,7 @@ static void destroy_flags_rebalance_cb(rd_kafka_t *rk,
42
42
  rd_kafka_topic_partition_list_t *parts,
43
43
  void *opaque) {
44
44
  rebalance_cnt++;
45
-
46
- TEST_SAY("rebalance_cb: %s with %d partition(s)\n",
47
- rd_kafka_err2str(err), parts->cnt);
48
-
49
- switch (err) {
50
- case RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS:
51
- test_consumer_assign("rebalance", rk, parts);
52
- break;
53
-
54
- case RD_KAFKA_RESP_ERR__REVOKE_PARTITIONS:
55
- test_consumer_unassign("rebalance", rk);
56
- break;
57
-
58
- default:
59
- TEST_FAIL("rebalance_cb: error: %s", rd_kafka_err2str(err));
60
- }
45
+ test_rebalance_cb(rk, err, parts, opaque);
61
46
  }
62
47
 
63
48
  struct df_args {
@@ -162,6 +147,8 @@ static void do_test_destroy_flags(const char *topic,
162
147
  destroy_flags, args->client_type, args->produce_cnt,
163
148
  args->consumer_subscribe, args->consumer_unsubscribe,
164
149
  local_mode ? "local" : "broker");
150
+
151
+ TEST_LATER_CHECK();
165
152
  }
166
153
 
167
154
 
@@ -184,8 +171,7 @@ static void destroy_flags(int local_mode) {
184
171
  /* Create the topic to avoid not-yet-auto-created-topics being
185
172
  * subscribed to (and thus raising an error). */
186
173
  if (!local_mode) {
187
- test_create_topic(NULL, topic, 3, 1);
188
- test_wait_topic_exists(NULL, topic, 5000);
174
+ test_create_topic_wait_exists(NULL, topic, 3, 1, 5000);
189
175
  }
190
176
 
191
177
  for (i = 0; i < (int)RD_ARRAYSIZE(args); i++) {
@@ -202,11 +188,21 @@ static void destroy_flags(int local_mode) {
202
188
 
203
189
 
204
190
  int main_0084_destroy_flags_local(int argc, char **argv) {
191
+ /* FIXME: fix the test with subscribe/unsubscribe PR. */
192
+ if (!test_consumer_group_protocol_classic()) {
193
+ TEST_SKIP("FIXME: fix the test with subscribe/unsubscribe PR");
194
+ return 0;
195
+ }
205
196
  destroy_flags(1 /*no brokers*/);
206
197
  return 0;
207
198
  }
208
199
 
209
200
  int main_0084_destroy_flags(int argc, char **argv) {
201
+ /* FIXME: fix the test with subscribe/unsubscribe PR. */
202
+ if (!test_consumer_group_protocol_classic()) {
203
+ TEST_SKIP("FIXME: fix the test with subscribe/unsubscribe PR");
204
+ return 0;
205
+ }
210
206
  destroy_flags(0 /*with brokers*/);
211
207
  return 0;
212
208
  }
@@ -2,6 +2,7 @@
2
2
  * librdkafka - Apache Kafka C library
3
3
  *
4
4
  * Copyright (c) 2012-2022, Magnus Edenhill
5
+ * 2025, Confluent Inc.
5
6
  * All rights reserved.
6
7
  *
7
8
  * Redistribution and use in source and binary forms, with or without
@@ -357,6 +358,8 @@ int main_0085_headers(int argc, char **argv) {
357
358
 
358
359
  delete conf;
359
360
 
361
+ Test::create_topic_wait_exists(p, topic.c_str(), 1, -1, 5000);
362
+
360
363
  std::vector<RdKafka::TopicPartition *> parts;
361
364
  parts.push_back(RdKafka::TopicPartition::create(
362
365
  topic, 0, RdKafka::Topic::OFFSET_BEGINNING));
@@ -379,6 +382,7 @@ int main_0085_headers(int argc, char **argv) {
379
382
  test_failed_produce();
380
383
  test_assignment_op();
381
384
 
385
+ Test::delete_topic(p, topic.c_str());
382
386
  c->close();
383
387
  delete c;
384
388
  delete p;
@@ -57,8 +57,13 @@ struct waitmsgs {
57
57
  };
58
58
 
59
59
  static mtx_t produce_req_lock;
60
+ static mtx_t produce_sent_req_lock;
60
61
  static cnd_t produce_req_cnd;
62
+ static cnd_t produce_sent_req_cnd;
63
+ /* Number of completed produce requests, increased on response */
61
64
  static int produce_req_cnt = 0;
65
+ /* Number of sent produce requests, increased on request */
66
+ static int produce_sent_req_cnt = 0;
62
67
 
63
68
 
64
69
  #if WITH_SOCKEM
@@ -75,10 +80,13 @@ static rd_kafka_resp_err_t on_request_sent(rd_kafka_t *rk,
75
80
  size_t size,
76
81
  void *ic_opaque) {
77
82
 
78
- /* Save socket fd to limit ProduceRequest */
79
- if (ApiKey == RD_KAFKAP_ApiVersion) {
83
+ if (ApiKey == RD_KAFKAP_Produce) {
84
+ mtx_lock(&produce_sent_req_lock);
85
+ produce_sent_req_cnt++;
80
86
  test_sockfd = sockfd;
81
- return RD_KAFKA_RESP_ERR_NO_ERROR;
87
+ if (produce_sent_req_cnt > 1)
88
+ cnd_broadcast(&produce_sent_req_cnd);
89
+ mtx_unlock(&produce_sent_req_lock);
82
90
  }
83
91
 
84
92
  return RD_KAFKA_RESP_ERR_NO_ERROR;
@@ -226,6 +234,8 @@ do_test_purge(const char *what, int remote, int idempotence, int gapless) {
226
234
  test_conf_set(conf, "enable.gapless.guarantee",
227
235
  gapless ? "true" : "false");
228
236
  rd_kafka_conf_set_dr_msg_cb(conf, dr_msg_cb);
237
+ produce_req_cnt = 0;
238
+ produce_sent_req_cnt = 0;
229
239
 
230
240
  if (remote) {
231
241
  #if WITH_SOCKEM
@@ -238,12 +248,18 @@ do_test_purge(const char *what, int remote, int idempotence, int gapless) {
238
248
  test_curr->is_fatal_cb = gapless_is_not_fatal_cb;
239
249
 
240
250
  mtx_init(&produce_req_lock, mtx_plain);
251
+ mtx_init(&produce_sent_req_lock, mtx_plain);
241
252
  cnd_init(&produce_req_cnd);
253
+ cnd_init(&produce_sent_req_cnd);
242
254
  } else {
243
255
  test_conf_set(conf, "bootstrap.servers", NULL);
244
256
  }
245
257
 
246
258
  rk = test_create_handle(RD_KAFKA_PRODUCER, conf);
259
+ if (remote)
260
+ /* Pre-create the topic to avoid unknown topic errors
261
+ * because of metadata propagation */
262
+ test_create_topic_wait_exists(NULL, topic, 3, -1, 5000);
247
263
 
248
264
  TEST_SAY("Producing %d messages to topic %s\n", msgcnt, topic);
249
265
 
@@ -269,16 +285,16 @@ do_test_purge(const char *what, int remote, int idempotence, int gapless) {
269
285
  rd_kafka_err2str(err));
270
286
 
271
287
  waitmsgs.exp_err[i] =
272
- (remote && i < 10
273
- ? RD_KAFKA_RESP_ERR_NO_ERROR
274
- : remote && i < 20 ? RD_KAFKA_RESP_ERR__PURGE_INFLIGHT
275
- : RD_KAFKA_RESP_ERR__PURGE_QUEUE);
288
+ (remote && i < 10 ? RD_KAFKA_RESP_ERR_NO_ERROR
289
+ : remote && i < 20 ? RD_KAFKA_RESP_ERR__PURGE_INFLIGHT
290
+ : RD_KAFKA_RESP_ERR__PURGE_QUEUE);
276
291
 
277
292
  waitmsgs.cnt++;
278
293
  }
279
294
 
280
295
 
281
296
  if (remote) {
297
+ test_timing_t t_produce;
282
298
  /* Wait for ProduceRequest to be sent */
283
299
  mtx_lock(&produce_req_lock);
284
300
  cnd_timedwait_ms(&produce_req_cnd, &produce_req_lock,
@@ -287,6 +303,23 @@ do_test_purge(const char *what, int remote, int idempotence, int gapless) {
287
303
  "First Produce request should've been sent by now");
288
304
  mtx_unlock(&produce_req_lock);
289
305
 
306
+ /* Wait second ProduceRequest is in-flight */
307
+ TIMING_START(&t_produce, "PRODUCE");
308
+ mtx_lock(&produce_sent_req_lock);
309
+ if (produce_sent_req_cnt < 2) {
310
+ cnd_timedwait_ms(&produce_sent_req_cnd,
311
+ &produce_sent_req_lock, 15 * 1000);
312
+ }
313
+ TEST_ASSERT(produce_sent_req_cnt == 2,
314
+ "No more than 2 requests should've "
315
+ "been sent by now, "
316
+ "%d sent produce requests",
317
+ produce_sent_req_cnt);
318
+ mtx_unlock(&produce_sent_req_lock);
319
+ /* Even if still not in-flight, it should be sent
320
+ * almost immediately given there are 19 messages in queue. */
321
+ TIMING_ASSERT_LATER(&t_produce, 0, 100);
322
+
290
323
  purge_and_expect(what, __LINE__, rk, RD_KAFKA_PURGE_F_QUEUE,
291
324
  &waitmsgs, 10,
292
325
  "in-flight messages should not be purged");
@@ -114,7 +114,7 @@ int main_0088_produce_metadata_timeout(int argc, char **argv) {
114
114
  rk = test_create_handle(RD_KAFKA_PRODUCER, conf);
115
115
 
116
116
  /* Create topic with single partition, for simplicity. */
117
- test_create_topic(rk, topic, 1, 1);
117
+ test_create_topic_wait_exists(rk, topic, 1, 1, 5000);
118
118
 
119
119
  rkt = rd_kafka_topic_new(rk, topic, NULL);
120
120
 
@@ -61,7 +61,7 @@ static void do_test(void) {
61
61
 
62
62
  testid = test_id_generate();
63
63
 
64
- test_create_topic(NULL, topic, 1, 1);
64
+ test_create_topic_wait_exists(NULL, topic, 1, 1, 5000);
65
65
 
66
66
  test_produce_msgs_easy(topic, testid, -1, msgcnt);
67
67
 
@@ -212,7 +212,7 @@ static void do_test_with_log_queue(void) {
212
212
 
213
213
  testid = test_id_generate();
214
214
 
215
- test_create_topic(NULL, topic, 1, 1);
215
+ test_create_topic_wait_exists(NULL, topic, 1, 1, 5000);
216
216
 
217
217
  test_produce_msgs_easy(topic, testid, -1, msgcnt);
218
218
 
@@ -380,7 +380,7 @@ do_test_rejoin_after_interval_expire(rd_bool_t forward_to_another_q,
380
380
  "%d",
381
381
  forward_to_another_q, forward_to_consumer_q);
382
382
 
383
- test_create_topic(NULL, topic, 1, 1);
383
+ test_create_topic_wait_exists(NULL, topic, 1, 1, 5000);
384
384
 
385
385
  test_str_id_generate(groupid, sizeof(groupid));
386
386
  test_conf_init(&conf, NULL, 60);
@@ -413,7 +413,9 @@ do_test_rejoin_after_interval_expire(rd_bool_t forward_to_another_q,
413
413
  TEST_ASSERT(rd_kafka_event_error(event) ==
414
414
  RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS,
415
415
  "Group join should assign partitions");
416
- rd_kafka_assign(rk, rd_kafka_event_topic_partition_list(event));
416
+ test_consumer_assign_by_rebalance_protocol(
417
+ "initial group join", rk,
418
+ rd_kafka_event_topic_partition_list(event));
417
419
  rd_kafka_event_destroy(event);
418
420
 
419
421
  rd_sleep(10 + 1); /* Exceed max.poll.interval.ms. */
@@ -426,7 +428,8 @@ do_test_rejoin_after_interval_expire(rd_bool_t forward_to_another_q,
426
428
  TEST_ASSERT(rd_kafka_event_error(event) ==
427
429
  RD_KAFKA_RESP_ERR__REVOKE_PARTITIONS,
428
430
  "Group leave should revoke partitions");
429
- rd_kafka_assign(rk, NULL);
431
+ test_consumer_unassign_by_rebalance_protocol(
432
+ "group leave", rk, rd_kafka_event_topic_partition_list(event));
430
433
  rd_kafka_event_destroy(event);
431
434
 
432
435
  event = test_wait_event(polling_queue, RD_KAFKA_EVENT_REBALANCE,
@@ -435,7 +438,9 @@ do_test_rejoin_after_interval_expire(rd_bool_t forward_to_another_q,
435
438
  TEST_ASSERT(rd_kafka_event_error(event) ==
436
439
  RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS,
437
440
  "Group rejoin should assign partitions");
438
- rd_kafka_assign(rk, rd_kafka_event_topic_partition_list(event));
441
+
442
+ test_consumer_assign_by_rebalance_protocol(
443
+ "group rejoin", rk, rd_kafka_event_topic_partition_list(event));
439
444
  rd_kafka_event_destroy(event);
440
445
 
441
446
  if (forward_to_another_q)
@@ -466,7 +471,7 @@ static void do_test_max_poll_reset_with_consumer_cb(void) {
466
471
 
467
472
  SUB_TEST();
468
473
 
469
- test_create_topic(NULL, topic, 1, 1);
474
+ test_create_topic_wait_exists(NULL, topic, 1, 1, 5000);
470
475
  uint64_t testid = test_id_generate();
471
476
 
472
477
  test_produce_msgs_easy(topic, testid, -1, 100);
@@ -130,11 +130,10 @@ static void do_test_implicit_ack(const char *what,
130
130
 
131
131
  rk = test_create_handle(RD_KAFKA_PRODUCER, conf);
132
132
 
133
- test_create_topic(rk, topic, 1, 1);
133
+ test_create_topic_wait_exists(rk, topic, 1, 1, 5000);
134
134
 
135
135
  rkt = test_create_producer_topic(rk, topic, NULL);
136
136
 
137
-
138
137
  TEST_SAY("Producing %d messages\n", msgcnt);
139
138
  test_produce_msgs(rk, rkt, testid, -1, 0, msgcnt, NULL, 0);
140
139
 
@@ -2,6 +2,7 @@
2
2
  * librdkafka - Apache Kafka C library
3
3
  *
4
4
  * Copyright (c) 2012-2022, Magnus Edenhill
5
+ * 2025, Confluent Inc.
5
6
  * All rights reserved.
6
7
  *
7
8
  * Redistribution and use in source and binary forms, with or without
@@ -101,10 +102,7 @@ static void rebalance_cb(rd_kafka_t *rk,
101
102
  rd_kafka_name(cons->rk), cons->rebalance_cnt,
102
103
  cons->max_rebalance_cnt);
103
104
 
104
- if (err == RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS)
105
- rd_kafka_assign(rk, parts);
106
- else
107
- rd_kafka_assign(rk, NULL);
105
+ test_rebalance_cb(rk, err, parts, opaque);
108
106
  }
109
107
 
110
108
 
@@ -206,7 +204,7 @@ static void do_test_with_assign(const char *topic) {
206
204
 
207
205
  test_conf_init(&conf, NULL, 60);
208
206
 
209
- test_create_topic(NULL, topic, 2, 1);
207
+ test_create_topic_wait_exists(NULL, topic, 2, 1, 5000);
210
208
 
211
209
  test_conf_set(conf, "session.timeout.ms", "6000");
212
210
  test_conf_set(conf, "max.poll.interval.ms", "7000" /*7s*/);
@@ -251,7 +249,7 @@ static void do_test_no_poll(const char *topic) {
251
249
 
252
250
  test_conf_init(&conf, NULL, 60);
253
251
 
254
- test_create_topic(NULL, topic, 2, 1);
252
+ test_create_topic_wait_exists(NULL, topic, 2, 1, 5000);
255
253
 
256
254
  test_conf_set(conf, "session.timeout.ms", "6000");
257
255
  test_conf_set(conf, "max.poll.interval.ms", "7000" /*7s*/);
@@ -285,7 +283,7 @@ int main_0091_max_poll_interval_timeout(int argc, char **argv) {
285
283
  const char *topic =
286
284
  test_mk_topic_name("0091_max_poll_interval_tmout", 1);
287
285
 
288
- test_create_topic(NULL, topic, 2, 1);
286
+ test_create_topic_wait_exists(NULL, topic, 2, 1, 5000);
289
287
 
290
288
  do_test_with_subscribe(topic);
291
289
 
@@ -2,6 +2,7 @@
2
2
  * librdkafka - Apache Kafka C library
3
3
  *
4
4
  * Copyright (c) 2018-2022, Magnus Edenhill
5
+ * 2025, Confluent Inc.
5
6
  * All rights reserved.
6
7
  *
7
8
  * Redistribution and use in source and binary forms, with or without
@@ -54,6 +55,11 @@ int main_0092_mixed_msgver(int argc, char **argv) {
54
55
  return 0;
55
56
  }
56
57
 
58
+ if (test_broker_version >= TEST_BRKVER(4, 0, 0, 0)) {
59
+ TEST_SKIP("MsgVersion 1 was removed in Apache Kafka 4.0\n");
60
+ return 0;
61
+ }
62
+
57
63
  testid = test_id_generate();
58
64
 
59
65
  rk = test_create_producer();
@@ -2,6 +2,7 @@
2
2
  * librdkafka - Apache Kafka C library
3
3
  *
4
4
  * Copyright (c) 2012-2022, Magnus Edenhill
5
+ * 2025, Confluent Inc.
5
6
  * All rights reserved.
6
7
  *
7
8
  * Redistribution and use in source and binary forms, with or without
@@ -91,10 +92,7 @@ static void rebalance_cb(rd_kafka_t *rk,
91
92
  rd_kafka_name(cons->rk), cons->rebalance_cnt,
92
93
  cons->max_rebalance_cnt);
93
94
 
94
- if (err == RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS)
95
- rd_kafka_assign(rk, parts);
96
- else
97
- rd_kafka_assign(rk, NULL);
95
+ test_rebalance_cb(rk, err, parts, opaque);
98
96
  }
99
97
 
100
98
 
@@ -110,12 +108,17 @@ int main_0093_holb_consumer(int argc, char **argv) {
110
108
 
111
109
  test_conf_init(&conf, NULL, 60);
112
110
 
113
- test_create_topic(NULL, topic, 1, 1);
111
+ test_create_topic_wait_exists(NULL, topic, 1, 1, 5000);
114
112
 
115
113
  test_produce_msgs_easy(topic, testid, 0, msgcnt);
116
114
 
117
115
  test_conf_set(conf, "session.timeout.ms", "6000");
118
116
  test_conf_set(conf, "max.poll.interval.ms", "20000");
117
+ /* Socket timeout must be greater than
118
+ * 10s: the interval during which group rebalance is hold
119
+ * when the first consumer isn't polling below.
120
+ * 10s corresponds to the duration of the JoinGroup call.
121
+ * on the second consumer. */
119
122
  test_conf_set(conf, "socket.timeout.ms", "3000");
120
123
  test_conf_set(conf, "auto.offset.reset", "earliest");
121
124
  /* Trigger other requests often */
@@ -169,6 +169,7 @@ static void do_test_produce_timeout(const char *topic, const int msgrate) {
169
169
  rk = test_create_handle(RD_KAFKA_PRODUCER, conf);
170
170
  rkt = test_create_producer_topic(rk, topic, "message.timeout.ms",
171
171
  "5000", NULL);
172
+ test_wait_topic_exists(rk, topic, 5000);
172
173
 
173
174
  /* Create the topic to make sure connections are up and ready. */
174
175
  err = test_auto_create_topic_rkt(rk, rkt, tmout_multip(5000));