@platformatic/rdkafka 4.0.0
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.
- package/.editorconfig +5 -0
- package/.jshintignore +1 -0
- package/.jshintrc +23 -0
- package/CONTRIBUTING.md +237 -0
- package/LICENSE.txt +21 -0
- package/Makefile +94 -0
- package/README.md +630 -0
- package/bench/consumer-raw-rdkafka.js +76 -0
- package/bench/consumer-subscribe.js +77 -0
- package/bench/kafka-consumer-stream.js +100 -0
- package/bench/producer-raw-rdkafka.js +125 -0
- package/bench/producer-rdkafka.js +117 -0
- package/bench/seed.sh +38 -0
- package/binding.gyp +155 -0
- package/ci/checks/librdkafka-correct-version.js +67 -0
- package/ci/checks/librdkafka-exists.js +13 -0
- package/ci/librdkafka-defs-generator.js +193 -0
- package/ci/prepublish.js +3 -0
- package/config.d.ts +1132 -0
- package/configure +15 -0
- package/cpplint.py +6325 -0
- package/deploy.enc +0 -0
- package/deps/librdkafka/.clang-format +136 -0
- package/deps/librdkafka/.clang-format-cpp +103 -0
- package/deps/librdkafka/.dir-locals.el +10 -0
- package/deps/librdkafka/.formatignore +33 -0
- package/deps/librdkafka/.gdbmacros +19 -0
- package/deps/librdkafka/.semaphore/project.yml +43 -0
- package/deps/librdkafka/.semaphore/project_public.yml +20 -0
- package/deps/librdkafka/.semaphore/semaphore.yml +355 -0
- package/deps/librdkafka/CHANGELOG.md +1738 -0
- package/deps/librdkafka/CMakeLists.txt +291 -0
- package/deps/librdkafka/CODE_OF_CONDUCT.md +46 -0
- package/deps/librdkafka/CONFIGURATION.md +189 -0
- package/deps/librdkafka/CONTRIBUTING.md +431 -0
- package/deps/librdkafka/Doxyfile +2375 -0
- package/deps/librdkafka/INTRODUCTION.md +2173 -0
- package/deps/librdkafka/LICENSE +26 -0
- package/deps/librdkafka/LICENSE.cjson +22 -0
- package/deps/librdkafka/LICENSE.crc32c +28 -0
- package/deps/librdkafka/LICENSE.fnv1a +18 -0
- package/deps/librdkafka/LICENSE.hdrhistogram +27 -0
- package/deps/librdkafka/LICENSE.lz4 +26 -0
- package/deps/librdkafka/LICENSE.murmur2 +25 -0
- package/deps/librdkafka/LICENSE.nanopb +22 -0
- package/deps/librdkafka/LICENSE.opentelemetry +203 -0
- package/deps/librdkafka/LICENSE.pycrc +23 -0
- package/deps/librdkafka/LICENSE.queue +31 -0
- package/deps/librdkafka/LICENSE.regexp +5 -0
- package/deps/librdkafka/LICENSE.snappy +36 -0
- package/deps/librdkafka/LICENSE.tinycthread +26 -0
- package/deps/librdkafka/LICENSE.wingetopt +49 -0
- package/deps/librdkafka/LICENSES.txt +625 -0
- package/deps/librdkafka/Makefile +124 -0
- package/deps/librdkafka/README.md +199 -0
- package/deps/librdkafka/README.win32 +26 -0
- package/deps/librdkafka/STATISTICS.md +624 -0
- package/deps/librdkafka/configure +214 -0
- package/deps/librdkafka/configure.self +331 -0
- package/deps/librdkafka/debian/changelog +111 -0
- package/deps/librdkafka/debian/compat +1 -0
- package/deps/librdkafka/debian/control +71 -0
- package/deps/librdkafka/debian/copyright +99 -0
- package/deps/librdkafka/debian/gbp.conf +9 -0
- package/deps/librdkafka/debian/librdkafka++1.install +1 -0
- package/deps/librdkafka/debian/librdkafka-dev.examples +2 -0
- package/deps/librdkafka/debian/librdkafka-dev.install +9 -0
- package/deps/librdkafka/debian/librdkafka1.docs +5 -0
- package/deps/librdkafka/debian/librdkafka1.install +1 -0
- package/deps/librdkafka/debian/librdkafka1.symbols +135 -0
- package/deps/librdkafka/debian/rules +19 -0
- package/deps/librdkafka/debian/source/format +1 -0
- package/deps/librdkafka/debian/watch +2 -0
- package/deps/librdkafka/dev-conf.sh +123 -0
- package/deps/librdkafka/examples/CMakeLists.txt +79 -0
- package/deps/librdkafka/examples/Makefile +167 -0
- package/deps/librdkafka/examples/README.md +42 -0
- package/deps/librdkafka/examples/alter_consumer_group_offsets.c +338 -0
- package/deps/librdkafka/examples/consumer.c +261 -0
- package/deps/librdkafka/examples/delete_records.c +233 -0
- package/deps/librdkafka/examples/describe_cluster.c +322 -0
- package/deps/librdkafka/examples/describe_consumer_groups.c +436 -0
- package/deps/librdkafka/examples/describe_topics.c +427 -0
- package/deps/librdkafka/examples/elect_leaders.c +317 -0
- package/deps/librdkafka/examples/globals.json +11 -0
- package/deps/librdkafka/examples/idempotent_producer.c +344 -0
- package/deps/librdkafka/examples/incremental_alter_configs.c +348 -0
- package/deps/librdkafka/examples/kafkatest_verifiable_client.cpp +961 -0
- package/deps/librdkafka/examples/list_consumer_group_offsets.c +359 -0
- package/deps/librdkafka/examples/list_consumer_groups.c +365 -0
- package/deps/librdkafka/examples/list_offsets.c +327 -0
- package/deps/librdkafka/examples/misc.c +287 -0
- package/deps/librdkafka/examples/openssl_engine_example.cpp +249 -0
- package/deps/librdkafka/examples/producer.c +251 -0
- package/deps/librdkafka/examples/producer.cpp +228 -0
- package/deps/librdkafka/examples/rdkafka_complex_consumer_example.c +617 -0
- package/deps/librdkafka/examples/rdkafka_complex_consumer_example.cpp +467 -0
- package/deps/librdkafka/examples/rdkafka_consume_batch.cpp +264 -0
- package/deps/librdkafka/examples/rdkafka_example.c +853 -0
- package/deps/librdkafka/examples/rdkafka_example.cpp +679 -0
- package/deps/librdkafka/examples/rdkafka_performance.c +1781 -0
- package/deps/librdkafka/examples/transactions-older-broker.c +668 -0
- package/deps/librdkafka/examples/transactions.c +665 -0
- package/deps/librdkafka/examples/user_scram.c +492 -0
- package/deps/librdkafka/examples/win_ssl_cert_store.cpp +395 -0
- package/deps/librdkafka/lds-gen.py +73 -0
- package/deps/librdkafka/mainpage.doxy +40 -0
- package/deps/librdkafka/mklove/Makefile.base +329 -0
- package/deps/librdkafka/mklove/modules/configure.atomics +144 -0
- package/deps/librdkafka/mklove/modules/configure.base +2484 -0
- package/deps/librdkafka/mklove/modules/configure.builtin +70 -0
- package/deps/librdkafka/mklove/modules/configure.cc +186 -0
- package/deps/librdkafka/mklove/modules/configure.cxx +8 -0
- package/deps/librdkafka/mklove/modules/configure.fileversion +65 -0
- package/deps/librdkafka/mklove/modules/configure.gitversion +29 -0
- package/deps/librdkafka/mklove/modules/configure.good_cflags +18 -0
- package/deps/librdkafka/mklove/modules/configure.host +132 -0
- package/deps/librdkafka/mklove/modules/configure.lib +49 -0
- package/deps/librdkafka/mklove/modules/configure.libcurl +99 -0
- package/deps/librdkafka/mklove/modules/configure.libsasl2 +36 -0
- package/deps/librdkafka/mklove/modules/configure.libssl +147 -0
- package/deps/librdkafka/mklove/modules/configure.libzstd +58 -0
- package/deps/librdkafka/mklove/modules/configure.parseversion +95 -0
- package/deps/librdkafka/mklove/modules/configure.pic +16 -0
- package/deps/librdkafka/mklove/modules/configure.socket +20 -0
- package/deps/librdkafka/mklove/modules/configure.zlib +61 -0
- package/deps/librdkafka/mklove/modules/patches/README.md +8 -0
- package/deps/librdkafka/mklove/modules/patches/libcurl.0000-no-runtime-linking-check.patch +11 -0
- package/deps/librdkafka/mklove/modules/patches/libssl.0000-osx-rand-include-fix-OpenSSL-PR16409.patch +56 -0
- package/deps/librdkafka/packaging/RELEASE.md +311 -0
- package/deps/librdkafka/packaging/alpine/build-alpine.sh +38 -0
- package/deps/librdkafka/packaging/archlinux/PKGBUILD +30 -0
- package/deps/librdkafka/packaging/cmake/Config.cmake.in +37 -0
- package/deps/librdkafka/packaging/cmake/Modules/FindLZ4.cmake +38 -0
- package/deps/librdkafka/packaging/cmake/Modules/FindZSTD.cmake +27 -0
- package/deps/librdkafka/packaging/cmake/Modules/LICENSE.FindZstd +178 -0
- package/deps/librdkafka/packaging/cmake/README.md +38 -0
- package/deps/librdkafka/packaging/cmake/config.h.in +52 -0
- package/deps/librdkafka/packaging/cmake/parseversion.cmake +60 -0
- package/deps/librdkafka/packaging/cmake/rdkafka.pc.in +12 -0
- package/deps/librdkafka/packaging/cmake/try_compile/atomic_32_test.c +8 -0
- package/deps/librdkafka/packaging/cmake/try_compile/atomic_64_test.c +8 -0
- package/deps/librdkafka/packaging/cmake/try_compile/c11threads_test.c +14 -0
- package/deps/librdkafka/packaging/cmake/try_compile/crc32c_hw_test.c +27 -0
- package/deps/librdkafka/packaging/cmake/try_compile/dlopen_test.c +11 -0
- package/deps/librdkafka/packaging/cmake/try_compile/libsasl2_test.c +7 -0
- package/deps/librdkafka/packaging/cmake/try_compile/pthread_setname_darwin_test.c +6 -0
- package/deps/librdkafka/packaging/cmake/try_compile/pthread_setname_freebsd_test.c +7 -0
- package/deps/librdkafka/packaging/cmake/try_compile/pthread_setname_gnu_test.c +5 -0
- package/deps/librdkafka/packaging/cmake/try_compile/rand_r_test.c +7 -0
- package/deps/librdkafka/packaging/cmake/try_compile/rdkafka_setup.cmake +122 -0
- package/deps/librdkafka/packaging/cmake/try_compile/regex_test.c +10 -0
- package/deps/librdkafka/packaging/cmake/try_compile/strndup_test.c +5 -0
- package/deps/librdkafka/packaging/cmake/try_compile/sync_32_test.c +8 -0
- package/deps/librdkafka/packaging/cmake/try_compile/sync_64_test.c +8 -0
- package/deps/librdkafka/packaging/cp/README.md +13 -0
- package/deps/librdkafka/packaging/cp/check_features.c +64 -0
- package/deps/librdkafka/packaging/cp/verify-deb.sh +33 -0
- package/deps/librdkafka/packaging/cp/verify-packages.sh +48 -0
- package/deps/librdkafka/packaging/cp/verify-rpm.sh +39 -0
- package/deps/librdkafka/packaging/debian/changelog +66 -0
- package/deps/librdkafka/packaging/debian/compat +1 -0
- package/deps/librdkafka/packaging/debian/control +49 -0
- package/deps/librdkafka/packaging/debian/copyright +84 -0
- package/deps/librdkafka/packaging/debian/gbp.conf +9 -0
- package/deps/librdkafka/packaging/debian/librdkafka-dev.dirs +2 -0
- package/deps/librdkafka/packaging/debian/librdkafka-dev.examples +2 -0
- package/deps/librdkafka/packaging/debian/librdkafka-dev.install +6 -0
- package/deps/librdkafka/packaging/debian/librdkafka-dev.substvars +1 -0
- package/deps/librdkafka/packaging/debian/librdkafka.dsc +16 -0
- package/deps/librdkafka/packaging/debian/librdkafka1-dbg.substvars +1 -0
- package/deps/librdkafka/packaging/debian/librdkafka1.dirs +1 -0
- package/deps/librdkafka/packaging/debian/librdkafka1.install +2 -0
- package/deps/librdkafka/packaging/debian/librdkafka1.postinst.debhelper +5 -0
- package/deps/librdkafka/packaging/debian/librdkafka1.postrm.debhelper +5 -0
- package/deps/librdkafka/packaging/debian/librdkafka1.symbols +64 -0
- package/deps/librdkafka/packaging/debian/rules +19 -0
- package/deps/librdkafka/packaging/debian/source/format +1 -0
- package/deps/librdkafka/packaging/debian/watch +2 -0
- package/deps/librdkafka/packaging/get_version.py +21 -0
- package/deps/librdkafka/packaging/homebrew/README.md +15 -0
- package/deps/librdkafka/packaging/homebrew/brew-update-pr.sh +31 -0
- package/deps/librdkafka/packaging/mingw-w64/configure-build-msys2-mingw-static.sh +52 -0
- package/deps/librdkafka/packaging/mingw-w64/configure-build-msys2-mingw.sh +21 -0
- package/deps/librdkafka/packaging/mingw-w64/run-tests.sh +6 -0
- package/deps/librdkafka/packaging/mingw-w64/semaphoreci-build.sh +38 -0
- package/deps/librdkafka/packaging/mingw-w64/travis-before-install.sh +20 -0
- package/deps/librdkafka/packaging/nuget/README.md +84 -0
- package/deps/librdkafka/packaging/nuget/artifact.py +177 -0
- package/deps/librdkafka/packaging/nuget/cleanup-s3.py +143 -0
- package/deps/librdkafka/packaging/nuget/common/p-common__plat-windows__arch-win32__bldtype-Release/msvcr120.zip +0 -0
- package/deps/librdkafka/packaging/nuget/common/p-common__plat-windows__arch-win32__bldtype-Release/msvcr140.zip +0 -0
- package/deps/librdkafka/packaging/nuget/common/p-common__plat-windows__arch-x64__bldtype-Release/msvcr120.zip +0 -0
- package/deps/librdkafka/packaging/nuget/common/p-common__plat-windows__arch-x64__bldtype-Release/msvcr140.zip +0 -0
- package/deps/librdkafka/packaging/nuget/nuget.sh +21 -0
- package/deps/librdkafka/packaging/nuget/nugetpackage.py +278 -0
- package/deps/librdkafka/packaging/nuget/packaging.py +448 -0
- package/deps/librdkafka/packaging/nuget/push-to-nuget.sh +21 -0
- package/deps/librdkafka/packaging/nuget/release.py +167 -0
- package/deps/librdkafka/packaging/nuget/requirements.txt +3 -0
- package/deps/librdkafka/packaging/nuget/staticpackage.py +178 -0
- package/deps/librdkafka/packaging/nuget/templates/librdkafka.redist.nuspec +21 -0
- package/deps/librdkafka/packaging/nuget/templates/librdkafka.redist.props +18 -0
- package/deps/librdkafka/packaging/nuget/templates/librdkafka.redist.targets +19 -0
- package/deps/librdkafka/packaging/nuget/zfile/__init__.py +0 -0
- package/deps/librdkafka/packaging/nuget/zfile/zfile.py +98 -0
- package/deps/librdkafka/packaging/rpm/Makefile +92 -0
- package/deps/librdkafka/packaging/rpm/README.md +23 -0
- package/deps/librdkafka/packaging/rpm/el7-x86_64.cfg +40 -0
- package/deps/librdkafka/packaging/rpm/librdkafka.spec +118 -0
- package/deps/librdkafka/packaging/rpm/mock-on-docker.sh +96 -0
- package/deps/librdkafka/packaging/rpm/tests/Makefile +25 -0
- package/deps/librdkafka/packaging/rpm/tests/README.md +8 -0
- package/deps/librdkafka/packaging/rpm/tests/run-test.sh +42 -0
- package/deps/librdkafka/packaging/rpm/tests/test-on-docker.sh +56 -0
- package/deps/librdkafka/packaging/rpm/tests/test.c +77 -0
- package/deps/librdkafka/packaging/rpm/tests/test.cpp +34 -0
- package/deps/librdkafka/packaging/tools/build-configurations-checks.sh +10 -0
- package/deps/librdkafka/packaging/tools/build-deb-package.sh +64 -0
- package/deps/librdkafka/packaging/tools/build-debian.sh +65 -0
- package/deps/librdkafka/packaging/tools/build-manylinux.sh +68 -0
- package/deps/librdkafka/packaging/tools/build-release-artifacts.sh +139 -0
- package/deps/librdkafka/packaging/tools/distro-build.sh +38 -0
- package/deps/librdkafka/packaging/tools/gh-release-checksums.py +39 -0
- package/deps/librdkafka/packaging/tools/rdutcoverage.sh +25 -0
- package/deps/librdkafka/packaging/tools/requirements.txt +2 -0
- package/deps/librdkafka/packaging/tools/style-format.sh +148 -0
- package/deps/librdkafka/service.yml +18 -0
- package/deps/librdkafka/src/CMakeLists.txt +374 -0
- package/deps/librdkafka/src/Makefile +103 -0
- package/deps/librdkafka/src/README.lz4.md +30 -0
- package/deps/librdkafka/src/cJSON.c +2834 -0
- package/deps/librdkafka/src/cJSON.h +398 -0
- package/deps/librdkafka/src/crc32c.c +430 -0
- package/deps/librdkafka/src/crc32c.h +38 -0
- package/deps/librdkafka/src/generate_proto.sh +66 -0
- package/deps/librdkafka/src/librdkafka_cgrp_synch.png +0 -0
- package/deps/librdkafka/src/lz4.c +2727 -0
- package/deps/librdkafka/src/lz4.h +842 -0
- package/deps/librdkafka/src/lz4frame.c +2078 -0
- package/deps/librdkafka/src/lz4frame.h +692 -0
- package/deps/librdkafka/src/lz4frame_static.h +47 -0
- package/deps/librdkafka/src/lz4hc.c +1631 -0
- package/deps/librdkafka/src/lz4hc.h +413 -0
- package/deps/librdkafka/src/nanopb/pb.h +917 -0
- package/deps/librdkafka/src/nanopb/pb_common.c +388 -0
- package/deps/librdkafka/src/nanopb/pb_common.h +49 -0
- package/deps/librdkafka/src/nanopb/pb_decode.c +1727 -0
- package/deps/librdkafka/src/nanopb/pb_decode.h +193 -0
- package/deps/librdkafka/src/nanopb/pb_encode.c +1000 -0
- package/deps/librdkafka/src/nanopb/pb_encode.h +185 -0
- package/deps/librdkafka/src/opentelemetry/common.pb.c +32 -0
- package/deps/librdkafka/src/opentelemetry/common.pb.h +170 -0
- package/deps/librdkafka/src/opentelemetry/metrics.options +2 -0
- package/deps/librdkafka/src/opentelemetry/metrics.pb.c +67 -0
- package/deps/librdkafka/src/opentelemetry/metrics.pb.h +966 -0
- package/deps/librdkafka/src/opentelemetry/resource.pb.c +12 -0
- package/deps/librdkafka/src/opentelemetry/resource.pb.h +58 -0
- package/deps/librdkafka/src/queue.h +850 -0
- package/deps/librdkafka/src/rd.h +441 -0
- package/deps/librdkafka/src/rdaddr.c +255 -0
- package/deps/librdkafka/src/rdaddr.h +203 -0
- package/deps/librdkafka/src/rdatomic.h +226 -0
- package/deps/librdkafka/src/rdavg.h +259 -0
- package/deps/librdkafka/src/rdavl.c +210 -0
- package/deps/librdkafka/src/rdavl.h +250 -0
- package/deps/librdkafka/src/rdbase64.c +169 -0
- package/deps/librdkafka/src/rdbase64.h +41 -0
- package/deps/librdkafka/src/rdbuf.c +1884 -0
- package/deps/librdkafka/src/rdbuf.h +375 -0
- package/deps/librdkafka/src/rdcrc32.c +114 -0
- package/deps/librdkafka/src/rdcrc32.h +170 -0
- package/deps/librdkafka/src/rddl.c +179 -0
- package/deps/librdkafka/src/rddl.h +43 -0
- package/deps/librdkafka/src/rdendian.h +174 -0
- package/deps/librdkafka/src/rdfloat.h +67 -0
- package/deps/librdkafka/src/rdfnv1a.c +113 -0
- package/deps/librdkafka/src/rdfnv1a.h +35 -0
- package/deps/librdkafka/src/rdgz.c +120 -0
- package/deps/librdkafka/src/rdgz.h +46 -0
- package/deps/librdkafka/src/rdhdrhistogram.c +721 -0
- package/deps/librdkafka/src/rdhdrhistogram.h +87 -0
- package/deps/librdkafka/src/rdhttp.c +512 -0
- package/deps/librdkafka/src/rdhttp.h +83 -0
- package/deps/librdkafka/src/rdinterval.h +177 -0
- package/deps/librdkafka/src/rdkafka.c +5351 -0
- package/deps/librdkafka/src/rdkafka.h +10603 -0
- package/deps/librdkafka/src/rdkafka_admin.c +9417 -0
- package/deps/librdkafka/src/rdkafka_admin.h +619 -0
- package/deps/librdkafka/src/rdkafka_assignment.c +1010 -0
- package/deps/librdkafka/src/rdkafka_assignment.h +73 -0
- package/deps/librdkafka/src/rdkafka_assignor.c +1786 -0
- package/deps/librdkafka/src/rdkafka_assignor.h +402 -0
- package/deps/librdkafka/src/rdkafka_aux.c +409 -0
- package/deps/librdkafka/src/rdkafka_aux.h +174 -0
- package/deps/librdkafka/src/rdkafka_background.c +221 -0
- package/deps/librdkafka/src/rdkafka_broker.c +6186 -0
- package/deps/librdkafka/src/rdkafka_broker.h +686 -0
- package/deps/librdkafka/src/rdkafka_buf.c +540 -0
- package/deps/librdkafka/src/rdkafka_buf.h +1524 -0
- package/deps/librdkafka/src/rdkafka_cert.c +552 -0
- package/deps/librdkafka/src/rdkafka_cert.h +61 -0
- package/deps/librdkafka/src/rdkafka_cgrp.c +7262 -0
- package/deps/librdkafka/src/rdkafka_cgrp.h +443 -0
- package/deps/librdkafka/src/rdkafka_conf.c +4456 -0
- package/deps/librdkafka/src/rdkafka_conf.h +668 -0
- package/deps/librdkafka/src/rdkafka_confval.h +97 -0
- package/deps/librdkafka/src/rdkafka_coord.c +623 -0
- package/deps/librdkafka/src/rdkafka_coord.h +132 -0
- package/deps/librdkafka/src/rdkafka_error.c +228 -0
- package/deps/librdkafka/src/rdkafka_error.h +80 -0
- package/deps/librdkafka/src/rdkafka_event.c +502 -0
- package/deps/librdkafka/src/rdkafka_event.h +126 -0
- package/deps/librdkafka/src/rdkafka_feature.c +461 -0
- package/deps/librdkafka/src/rdkafka_feature.h +102 -0
- package/deps/librdkafka/src/rdkafka_fetcher.c +1402 -0
- package/deps/librdkafka/src/rdkafka_fetcher.h +44 -0
- package/deps/librdkafka/src/rdkafka_header.c +220 -0
- package/deps/librdkafka/src/rdkafka_header.h +76 -0
- package/deps/librdkafka/src/rdkafka_idempotence.c +807 -0
- package/deps/librdkafka/src/rdkafka_idempotence.h +144 -0
- package/deps/librdkafka/src/rdkafka_int.h +1222 -0
- package/deps/librdkafka/src/rdkafka_interceptor.c +819 -0
- package/deps/librdkafka/src/rdkafka_interceptor.h +104 -0
- package/deps/librdkafka/src/rdkafka_lz4.c +450 -0
- package/deps/librdkafka/src/rdkafka_lz4.h +49 -0
- package/deps/librdkafka/src/rdkafka_metadata.c +2124 -0
- package/deps/librdkafka/src/rdkafka_metadata.h +341 -0
- package/deps/librdkafka/src/rdkafka_metadata_cache.c +977 -0
- package/deps/librdkafka/src/rdkafka_mock.c +2885 -0
- package/deps/librdkafka/src/rdkafka_mock.h +491 -0
- package/deps/librdkafka/src/rdkafka_mock_cgrp.c +710 -0
- package/deps/librdkafka/src/rdkafka_mock_handlers.c +2817 -0
- package/deps/librdkafka/src/rdkafka_mock_int.h +591 -0
- package/deps/librdkafka/src/rdkafka_msg.c +2573 -0
- package/deps/librdkafka/src/rdkafka_msg.h +614 -0
- package/deps/librdkafka/src/rdkafka_msgbatch.h +62 -0
- package/deps/librdkafka/src/rdkafka_msgset.h +98 -0
- package/deps/librdkafka/src/rdkafka_msgset_reader.c +1806 -0
- package/deps/librdkafka/src/rdkafka_msgset_writer.c +1470 -0
- package/deps/librdkafka/src/rdkafka_offset.c +1537 -0
- package/deps/librdkafka/src/rdkafka_offset.h +150 -0
- package/deps/librdkafka/src/rdkafka_op.c +997 -0
- package/deps/librdkafka/src/rdkafka_op.h +834 -0
- package/deps/librdkafka/src/rdkafka_partition.c +4801 -0
- package/deps/librdkafka/src/rdkafka_partition.h +1173 -0
- package/deps/librdkafka/src/rdkafka_pattern.c +228 -0
- package/deps/librdkafka/src/rdkafka_pattern.h +70 -0
- package/deps/librdkafka/src/rdkafka_plugin.c +213 -0
- package/deps/librdkafka/src/rdkafka_plugin.h +41 -0
- package/deps/librdkafka/src/rdkafka_proto.h +733 -0
- package/deps/librdkafka/src/rdkafka_protocol.h +127 -0
- package/deps/librdkafka/src/rdkafka_queue.c +1153 -0
- package/deps/librdkafka/src/rdkafka_queue.h +1201 -0
- package/deps/librdkafka/src/rdkafka_range_assignor.c +1748 -0
- package/deps/librdkafka/src/rdkafka_request.c +6817 -0
- package/deps/librdkafka/src/rdkafka_request.h +709 -0
- package/deps/librdkafka/src/rdkafka_roundrobin_assignor.c +123 -0
- package/deps/librdkafka/src/rdkafka_sasl.c +528 -0
- package/deps/librdkafka/src/rdkafka_sasl.h +63 -0
- package/deps/librdkafka/src/rdkafka_sasl_cyrus.c +722 -0
- package/deps/librdkafka/src/rdkafka_sasl_int.h +89 -0
- package/deps/librdkafka/src/rdkafka_sasl_oauthbearer.c +1829 -0
- package/deps/librdkafka/src/rdkafka_sasl_oauthbearer.h +52 -0
- package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.c +589 -0
- package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.h +37 -0
- package/deps/librdkafka/src/rdkafka_sasl_plain.c +142 -0
- package/deps/librdkafka/src/rdkafka_sasl_scram.c +857 -0
- package/deps/librdkafka/src/rdkafka_sasl_win32.c +550 -0
- package/deps/librdkafka/src/rdkafka_ssl.c +1904 -0
- package/deps/librdkafka/src/rdkafka_ssl.h +64 -0
- package/deps/librdkafka/src/rdkafka_sticky_assignor.c +4781 -0
- package/deps/librdkafka/src/rdkafka_subscription.c +278 -0
- package/deps/librdkafka/src/rdkafka_telemetry.c +703 -0
- package/deps/librdkafka/src/rdkafka_telemetry.h +52 -0
- package/deps/librdkafka/src/rdkafka_telemetry_decode.c +1053 -0
- package/deps/librdkafka/src/rdkafka_telemetry_decode.h +59 -0
- package/deps/librdkafka/src/rdkafka_telemetry_encode.c +993 -0
- package/deps/librdkafka/src/rdkafka_telemetry_encode.h +301 -0
- package/deps/librdkafka/src/rdkafka_timer.c +402 -0
- package/deps/librdkafka/src/rdkafka_timer.h +117 -0
- package/deps/librdkafka/src/rdkafka_topic.c +2078 -0
- package/deps/librdkafka/src/rdkafka_topic.h +328 -0
- package/deps/librdkafka/src/rdkafka_transport.c +1297 -0
- package/deps/librdkafka/src/rdkafka_transport.h +94 -0
- package/deps/librdkafka/src/rdkafka_transport_int.h +100 -0
- package/deps/librdkafka/src/rdkafka_txnmgr.c +3251 -0
- package/deps/librdkafka/src/rdkafka_txnmgr.h +171 -0
- package/deps/librdkafka/src/rdkafka_zstd.c +226 -0
- package/deps/librdkafka/src/rdkafka_zstd.h +57 -0
- package/deps/librdkafka/src/rdlist.c +576 -0
- package/deps/librdkafka/src/rdlist.h +434 -0
- package/deps/librdkafka/src/rdlog.c +89 -0
- package/deps/librdkafka/src/rdlog.h +41 -0
- package/deps/librdkafka/src/rdmap.c +503 -0
- package/deps/librdkafka/src/rdmap.h +492 -0
- package/deps/librdkafka/src/rdmurmur2.c +167 -0
- package/deps/librdkafka/src/rdmurmur2.h +35 -0
- package/deps/librdkafka/src/rdports.c +61 -0
- package/deps/librdkafka/src/rdports.h +38 -0
- package/deps/librdkafka/src/rdposix.h +250 -0
- package/deps/librdkafka/src/rdrand.c +70 -0
- package/deps/librdkafka/src/rdrand.h +43 -0
- package/deps/librdkafka/src/rdregex.c +156 -0
- package/deps/librdkafka/src/rdregex.h +43 -0
- package/deps/librdkafka/src/rdsignal.h +57 -0
- package/deps/librdkafka/src/rdstring.c +645 -0
- package/deps/librdkafka/src/rdstring.h +98 -0
- package/deps/librdkafka/src/rdsysqueue.h +404 -0
- package/deps/librdkafka/src/rdtime.h +325 -0
- package/deps/librdkafka/src/rdtypes.h +86 -0
- package/deps/librdkafka/src/rdunittest.c +532 -0
- package/deps/librdkafka/src/rdunittest.h +230 -0
- package/deps/librdkafka/src/rdvarint.c +134 -0
- package/deps/librdkafka/src/rdvarint.h +165 -0
- package/deps/librdkafka/src/rdwin32.h +382 -0
- package/deps/librdkafka/src/rdxxhash.c +1030 -0
- package/deps/librdkafka/src/rdxxhash.h +328 -0
- package/deps/librdkafka/src/regexp.c +1347 -0
- package/deps/librdkafka/src/regexp.h +41 -0
- package/deps/librdkafka/src/snappy.c +1866 -0
- package/deps/librdkafka/src/snappy.h +62 -0
- package/deps/librdkafka/src/snappy_compat.h +138 -0
- package/deps/librdkafka/src/statistics_schema.json +444 -0
- package/deps/librdkafka/src/tinycthread.c +932 -0
- package/deps/librdkafka/src/tinycthread.h +503 -0
- package/deps/librdkafka/src/tinycthread_extra.c +175 -0
- package/deps/librdkafka/src/tinycthread_extra.h +208 -0
- package/deps/librdkafka/src/win32_config.h +58 -0
- package/deps/librdkafka/src-cpp/CMakeLists.txt +90 -0
- package/deps/librdkafka/src-cpp/ConfImpl.cpp +84 -0
- package/deps/librdkafka/src-cpp/ConsumerImpl.cpp +244 -0
- package/deps/librdkafka/src-cpp/HandleImpl.cpp +436 -0
- package/deps/librdkafka/src-cpp/HeadersImpl.cpp +48 -0
- package/deps/librdkafka/src-cpp/KafkaConsumerImpl.cpp +296 -0
- package/deps/librdkafka/src-cpp/Makefile +55 -0
- package/deps/librdkafka/src-cpp/MessageImpl.cpp +38 -0
- package/deps/librdkafka/src-cpp/MetadataImpl.cpp +170 -0
- package/deps/librdkafka/src-cpp/ProducerImpl.cpp +197 -0
- package/deps/librdkafka/src-cpp/QueueImpl.cpp +70 -0
- package/deps/librdkafka/src-cpp/README.md +16 -0
- package/deps/librdkafka/src-cpp/RdKafka.cpp +59 -0
- package/deps/librdkafka/src-cpp/TopicImpl.cpp +124 -0
- package/deps/librdkafka/src-cpp/TopicPartitionImpl.cpp +57 -0
- package/deps/librdkafka/src-cpp/rdkafkacpp.h +3771 -0
- package/deps/librdkafka/src-cpp/rdkafkacpp_int.h +1641 -0
- package/deps/librdkafka/tests/0000-unittests.c +72 -0
- package/deps/librdkafka/tests/0001-multiobj.c +98 -0
- package/deps/librdkafka/tests/0002-unkpart.c +244 -0
- package/deps/librdkafka/tests/0003-msgmaxsize.c +173 -0
- package/deps/librdkafka/tests/0004-conf.c +867 -0
- package/deps/librdkafka/tests/0005-order.c +133 -0
- package/deps/librdkafka/tests/0006-symbols.c +163 -0
- package/deps/librdkafka/tests/0007-autotopic.c +136 -0
- package/deps/librdkafka/tests/0008-reqacks.c +179 -0
- package/deps/librdkafka/tests/0009-mock_cluster.c +96 -0
- package/deps/librdkafka/tests/0011-produce_batch.c +752 -0
- package/deps/librdkafka/tests/0012-produce_consume.c +537 -0
- package/deps/librdkafka/tests/0013-null-msgs.c +473 -0
- package/deps/librdkafka/tests/0014-reconsume-191.c +512 -0
- package/deps/librdkafka/tests/0015-offset_seeks.c +172 -0
- package/deps/librdkafka/tests/0016-client_swname.c +166 -0
- package/deps/librdkafka/tests/0017-compression.c +142 -0
- package/deps/librdkafka/tests/0018-cgrp_term.c +333 -0
- package/deps/librdkafka/tests/0019-list_groups.c +289 -0
- package/deps/librdkafka/tests/0020-destroy_hang.c +162 -0
- package/deps/librdkafka/tests/0021-rkt_destroy.c +71 -0
- package/deps/librdkafka/tests/0022-consume_batch.c +276 -0
- package/deps/librdkafka/tests/0025-timers.c +147 -0
- package/deps/librdkafka/tests/0026-consume_pause.c +549 -0
- package/deps/librdkafka/tests/0028-long_topicnames.c +79 -0
- package/deps/librdkafka/tests/0029-assign_offset.c +204 -0
- package/deps/librdkafka/tests/0030-offset_commit.c +589 -0
- package/deps/librdkafka/tests/0031-get_offsets.c +235 -0
- package/deps/librdkafka/tests/0033-regex_subscribe.c +520 -0
- package/deps/librdkafka/tests/0034-offset_reset.c +377 -0
- package/deps/librdkafka/tests/0035-api_version.c +73 -0
- package/deps/librdkafka/tests/0036-partial_fetch.c +86 -0
- package/deps/librdkafka/tests/0037-destroy_hang_local.c +85 -0
- package/deps/librdkafka/tests/0038-performance.c +120 -0
- package/deps/librdkafka/tests/0039-event.c +284 -0
- package/deps/librdkafka/tests/0040-io_event.c +251 -0
- package/deps/librdkafka/tests/0041-fetch_max_bytes.c +96 -0
- package/deps/librdkafka/tests/0042-many_topics.c +252 -0
- package/deps/librdkafka/tests/0043-no_connection.c +77 -0
- package/deps/librdkafka/tests/0044-partition_cnt.c +93 -0
- package/deps/librdkafka/tests/0045-subscribe_update.c +746 -0
- package/deps/librdkafka/tests/0046-rkt_cache.c +65 -0
- package/deps/librdkafka/tests/0047-partial_buf_tmout.c +97 -0
- package/deps/librdkafka/tests/0048-partitioner.c +283 -0
- package/deps/librdkafka/tests/0049-consume_conn_close.c +162 -0
- package/deps/librdkafka/tests/0050-subscribe_adds.c +144 -0
- package/deps/librdkafka/tests/0051-assign_adds.c +125 -0
- package/deps/librdkafka/tests/0052-msg_timestamps.c +220 -0
- package/deps/librdkafka/tests/0053-stats_cb.cpp +535 -0
- package/deps/librdkafka/tests/0054-offset_time.cpp +236 -0
- package/deps/librdkafka/tests/0055-producer_latency.c +366 -0
- package/deps/librdkafka/tests/0056-balanced_group_mt.c +311 -0
- package/deps/librdkafka/tests/0057-invalid_topic.cpp +112 -0
- package/deps/librdkafka/tests/0058-log.cpp +123 -0
- package/deps/librdkafka/tests/0059-bsearch.cpp +237 -0
- package/deps/librdkafka/tests/0060-op_prio.cpp +163 -0
- package/deps/librdkafka/tests/0061-consumer_lag.cpp +275 -0
- package/deps/librdkafka/tests/0062-stats_event.c +126 -0
- package/deps/librdkafka/tests/0063-clusterid.cpp +180 -0
- package/deps/librdkafka/tests/0064-interceptors.c +481 -0
- package/deps/librdkafka/tests/0065-yield.cpp +140 -0
- package/deps/librdkafka/tests/0066-plugins.cpp +129 -0
- package/deps/librdkafka/tests/0067-empty_topic.cpp +148 -0
- package/deps/librdkafka/tests/0068-produce_timeout.c +138 -0
- package/deps/librdkafka/tests/0069-consumer_add_parts.c +123 -0
- package/deps/librdkafka/tests/0070-null_empty.cpp +197 -0
- package/deps/librdkafka/tests/0072-headers_ut.c +448 -0
- package/deps/librdkafka/tests/0073-headers.c +381 -0
- package/deps/librdkafka/tests/0074-producev.c +87 -0
- package/deps/librdkafka/tests/0075-retry.c +253 -0
- package/deps/librdkafka/tests/0076-produce_retry.c +450 -0
- package/deps/librdkafka/tests/0077-compaction.c +357 -0
- package/deps/librdkafka/tests/0078-c_from_cpp.cpp +96 -0
- package/deps/librdkafka/tests/0079-fork.c +93 -0
- package/deps/librdkafka/tests/0080-admin_ut.c +3065 -0
- package/deps/librdkafka/tests/0081-admin.c +5333 -0
- package/deps/librdkafka/tests/0082-fetch_max_bytes.cpp +133 -0
- package/deps/librdkafka/tests/0083-cb_event.c +228 -0
- package/deps/librdkafka/tests/0084-destroy_flags.c +212 -0
- package/deps/librdkafka/tests/0085-headers.cpp +388 -0
- package/deps/librdkafka/tests/0086-purge.c +335 -0
- package/deps/librdkafka/tests/0088-produce_metadata_timeout.c +162 -0
- package/deps/librdkafka/tests/0089-max_poll_interval.c +506 -0
- package/deps/librdkafka/tests/0090-idempotence.c +172 -0
- package/deps/librdkafka/tests/0091-max_poll_interval_timeout.c +297 -0
- package/deps/librdkafka/tests/0092-mixed_msgver.c +97 -0
- package/deps/librdkafka/tests/0093-holb.c +197 -0
- package/deps/librdkafka/tests/0094-idempotence_msg_timeout.c +230 -0
- package/deps/librdkafka/tests/0095-all_brokers_down.cpp +122 -0
- package/deps/librdkafka/tests/0097-ssl_verify.cpp +466 -0
- package/deps/librdkafka/tests/0098-consumer-txn.cpp +1218 -0
- package/deps/librdkafka/tests/0099-commit_metadata.c +194 -0
- package/deps/librdkafka/tests/0100-thread_interceptors.cpp +195 -0
- package/deps/librdkafka/tests/0101-fetch-from-follower.cpp +446 -0
- package/deps/librdkafka/tests/0102-static_group_rebalance.c +535 -0
- package/deps/librdkafka/tests/0103-transactions.c +1383 -0
- package/deps/librdkafka/tests/0104-fetch_from_follower_mock.c +624 -0
- package/deps/librdkafka/tests/0105-transactions_mock.c +3923 -0
- package/deps/librdkafka/tests/0106-cgrp_sess_timeout.c +297 -0
- package/deps/librdkafka/tests/0107-topic_recreate.c +259 -0
- package/deps/librdkafka/tests/0109-auto_create_topics.cpp +218 -0
- package/deps/librdkafka/tests/0110-batch_size.cpp +183 -0
- package/deps/librdkafka/tests/0111-delay_create_topics.cpp +127 -0
- package/deps/librdkafka/tests/0112-assign_unknown_part.c +98 -0
- package/deps/librdkafka/tests/0113-cooperative_rebalance.cpp +3329 -0
- package/deps/librdkafka/tests/0114-sticky_partitioning.cpp +176 -0
- package/deps/librdkafka/tests/0115-producer_auth.cpp +179 -0
- package/deps/librdkafka/tests/0116-kafkaconsumer_close.cpp +214 -0
- package/deps/librdkafka/tests/0117-mock_errors.c +321 -0
- package/deps/librdkafka/tests/0118-commit_rebalance.c +121 -0
- package/deps/librdkafka/tests/0119-consumer_auth.cpp +148 -0
- package/deps/librdkafka/tests/0120-asymmetric_subscription.c +180 -0
- package/deps/librdkafka/tests/0121-clusterid.c +115 -0
- package/deps/librdkafka/tests/0122-buffer_cleaning_after_rebalance.c +227 -0
- package/deps/librdkafka/tests/0123-connections_max_idle.c +98 -0
- package/deps/librdkafka/tests/0124-openssl_invalid_engine.c +69 -0
- package/deps/librdkafka/tests/0125-immediate_flush.c +144 -0
- package/deps/librdkafka/tests/0126-oauthbearer_oidc.c +213 -0
- package/deps/librdkafka/tests/0127-fetch_queue_backoff.cpp +165 -0
- package/deps/librdkafka/tests/0128-sasl_callback_queue.cpp +125 -0
- package/deps/librdkafka/tests/0129-fetch_aborted_msgs.c +78 -0
- package/deps/librdkafka/tests/0130-store_offsets.c +178 -0
- package/deps/librdkafka/tests/0131-connect_timeout.c +81 -0
- package/deps/librdkafka/tests/0132-strategy_ordering.c +171 -0
- package/deps/librdkafka/tests/0133-ssl_keys.c +128 -0
- package/deps/librdkafka/tests/0134-ssl_provider.c +92 -0
- package/deps/librdkafka/tests/0135-sasl_credentials.cpp +143 -0
- package/deps/librdkafka/tests/0136-resolve_cb.c +181 -0
- package/deps/librdkafka/tests/0137-barrier_batch_consume.c +609 -0
- package/deps/librdkafka/tests/0138-admin_mock.c +281 -0
- package/deps/librdkafka/tests/0139-offset_validation_mock.c +442 -0
- package/deps/librdkafka/tests/0140-commit_metadata.cpp +108 -0
- package/deps/librdkafka/tests/0142-reauthentication.c +495 -0
- package/deps/librdkafka/tests/0143-exponential_backoff_mock.c +553 -0
- package/deps/librdkafka/tests/0144-idempotence_mock.c +373 -0
- package/deps/librdkafka/tests/0145-pause_resume_mock.c +119 -0
- package/deps/librdkafka/tests/0146-metadata_mock.c +444 -0
- package/deps/librdkafka/tests/0150-telemetry_mock.c +648 -0
- package/deps/librdkafka/tests/1000-unktopic.c +164 -0
- package/deps/librdkafka/tests/8000-idle.cpp +60 -0
- package/deps/librdkafka/tests/8001-fetch_from_follower_mock_manual.c +113 -0
- package/deps/librdkafka/tests/CMakeLists.txt +164 -0
- package/deps/librdkafka/tests/LibrdkafkaTestApp.py +266 -0
- package/deps/librdkafka/tests/Makefile +182 -0
- package/deps/librdkafka/tests/README.md +509 -0
- package/deps/librdkafka/tests/autotest.sh +33 -0
- package/deps/librdkafka/tests/backtrace.gdb +30 -0
- package/deps/librdkafka/tests/broker_version_tests.py +315 -0
- package/deps/librdkafka/tests/buildbox.sh +17 -0
- package/deps/librdkafka/tests/cleanup-checker-tests.sh +20 -0
- package/deps/librdkafka/tests/cluster_testing.py +191 -0
- package/deps/librdkafka/tests/delete-test-topics.sh +56 -0
- package/deps/librdkafka/tests/fixtures/ssl/Makefile +8 -0
- package/deps/librdkafka/tests/fixtures/ssl/README.md +13 -0
- package/deps/librdkafka/tests/fixtures/ssl/client.keystore.p12 +0 -0
- package/deps/librdkafka/tests/fixtures/ssl/client2.certificate.pem +109 -0
- package/deps/librdkafka/tests/fixtures/ssl/client2.key +34 -0
- package/deps/librdkafka/tests/fixtures/ssl/create_keys.sh +93 -0
- package/deps/librdkafka/tests/fuzzers/Makefile +12 -0
- package/deps/librdkafka/tests/fuzzers/README.md +31 -0
- package/deps/librdkafka/tests/fuzzers/fuzz_regex.c +74 -0
- package/deps/librdkafka/tests/fuzzers/helpers.h +90 -0
- package/deps/librdkafka/tests/gen-ssl-certs.sh +165 -0
- package/deps/librdkafka/tests/interactive_broker_version.py +170 -0
- package/deps/librdkafka/tests/interceptor_test/CMakeLists.txt +16 -0
- package/deps/librdkafka/tests/interceptor_test/Makefile +22 -0
- package/deps/librdkafka/tests/interceptor_test/interceptor_test.c +314 -0
- package/deps/librdkafka/tests/interceptor_test/interceptor_test.h +54 -0
- package/deps/librdkafka/tests/java/IncrementalRebalanceCli.java +97 -0
- package/deps/librdkafka/tests/java/Makefile +12 -0
- package/deps/librdkafka/tests/java/Murmur2Cli.java +46 -0
- package/deps/librdkafka/tests/java/README.md +14 -0
- package/deps/librdkafka/tests/java/TransactionProducerCli.java +162 -0
- package/deps/librdkafka/tests/java/run-class.sh +11 -0
- package/deps/librdkafka/tests/librdkafka.suppressions +483 -0
- package/deps/librdkafka/tests/lz4_manual_test.sh +59 -0
- package/deps/librdkafka/tests/multi-broker-version-test.sh +50 -0
- package/deps/librdkafka/tests/parse-refcnt.sh +43 -0
- package/deps/librdkafka/tests/performance_plot.py +115 -0
- package/deps/librdkafka/tests/plugin_test/Makefile +19 -0
- package/deps/librdkafka/tests/plugin_test/plugin_test.c +58 -0
- package/deps/librdkafka/tests/requirements.txt +2 -0
- package/deps/librdkafka/tests/run-consumer-tests.sh +16 -0
- package/deps/librdkafka/tests/run-producer-tests.sh +16 -0
- package/deps/librdkafka/tests/run-test.sh +140 -0
- package/deps/librdkafka/tests/rusage.c +249 -0
- package/deps/librdkafka/tests/sasl_test.py +289 -0
- package/deps/librdkafka/tests/scenarios/README.md +6 -0
- package/deps/librdkafka/tests/scenarios/ak23.json +6 -0
- package/deps/librdkafka/tests/scenarios/default.json +5 -0
- package/deps/librdkafka/tests/scenarios/noautocreate.json +5 -0
- package/deps/librdkafka/tests/sockem.c +801 -0
- package/deps/librdkafka/tests/sockem.h +85 -0
- package/deps/librdkafka/tests/sockem_ctrl.c +145 -0
- package/deps/librdkafka/tests/sockem_ctrl.h +61 -0
- package/deps/librdkafka/tests/test.c +7318 -0
- package/deps/librdkafka/tests/test.conf.example +27 -0
- package/deps/librdkafka/tests/test.h +979 -0
- package/deps/librdkafka/tests/testcpp.cpp +126 -0
- package/deps/librdkafka/tests/testcpp.h +360 -0
- package/deps/librdkafka/tests/testshared.h +402 -0
- package/deps/librdkafka/tests/tools/README.md +4 -0
- package/deps/librdkafka/tests/tools/stats/README.md +21 -0
- package/deps/librdkafka/tests/tools/stats/filter.jq +42 -0
- package/deps/librdkafka/tests/tools/stats/graph.py +150 -0
- package/deps/librdkafka/tests/tools/stats/requirements.txt +3 -0
- package/deps/librdkafka/tests/tools/stats/to_csv.py +124 -0
- package/deps/librdkafka/tests/until-fail.sh +87 -0
- package/deps/librdkafka/tests/xxxx-assign_partition.c +122 -0
- package/deps/librdkafka/tests/xxxx-metadata.cpp +159 -0
- package/deps/librdkafka/vcpkg.json +23 -0
- package/deps/librdkafka/win32/README.md +5 -0
- package/deps/librdkafka/win32/build-package.bat +3 -0
- package/deps/librdkafka/win32/build.bat +19 -0
- package/deps/librdkafka/win32/common.vcxproj +84 -0
- package/deps/librdkafka/win32/install-openssl.ps1 +33 -0
- package/deps/librdkafka/win32/interceptor_test/interceptor_test.vcxproj +87 -0
- package/deps/librdkafka/win32/librdkafka.autopkg.template +54 -0
- package/deps/librdkafka/win32/librdkafka.master.testing.targets +13 -0
- package/deps/librdkafka/win32/librdkafka.sln +226 -0
- package/deps/librdkafka/win32/librdkafka.vcxproj +276 -0
- package/deps/librdkafka/win32/librdkafkacpp/librdkafkacpp.vcxproj +104 -0
- package/deps/librdkafka/win32/msbuild.ps1 +15 -0
- package/deps/librdkafka/win32/openssl_engine_example/openssl_engine_example.vcxproj +132 -0
- package/deps/librdkafka/win32/package-zip.ps1 +46 -0
- package/deps/librdkafka/win32/packages/repositories.config +4 -0
- package/deps/librdkafka/win32/push-package.bat +4 -0
- package/deps/librdkafka/win32/rdkafka_complex_consumer_example_cpp/rdkafka_complex_consumer_example_cpp.vcxproj +67 -0
- package/deps/librdkafka/win32/rdkafka_example/rdkafka_example.vcxproj +97 -0
- package/deps/librdkafka/win32/rdkafka_performance/rdkafka_performance.vcxproj +97 -0
- package/deps/librdkafka/win32/setup-msys2.ps1 +31 -0
- package/deps/librdkafka/win32/setup-vcpkg.ps1 +12 -0
- package/deps/librdkafka/win32/tests/test.conf.example +25 -0
- package/deps/librdkafka/win32/tests/tests.vcxproj +247 -0
- package/deps/librdkafka/win32/win_ssl_cert_store/win_ssl_cert_store.vcxproj +132 -0
- package/deps/librdkafka/win32/wingetopt.c +564 -0
- package/deps/librdkafka/win32/wingetopt.h +100 -0
- package/deps/librdkafka/win32/wintime.h +33 -0
- package/deps/librdkafka.gyp +62 -0
- package/deps/windows-install.py +73 -0
- package/docker-compose.yml +23 -0
- package/e2e/admin.spec.js +187 -0
- package/e2e/both.spec.js +726 -0
- package/e2e/consumer.spec.js +386 -0
- package/e2e/groups.spec.js +132 -0
- package/e2e/listener.js +51 -0
- package/e2e/producer-transaction.spec.js +333 -0
- package/e2e/producer.spec.js +283 -0
- package/errors.d.ts +347 -0
- package/examples/consumer-flow.md +76 -0
- package/examples/consumer.md +45 -0
- package/examples/docker-alpine.md +30 -0
- package/examples/high-level-producer.md +32 -0
- package/examples/metadata.md +27 -0
- package/examples/oauthbearer-default-flow.md +80 -0
- package/examples/producer-cluster.md +103 -0
- package/examples/producer.md +73 -0
- package/index.d.ts +357 -0
- package/lib/admin.js +233 -0
- package/lib/client.js +578 -0
- package/lib/error.js +472 -0
- package/lib/index.js +34 -0
- package/lib/kafka-consumer-stream.js +397 -0
- package/lib/kafka-consumer.js +698 -0
- package/lib/producer/high-level-producer.js +323 -0
- package/lib/producer-stream.js +307 -0
- package/lib/producer.js +375 -0
- package/lib/tools/ref-counter.js +52 -0
- package/lib/topic-partition.js +88 -0
- package/lib/topic.js +42 -0
- package/lib/util.js +29 -0
- package/librdkafka.js +12 -0
- package/make_docs.sh +59 -0
- package/package.json +53 -0
- package/renovate.json +30 -0
- package/run_docker.sh +42 -0
- package/src/admin.cc +624 -0
- package/src/admin.h +78 -0
- package/src/binding.cc +73 -0
- package/src/binding.h +25 -0
- package/src/callbacks.cc +614 -0
- package/src/callbacks.h +265 -0
- package/src/common.cc +582 -0
- package/src/common.h +134 -0
- package/src/config.cc +167 -0
- package/src/config.h +45 -0
- package/src/connection.cc +482 -0
- package/src/connection.h +108 -0
- package/src/errors.cc +96 -0
- package/src/errors.h +53 -0
- package/src/kafka-consumer.cc +1457 -0
- package/src/kafka-consumer.h +136 -0
- package/src/per-isolate-data.cc +57 -0
- package/src/per-isolate-data.h +39 -0
- package/src/producer.cc +873 -0
- package/src/producer.h +125 -0
- package/src/topic.cc +180 -0
- package/src/topic.h +56 -0
- package/src/workers.cc +1245 -0
- package/src/workers.h +511 -0
- package/test/binding.spec.js +66 -0
- package/test/consumer.spec.js +91 -0
- package/test/error.spec.js +8 -0
- package/test/index.spec.js +8 -0
- package/test/kafka-consumer-stream.spec.js +298 -0
- package/test/kafka-consumer-worker.js +51 -0
- package/test/kafka-consumer.spec.js +86 -0
- package/test/mocha.opts +1 -0
- package/test/mock.js +55 -0
- package/test/producer/high-level-producer.spec.js +496 -0
- package/test/producer-stream.spec.js +723 -0
- package/test/producer-worker.js +53 -0
- package/test/producer.spec.js +120 -0
- package/test/tools/ref-counter.spec.js +53 -0
- package/test/topic-partition.spec.js +104 -0
- package/test/util.spec.js +46 -0
- package/util/configure.js +30 -0
- package/util/get-env.js +6 -0
- package/util/test-compile.js +11 -0
- package/util/test-producer-delivery.js +100 -0
- package/win_install.ps1 +2 -0
package/src/binding.cc
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* node-rdkafka - Node.js wrapper for RdKafka C/C++ library
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2016 Blizzard Entertainment
|
|
5
|
+
*
|
|
6
|
+
* This software may be modified and distributed under the terms
|
|
7
|
+
* of the MIT license. See the LICENSE.txt file for details.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "src/binding.h"
|
|
11
|
+
|
|
12
|
+
using NodeKafka::Producer;
|
|
13
|
+
using NodeKafka::KafkaConsumer;
|
|
14
|
+
using NodeKafka::AdminClient;
|
|
15
|
+
using NodeKafka::Topic;
|
|
16
|
+
|
|
17
|
+
using RdKafka::ErrorCode;
|
|
18
|
+
|
|
19
|
+
NAN_METHOD(NodeRdKafkaErr2Str) {
|
|
20
|
+
int points = Nan::To<int>(info[0]).FromJust();
|
|
21
|
+
// Cast to error code
|
|
22
|
+
RdKafka::ErrorCode err = static_cast<RdKafka::ErrorCode>(points);
|
|
23
|
+
|
|
24
|
+
std::string errstr = RdKafka::err2str(err);
|
|
25
|
+
|
|
26
|
+
info.GetReturnValue().Set(Nan::New<v8::String>(errstr).ToLocalChecked());
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
NAN_METHOD(NodeRdKafkaBuildInFeatures) {
|
|
30
|
+
RdKafka::Conf * config = RdKafka::Conf::create(RdKafka::Conf::CONF_GLOBAL);
|
|
31
|
+
|
|
32
|
+
std::string features;
|
|
33
|
+
|
|
34
|
+
if (RdKafka::Conf::CONF_OK == config->get("builtin.features", features)) {
|
|
35
|
+
info.GetReturnValue().Set(Nan::New<v8::String>(features).ToLocalChecked());
|
|
36
|
+
} else {
|
|
37
|
+
info.GetReturnValue().Set(Nan::Undefined());
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
delete config;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
void ConstantsInit(v8::Local<v8::Object> exports) {
|
|
44
|
+
v8::Local<v8::Object> topicConstants = Nan::New<v8::Object>();
|
|
45
|
+
|
|
46
|
+
// RdKafka Error Code definitions
|
|
47
|
+
NODE_DEFINE_CONSTANT(topicConstants, RdKafka::Topic::PARTITION_UA);
|
|
48
|
+
NODE_DEFINE_CONSTANT(topicConstants, RdKafka::Topic::OFFSET_BEGINNING);
|
|
49
|
+
NODE_DEFINE_CONSTANT(topicConstants, RdKafka::Topic::OFFSET_END);
|
|
50
|
+
NODE_DEFINE_CONSTANT(topicConstants, RdKafka::Topic::OFFSET_STORED);
|
|
51
|
+
NODE_DEFINE_CONSTANT(topicConstants, RdKafka::Topic::OFFSET_INVALID);
|
|
52
|
+
|
|
53
|
+
Nan::Set(exports, Nan::New("topic").ToLocalChecked(), topicConstants);
|
|
54
|
+
|
|
55
|
+
Nan::Set(exports, Nan::New("err2str").ToLocalChecked(),
|
|
56
|
+
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(NodeRdKafkaErr2Str)).ToLocalChecked()); // NOLINT
|
|
57
|
+
|
|
58
|
+
Nan::Set(exports, Nan::New("features").ToLocalChecked(),
|
|
59
|
+
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(NodeRdKafkaBuildInFeatures)).ToLocalChecked()); // NOLINT
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
void Init(v8::Local<v8::Object> exports, v8::Local<v8::Value> m_, void* v_) {
|
|
63
|
+
KafkaConsumer::Init(exports);
|
|
64
|
+
Producer::Init(exports);
|
|
65
|
+
AdminClient::Init(exports);
|
|
66
|
+
Topic::Init(exports);
|
|
67
|
+
ConstantsInit(exports);
|
|
68
|
+
|
|
69
|
+
Nan::Set(exports, Nan::New("librdkafkaVersion").ToLocalChecked(),
|
|
70
|
+
Nan::New(RdKafka::version_str().c_str()).ToLocalChecked());
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
NODE_MODULE_CONTEXT_AWARE(kafka, Init)
|
package/src/binding.h
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* node-rdkafka - Node.js wrapper for RdKafka C/C++ library
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2016 Blizzard Entertainment
|
|
5
|
+
*
|
|
6
|
+
* This software may be modified and distributed under the terms
|
|
7
|
+
* of the MIT license. See the LICENSE.txt file for details.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#ifndef SRC_BINDING_H_
|
|
11
|
+
#define SRC_BINDING_H_
|
|
12
|
+
|
|
13
|
+
#include <nan.h>
|
|
14
|
+
#include <string>
|
|
15
|
+
#include "rdkafkacpp.h"
|
|
16
|
+
#include "src/common.h"
|
|
17
|
+
#include "src/errors.h"
|
|
18
|
+
#include "src/config.h"
|
|
19
|
+
#include "src/connection.h"
|
|
20
|
+
#include "src/kafka-consumer.h"
|
|
21
|
+
#include "src/producer.h"
|
|
22
|
+
#include "src/topic.h"
|
|
23
|
+
#include "src/admin.h"
|
|
24
|
+
|
|
25
|
+
#endif // SRC_BINDING_H_
|
package/src/callbacks.cc
ADDED
|
@@ -0,0 +1,614 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* node-rdkafka - Node.js wrapper for RdKafka C/C++ library
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2016 Blizzard Entertainment
|
|
5
|
+
*
|
|
6
|
+
* This software may be modified and distributed under the terms
|
|
7
|
+
* of the MIT license. See the LICENSE.txt file for details.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include <string>
|
|
11
|
+
#include <vector>
|
|
12
|
+
#include <algorithm>
|
|
13
|
+
|
|
14
|
+
#include "src/callbacks.h"
|
|
15
|
+
#include "src/kafka-consumer.h"
|
|
16
|
+
|
|
17
|
+
using v8::Local;
|
|
18
|
+
using v8::Value;
|
|
19
|
+
using v8::Object;
|
|
20
|
+
using v8::String;
|
|
21
|
+
using v8::Array;
|
|
22
|
+
using v8::Number;
|
|
23
|
+
|
|
24
|
+
namespace NodeKafka {
|
|
25
|
+
namespace Callbacks {
|
|
26
|
+
|
|
27
|
+
v8::Local<v8::Array> TopicPartitionListToV8Array(
|
|
28
|
+
std::vector<event_topic_partition_t> parts) {
|
|
29
|
+
v8::Local<v8::Array> tp_array = Nan::New<v8::Array>();
|
|
30
|
+
|
|
31
|
+
for (size_t i = 0; i < parts.size(); i++) {
|
|
32
|
+
v8::Local<v8::Object> tp_obj = Nan::New<v8::Object>();
|
|
33
|
+
event_topic_partition_t tp = parts[i];
|
|
34
|
+
|
|
35
|
+
Nan::Set(tp_obj, Nan::New("topic").ToLocalChecked(),
|
|
36
|
+
Nan::New<v8::String>(tp.topic.c_str()).ToLocalChecked());
|
|
37
|
+
Nan::Set(tp_obj, Nan::New("partition").ToLocalChecked(),
|
|
38
|
+
Nan::New<v8::Number>(tp.partition));
|
|
39
|
+
|
|
40
|
+
if (tp.offset >= 0) {
|
|
41
|
+
Nan::Set(tp_obj, Nan::New("offset").ToLocalChecked(),
|
|
42
|
+
Nan::New<v8::Number>(tp.offset));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
Nan::Set(tp_array, i, tp_obj);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return tp_array;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
Dispatcher::Dispatcher() {
|
|
52
|
+
async = NULL;
|
|
53
|
+
uv_mutex_init(&async_lock);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
Dispatcher::~Dispatcher() {
|
|
57
|
+
if (callbacks.size() < 1) return;
|
|
58
|
+
|
|
59
|
+
for (size_t i=0; i < callbacks.size(); i++) {
|
|
60
|
+
callbacks[i].Reset();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
Deactivate();
|
|
64
|
+
|
|
65
|
+
uv_mutex_destroy(&async_lock);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Only run this if we aren't already listening
|
|
69
|
+
void Dispatcher::Activate() {
|
|
70
|
+
if (!async) {
|
|
71
|
+
async = new uv_async_t;
|
|
72
|
+
uv_async_init(Nan::GetCurrentEventLoop(), async, AsyncMessage_);
|
|
73
|
+
|
|
74
|
+
async->data = this;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Should be able to run this regardless of whether it is active or not
|
|
79
|
+
void Dispatcher::Deactivate() {
|
|
80
|
+
if (async) {
|
|
81
|
+
uv_close(reinterpret_cast<uv_handle_t*>(async), NULL);
|
|
82
|
+
async = NULL;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
bool Dispatcher::HasCallbacks() {
|
|
87
|
+
return callbacks.size() > 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
void Dispatcher::Execute() {
|
|
91
|
+
if (async) {
|
|
92
|
+
uv_async_send(async);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
void Dispatcher::Dispatch(const int _argc, Local<Value> _argv[]) {
|
|
97
|
+
// This should probably be an array of v8 values
|
|
98
|
+
if (!HasCallbacks()) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
for (size_t i=0; i < callbacks.size(); i++) {
|
|
103
|
+
v8::Local<v8::Function> f = Nan::New<v8::Function>(callbacks[i]);
|
|
104
|
+
Nan::Callback cb(f);
|
|
105
|
+
cb.Call(_argc, _argv);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
void Dispatcher::AddCallback(const v8::Local<v8::Function> &cb) {
|
|
110
|
+
Nan::Persistent<v8::Function,
|
|
111
|
+
Nan::CopyablePersistentTraits<v8::Function> > value(cb);
|
|
112
|
+
// PersistentCopyableFunction value(func);
|
|
113
|
+
callbacks.push_back(value);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
void Dispatcher::RemoveCallback(const v8::Local<v8::Function> &cb) {
|
|
117
|
+
for (size_t i=0; i < callbacks.size(); i++) {
|
|
118
|
+
if (callbacks[i] == cb) {
|
|
119
|
+
callbacks[i].Reset();
|
|
120
|
+
callbacks.erase(callbacks.begin() + i);
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
event_t::event_t(const RdKafka::Event &event) {
|
|
127
|
+
message = "";
|
|
128
|
+
fac = "";
|
|
129
|
+
|
|
130
|
+
type = event.type();
|
|
131
|
+
|
|
132
|
+
switch (type = event.type()) {
|
|
133
|
+
case RdKafka::Event::EVENT_ERROR:
|
|
134
|
+
message = RdKafka::err2str(event.err());
|
|
135
|
+
break;
|
|
136
|
+
case RdKafka::Event::EVENT_STATS:
|
|
137
|
+
message = event.str();
|
|
138
|
+
break;
|
|
139
|
+
case RdKafka::Event::EVENT_LOG:
|
|
140
|
+
severity = event.severity();
|
|
141
|
+
fac = event.fac();
|
|
142
|
+
message = event.str();
|
|
143
|
+
break;
|
|
144
|
+
case RdKafka::Event::EVENT_THROTTLE:
|
|
145
|
+
message = RdKafka::err2str(event.err());
|
|
146
|
+
throttle_time = event.throttle_time();
|
|
147
|
+
broker_name = event.broker_name();
|
|
148
|
+
broker_id = static_cast<int>(event.broker_id());
|
|
149
|
+
break;
|
|
150
|
+
default:
|
|
151
|
+
message = event.str();
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
event_t::~event_t() {}
|
|
156
|
+
|
|
157
|
+
// Event callback
|
|
158
|
+
Event::Event():
|
|
159
|
+
dispatcher() {}
|
|
160
|
+
|
|
161
|
+
Event::~Event() {}
|
|
162
|
+
|
|
163
|
+
void Event::event_cb(RdKafka::Event &event) {
|
|
164
|
+
// Second parameter is going to be an object with properties to
|
|
165
|
+
// represent the others.
|
|
166
|
+
|
|
167
|
+
if (!dispatcher.HasCallbacks()) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
event_t e(event);
|
|
172
|
+
|
|
173
|
+
dispatcher.Add(e);
|
|
174
|
+
dispatcher.Execute();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
EventDispatcher::EventDispatcher() {}
|
|
178
|
+
EventDispatcher::~EventDispatcher() {}
|
|
179
|
+
|
|
180
|
+
void EventDispatcher::Add(const event_t &e) {
|
|
181
|
+
scoped_mutex_lock lock(async_lock);
|
|
182
|
+
events.push_back(e);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
void EventDispatcher::Flush() {
|
|
186
|
+
Nan::HandleScope scope;
|
|
187
|
+
// Iterate through each of the currently stored events
|
|
188
|
+
// generate a callback object for each, setting to the members
|
|
189
|
+
// then
|
|
190
|
+
if (events.size() < 1) return;
|
|
191
|
+
|
|
192
|
+
const unsigned int argc = 2;
|
|
193
|
+
|
|
194
|
+
std::vector<event_t> _events;
|
|
195
|
+
{
|
|
196
|
+
scoped_mutex_lock lock(async_lock);
|
|
197
|
+
events.swap(_events);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
for (size_t i=0; i < _events.size(); i++) {
|
|
201
|
+
Local<Value> argv[argc] = {};
|
|
202
|
+
Local<Object> jsobj = Nan::New<Object>();
|
|
203
|
+
|
|
204
|
+
switch (_events[i].type) {
|
|
205
|
+
case RdKafka::Event::EVENT_ERROR:
|
|
206
|
+
argv[0] = Nan::New("error").ToLocalChecked();
|
|
207
|
+
argv[1] = Nan::Error(_events[i].message.c_str());
|
|
208
|
+
|
|
209
|
+
// if (event->err() == RdKafka::ERR__ALL_BROKERS_DOWN). Stop running
|
|
210
|
+
// This may be better suited to the node side of things
|
|
211
|
+
break;
|
|
212
|
+
case RdKafka::Event::EVENT_STATS:
|
|
213
|
+
argv[0] = Nan::New("stats").ToLocalChecked();
|
|
214
|
+
|
|
215
|
+
Nan::Set(jsobj, Nan::New("message").ToLocalChecked(),
|
|
216
|
+
Nan::New<String>(_events[i].message.c_str()).ToLocalChecked());
|
|
217
|
+
|
|
218
|
+
break;
|
|
219
|
+
case RdKafka::Event::EVENT_LOG:
|
|
220
|
+
argv[0] = Nan::New("log").ToLocalChecked();
|
|
221
|
+
|
|
222
|
+
Nan::Set(jsobj, Nan::New("severity").ToLocalChecked(),
|
|
223
|
+
Nan::New(_events[i].severity));
|
|
224
|
+
Nan::Set(jsobj, Nan::New("fac").ToLocalChecked(),
|
|
225
|
+
Nan::New(_events[i].fac.c_str()).ToLocalChecked());
|
|
226
|
+
Nan::Set(jsobj, Nan::New("message").ToLocalChecked(),
|
|
227
|
+
Nan::New(_events[i].message.c_str()).ToLocalChecked());
|
|
228
|
+
|
|
229
|
+
break;
|
|
230
|
+
case RdKafka::Event::EVENT_THROTTLE:
|
|
231
|
+
argv[0] = Nan::New("throttle").ToLocalChecked();
|
|
232
|
+
|
|
233
|
+
Nan::Set(jsobj, Nan::New("message").ToLocalChecked(),
|
|
234
|
+
Nan::New(_events[i].message.c_str()).ToLocalChecked());
|
|
235
|
+
|
|
236
|
+
Nan::Set(jsobj, Nan::New("throttleTime").ToLocalChecked(),
|
|
237
|
+
Nan::New(_events[i].throttle_time));
|
|
238
|
+
Nan::Set(jsobj, Nan::New("brokerName").ToLocalChecked(),
|
|
239
|
+
Nan::New(_events[i].broker_name).ToLocalChecked());
|
|
240
|
+
Nan::Set(jsobj, Nan::New("brokerId").ToLocalChecked(),
|
|
241
|
+
Nan::New<Number>(_events[i].broker_id));
|
|
242
|
+
|
|
243
|
+
break;
|
|
244
|
+
default:
|
|
245
|
+
argv[0] = Nan::New("event").ToLocalChecked();
|
|
246
|
+
|
|
247
|
+
Nan::Set(jsobj, Nan::New("message").ToLocalChecked(),
|
|
248
|
+
Nan::New(events[i].message.c_str()).ToLocalChecked());
|
|
249
|
+
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (_events[i].type != RdKafka::Event::EVENT_ERROR) {
|
|
254
|
+
// error would be assigned already
|
|
255
|
+
argv[1] = jsobj;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
Dispatch(argc, argv);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
DeliveryReportDispatcher::DeliveryReportDispatcher() {}
|
|
263
|
+
DeliveryReportDispatcher::~DeliveryReportDispatcher() {}
|
|
264
|
+
|
|
265
|
+
size_t DeliveryReportDispatcher::Add(const DeliveryReport &e) {
|
|
266
|
+
scoped_mutex_lock lock(async_lock);
|
|
267
|
+
events.push_back(e);
|
|
268
|
+
return events.size();
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
void DeliveryReportDispatcher::Flush() {
|
|
272
|
+
Nan::HandleScope scope;
|
|
273
|
+
|
|
274
|
+
const unsigned int argc = 2;
|
|
275
|
+
|
|
276
|
+
size_t outstanding_event_count = 0;
|
|
277
|
+
std::vector<DeliveryReport> events_list;
|
|
278
|
+
{
|
|
279
|
+
scoped_mutex_lock lock(async_lock);
|
|
280
|
+
outstanding_event_count = events.size();
|
|
281
|
+
const size_t flush_count = std::min<size_t>(outstanding_event_count, 100UL);
|
|
282
|
+
events_list.reserve(flush_count);
|
|
283
|
+
for (size_t i = 0; i < flush_count; i++) {
|
|
284
|
+
events_list.emplace_back(std::move(events.front()));
|
|
285
|
+
events.pop_front();
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
for (size_t i = 0; i < events_list.size(); i++) {
|
|
290
|
+
v8::Local<v8::Value> argv[argc] = {};
|
|
291
|
+
|
|
292
|
+
const DeliveryReport& event = events_list[i];
|
|
293
|
+
|
|
294
|
+
if (event.is_error) {
|
|
295
|
+
// If it is an error we need the first argument to be set
|
|
296
|
+
argv[0] = Nan::Error(event.error_string.c_str());
|
|
297
|
+
} else {
|
|
298
|
+
argv[0] = Nan::Null();
|
|
299
|
+
}
|
|
300
|
+
Local<Object> jsobj(Nan::New<Object>());
|
|
301
|
+
|
|
302
|
+
Nan::Set(jsobj, Nan::New("topic").ToLocalChecked(),
|
|
303
|
+
Nan::New(event.topic_name).ToLocalChecked());
|
|
304
|
+
Nan::Set(jsobj, Nan::New("partition").ToLocalChecked(),
|
|
305
|
+
Nan::New<v8::Number>(event.partition));
|
|
306
|
+
Nan::Set(jsobj, Nan::New("offset").ToLocalChecked(),
|
|
307
|
+
Nan::New<v8::Number>(event.offset));
|
|
308
|
+
|
|
309
|
+
if (event.key) {
|
|
310
|
+
Nan::MaybeLocal<v8::Object> buff = Nan::NewBuffer(
|
|
311
|
+
static_cast<char*>(event.key),
|
|
312
|
+
static_cast<int>(event.key_len));
|
|
313
|
+
|
|
314
|
+
Nan::Set(jsobj, Nan::New("key").ToLocalChecked(),
|
|
315
|
+
buff.ToLocalChecked());
|
|
316
|
+
} else {
|
|
317
|
+
Nan::Set(jsobj, Nan::New("key").ToLocalChecked(), Nan::Null());
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (event.opaque) {
|
|
321
|
+
Nan::Persistent<v8::Value> * persistent =
|
|
322
|
+
static_cast<Nan::Persistent<v8::Value> *>(event.opaque);
|
|
323
|
+
v8::Local<v8::Value> object = Nan::New(*persistent);
|
|
324
|
+
Nan::Set(jsobj, Nan::New("opaque").ToLocalChecked(), object);
|
|
325
|
+
|
|
326
|
+
// Okay... now reset and destroy the persistent handle
|
|
327
|
+
persistent->Reset();
|
|
328
|
+
|
|
329
|
+
// Get rid of the persistent since we are making it local
|
|
330
|
+
delete persistent;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
if (event.timestamp > -1) {
|
|
334
|
+
Nan::Set(jsobj, Nan::New("timestamp").ToLocalChecked(),
|
|
335
|
+
Nan::New<v8::Number>(event.timestamp));
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
if (event.m_include_payload) {
|
|
339
|
+
if (event.payload) {
|
|
340
|
+
Nan::MaybeLocal<v8::Object> buff = Nan::NewBuffer(
|
|
341
|
+
static_cast<char*>(event.payload),
|
|
342
|
+
static_cast<int>(event.len));
|
|
343
|
+
|
|
344
|
+
Nan::Set(jsobj, Nan::New<v8::String>("value").ToLocalChecked(),
|
|
345
|
+
buff.ToLocalChecked());
|
|
346
|
+
} else {
|
|
347
|
+
Nan::Set(jsobj, Nan::New<v8::String>("value").ToLocalChecked(),
|
|
348
|
+
Nan::Null());
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
Nan::Set(jsobj, Nan::New<v8::String>("size").ToLocalChecked(),
|
|
353
|
+
Nan::New<v8::Number>(event.len));
|
|
354
|
+
|
|
355
|
+
argv[1] = jsobj;
|
|
356
|
+
|
|
357
|
+
Dispatch(argc, argv);
|
|
358
|
+
}
|
|
359
|
+
if (outstanding_event_count > events_list.size()) {
|
|
360
|
+
Execute();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// This only exists to circumvent the problem with not being able to execute JS
|
|
365
|
+
// on any thread other than the main thread.
|
|
366
|
+
|
|
367
|
+
// I still think there may be better alternatives, because there is a lot of
|
|
368
|
+
// duplication here
|
|
369
|
+
DeliveryReport::DeliveryReport(RdKafka::Message &message, bool include_payload) : // NOLINT
|
|
370
|
+
m_include_payload(include_payload) {
|
|
371
|
+
if (message.err() == RdKafka::ERR_NO_ERROR) {
|
|
372
|
+
is_error = false;
|
|
373
|
+
} else {
|
|
374
|
+
is_error = true;
|
|
375
|
+
error_code = message.err();
|
|
376
|
+
error_string = message.errstr();
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
topic_name = message.topic_name();
|
|
380
|
+
partition = message.partition();
|
|
381
|
+
offset = message.offset();
|
|
382
|
+
|
|
383
|
+
if (message.timestamp().type !=
|
|
384
|
+
RdKafka::MessageTimestamp::MSG_TIMESTAMP_NOT_AVAILABLE) {
|
|
385
|
+
timestamp = message.timestamp().timestamp;
|
|
386
|
+
} else {
|
|
387
|
+
timestamp = -1;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
// Key length.
|
|
392
|
+
key_len = message.key_len();
|
|
393
|
+
|
|
394
|
+
// It is okay if this is null
|
|
395
|
+
if (message.key_pointer()) {
|
|
396
|
+
key = malloc(message.key_len());
|
|
397
|
+
memcpy(key, message.key_pointer(), message.key_len());
|
|
398
|
+
} else {
|
|
399
|
+
key = NULL;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (message.msg_opaque()) {
|
|
403
|
+
opaque = message.msg_opaque();
|
|
404
|
+
} else {
|
|
405
|
+
opaque = NULL;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
len = message.len();
|
|
409
|
+
|
|
410
|
+
if (m_include_payload && message.payload()) {
|
|
411
|
+
// this pointer will be owned and freed by the Nan::NewBuffer
|
|
412
|
+
// created in DeliveryReportDispatcher::Flush()
|
|
413
|
+
payload = malloc(len);
|
|
414
|
+
memcpy(payload, message.payload(), len);
|
|
415
|
+
} else {
|
|
416
|
+
payload = NULL;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
DeliveryReport::~DeliveryReport() {}
|
|
421
|
+
|
|
422
|
+
// Delivery Report
|
|
423
|
+
|
|
424
|
+
Delivery::Delivery():
|
|
425
|
+
dispatcher() {
|
|
426
|
+
m_dr_msg_cb = false;
|
|
427
|
+
}
|
|
428
|
+
Delivery::~Delivery() {}
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
void Delivery::SendMessageBuffer(bool send_dr_msg) {
|
|
432
|
+
m_dr_msg_cb = true;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
void Delivery::dr_cb(RdKafka::Message &message) {
|
|
436
|
+
if (!dispatcher.HasCallbacks()) {
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
DeliveryReport msg(message, m_dr_msg_cb);
|
|
441
|
+
if (dispatcher.Add(msg) == 1) {
|
|
442
|
+
dispatcher.Execute();
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Rebalance CB
|
|
447
|
+
|
|
448
|
+
RebalanceDispatcher::RebalanceDispatcher() {}
|
|
449
|
+
RebalanceDispatcher::~RebalanceDispatcher() {}
|
|
450
|
+
|
|
451
|
+
void RebalanceDispatcher::Add(const rebalance_event_t &e) {
|
|
452
|
+
scoped_mutex_lock lock(async_lock);
|
|
453
|
+
m_events.push_back(e);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
void RebalanceDispatcher::Flush() {
|
|
457
|
+
Nan::HandleScope scope;
|
|
458
|
+
// Iterate through each of the currently stored events
|
|
459
|
+
// generate a callback object for each, setting to the members
|
|
460
|
+
// then
|
|
461
|
+
|
|
462
|
+
if (m_events.size() < 1) return;
|
|
463
|
+
|
|
464
|
+
const unsigned int argc = 2;
|
|
465
|
+
|
|
466
|
+
std::vector<rebalance_event_t> events;
|
|
467
|
+
{
|
|
468
|
+
scoped_mutex_lock lock(async_lock);
|
|
469
|
+
m_events.swap(events);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
for (size_t i=0; i < events.size(); i++) {
|
|
473
|
+
v8::Local<v8::Value> argv[argc] = {};
|
|
474
|
+
|
|
475
|
+
if (events[i].err == RdKafka::ERR_NO_ERROR) {
|
|
476
|
+
argv[0] = Nan::Undefined();
|
|
477
|
+
} else {
|
|
478
|
+
// ERR__ASSIGN_PARTITIONS? Special case? Nah
|
|
479
|
+
argv[0] = Nan::New(events[i].err);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
std::vector<event_topic_partition_t> parts = events[i].partitions;
|
|
483
|
+
|
|
484
|
+
// Now convert the TopicPartition list to a JS array
|
|
485
|
+
argv[1] = TopicPartitionListToV8Array(events[i].partitions);
|
|
486
|
+
|
|
487
|
+
Dispatch(argc, argv);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
void Rebalance::rebalance_cb(RdKafka::KafkaConsumer *consumer,
|
|
492
|
+
RdKafka::ErrorCode err, std::vector<RdKafka::TopicPartition*> &partitions) {
|
|
493
|
+
dispatcher.Add(rebalance_event_t(err, partitions));
|
|
494
|
+
dispatcher.Execute();
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// Offset Commit CB
|
|
498
|
+
|
|
499
|
+
OffsetCommitDispatcher::OffsetCommitDispatcher() {}
|
|
500
|
+
OffsetCommitDispatcher::~OffsetCommitDispatcher() {}
|
|
501
|
+
|
|
502
|
+
void OffsetCommitDispatcher::Add(const offset_commit_event_t &e) {
|
|
503
|
+
scoped_mutex_lock lock(async_lock);
|
|
504
|
+
m_events.push_back(e);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
void OffsetCommitDispatcher::Flush() {
|
|
508
|
+
Nan::HandleScope scope;
|
|
509
|
+
// Iterate through each of the currently stored events
|
|
510
|
+
// generate a callback object for each, setting to the members
|
|
511
|
+
// then
|
|
512
|
+
|
|
513
|
+
if (m_events.size() < 1) return;
|
|
514
|
+
|
|
515
|
+
const unsigned int argc = 2;
|
|
516
|
+
|
|
517
|
+
std::vector<offset_commit_event_t> events;
|
|
518
|
+
{
|
|
519
|
+
scoped_mutex_lock lock(async_lock);
|
|
520
|
+
m_events.swap(events);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
for (size_t i = 0; i < events.size(); i++) {
|
|
524
|
+
v8::Local<v8::Value> argv[argc] = {};
|
|
525
|
+
|
|
526
|
+
if (events[i].err == RdKafka::ERR_NO_ERROR) {
|
|
527
|
+
argv[0] = Nan::Undefined();
|
|
528
|
+
} else {
|
|
529
|
+
argv[0] = Nan::New(events[i].err);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// Now convert the TopicPartition list to a JS array
|
|
533
|
+
argv[1] = TopicPartitionListToV8Array(events[i].partitions);
|
|
534
|
+
|
|
535
|
+
Dispatch(argc, argv);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
void OffsetCommit::offset_commit_cb(RdKafka::ErrorCode err,
|
|
540
|
+
std::vector<RdKafka::TopicPartition*> &offsets) {
|
|
541
|
+
dispatcher.Add(offset_commit_event_t(err, offsets));
|
|
542
|
+
dispatcher.Execute();
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// Partitioner callback
|
|
546
|
+
|
|
547
|
+
Partitioner::Partitioner() {}
|
|
548
|
+
Partitioner::~Partitioner() {}
|
|
549
|
+
|
|
550
|
+
int32_t Partitioner::partitioner_cb(const RdKafka::Topic *topic,
|
|
551
|
+
const std::string *key,
|
|
552
|
+
int32_t partition_cnt,
|
|
553
|
+
void *msg_opaque) {
|
|
554
|
+
// Send this and get the callback and parse the int
|
|
555
|
+
if (callback.IsEmpty()) {
|
|
556
|
+
// default behavior
|
|
557
|
+
return random(topic, partition_cnt);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
Local<Value> argv[3] = {};
|
|
561
|
+
|
|
562
|
+
argv[0] = Nan::New<v8::String>(topic->name().c_str()).ToLocalChecked();
|
|
563
|
+
if (key->empty()) {
|
|
564
|
+
argv[1] = Nan::Null();
|
|
565
|
+
} else {
|
|
566
|
+
argv[1] = Nan::New<v8::String>(key->c_str()).ToLocalChecked();
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
argv[2] = Nan::New<v8::Int32>(partition_cnt);
|
|
570
|
+
|
|
571
|
+
v8::Local<v8::Value> return_value = callback.Call(3, argv);
|
|
572
|
+
|
|
573
|
+
Nan::Maybe<int32_t> partition_return = Nan::To<int32_t>(return_value);
|
|
574
|
+
|
|
575
|
+
int32_t chosen_partition;
|
|
576
|
+
|
|
577
|
+
if (partition_return.IsNothing()) {
|
|
578
|
+
chosen_partition = RdKafka::Topic::PARTITION_UA;
|
|
579
|
+
} else {
|
|
580
|
+
chosen_partition = partition_return.FromJust();
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
if (!topic->partition_available(chosen_partition)) {
|
|
584
|
+
return RdKafka::Topic::PARTITION_UA;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
return chosen_partition;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
unsigned int Partitioner::djb_hash(const char *str, size_t len) {
|
|
591
|
+
unsigned int hash = 5381;
|
|
592
|
+
for (size_t i = 0 ; i < len ; i++)
|
|
593
|
+
hash = ((hash << 5) + hash) + str[i];
|
|
594
|
+
return hash;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
unsigned int Partitioner::random(const RdKafka::Topic *topic, int32_t max) {
|
|
598
|
+
int32_t random_partition = rand() % max; // NOLINT
|
|
599
|
+
|
|
600
|
+
if (topic->partition_available(random_partition)) {
|
|
601
|
+
return random_partition;
|
|
602
|
+
} else {
|
|
603
|
+
return RdKafka::Topic::PARTITION_UA;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
void Partitioner::SetCallback(v8::Local<v8::Function> cb) {
|
|
608
|
+
callback(cb);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
} // end namespace Callbacks
|
|
613
|
+
|
|
614
|
+
} // End namespace NodeKafka
|