@ohos-ports/confluentinc-kafka-javascript 1.10.0-beta.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.
- package/CHANGELOG.md +457 -0
- package/LICENSE.kafkajs +31 -0
- package/LICENSE.node-rdkafka +25 -0
- package/LICENSE.txt +20 -0
- package/README.md +133 -0
- package/binding.gyp +184 -0
- package/build/Release/confluent-kafka-javascript.node +0 -0
- package/build/deps/librdkafka++.so.1 +0 -0
- package/build/deps/librdkafka.Makefile +6 -0
- package/build/deps/librdkafka.so.1 +0 -0
- package/build/deps/librdkafka.target.mk +55 -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 +35 -0
- package/deps/librdkafka/.gdbmacros +19 -0
- package/deps/librdkafka/CHANGELOG.md +2477 -0
- package/deps/librdkafka/CMakeLists.txt +291 -0
- package/deps/librdkafka/CODE_OF_CONDUCT.md +46 -0
- package/deps/librdkafka/CONFIGURATION.md +212 -0
- package/deps/librdkafka/CONTRIBUTING.md +431 -0
- package/deps/librdkafka/Doxyfile +2375 -0
- package/deps/librdkafka/INTRODUCTION.md +2752 -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 +125 -0
- package/deps/librdkafka/README.md +201 -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 +341 -0
- package/deps/librdkafka/dev-conf.sh +123 -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/service.yml +182 -0
- package/deps/librdkafka/src/CMakeLists.txt +379 -0
- package/deps/librdkafka/src/Makefile +105 -0
- package/deps/librdkafka/src/README.lz4.md +30 -0
- package/deps/librdkafka/src/cJSON.c +3191 -0
- package/deps/librdkafka/src/cJSON.h +306 -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 +592 -0
- package/deps/librdkafka/src/rdaddr.c +255 -0
- package/deps/librdkafka/src/rdaddr.h +202 -0
- package/deps/librdkafka/src/rdatomic.h +262 -0
- package/deps/librdkafka/src/rdavg.h +260 -0
- package/deps/librdkafka/src/rdavl.c +210 -0
- package/deps/librdkafka/src/rdavl.h +250 -0
- package/deps/librdkafka/src/rdbase64.c +200 -0
- package/deps/librdkafka/src/rdbase64.h +43 -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 +175 -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 +831 -0
- package/deps/librdkafka/src/rdhttp.h +101 -0
- package/deps/librdkafka/src/rdinterval.h +177 -0
- package/deps/librdkafka/src/rdkafka.c +7287 -0
- package/deps/librdkafka/src/rdkafka.h +11795 -0
- package/deps/librdkafka/src/rdkafka_admin.c +10165 -0
- package/deps/librdkafka/src/rdkafka_admin.h +658 -0
- package/deps/librdkafka/src/rdkafka_assignment.c +1282 -0
- package/deps/librdkafka/src/rdkafka_assignment.h +73 -0
- package/deps/librdkafka/src/rdkafka_assignor.c +1800 -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 +222 -0
- package/deps/librdkafka/src/rdkafka_broker.c +6736 -0
- package/deps/librdkafka/src/rdkafka_broker.h +851 -0
- package/deps/librdkafka/src/rdkafka_buf.c +543 -0
- package/deps/librdkafka/src/rdkafka_buf.h +1525 -0
- package/deps/librdkafka/src/rdkafka_cert.c +576 -0
- package/deps/librdkafka/src/rdkafka_cert.h +62 -0
- package/deps/librdkafka/src/rdkafka_cgrp.c +8310 -0
- package/deps/librdkafka/src/rdkafka_cgrp.h +589 -0
- package/deps/librdkafka/src/rdkafka_conf.c +5177 -0
- package/deps/librdkafka/src/rdkafka_conf.h +746 -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 +898 -0
- package/deps/librdkafka/src/rdkafka_feature.h +104 -0
- package/deps/librdkafka/src/rdkafka_fetcher.c +3820 -0
- package/deps/librdkafka/src/rdkafka_fetcher.h +62 -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 +1505 -0
- package/deps/librdkafka/src/rdkafka_interceptor.c +842 -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 +2347 -0
- package/deps/librdkafka/src/rdkafka_metadata.h +350 -0
- package/deps/librdkafka/src/rdkafka_metadata_cache.c +1183 -0
- package/deps/librdkafka/src/rdkafka_mock.c +4514 -0
- package/deps/librdkafka/src/rdkafka_mock.h +867 -0
- package/deps/librdkafka/src/rdkafka_mock_cgrp.c +1877 -0
- package/deps/librdkafka/src/rdkafka_mock_handlers.c +5255 -0
- package/deps/librdkafka/src/rdkafka_mock_int.h +1005 -0
- package/deps/librdkafka/src/rdkafka_mock_sharegrp.c +1207 -0
- package/deps/librdkafka/src/rdkafka_msg.c +2619 -0
- package/deps/librdkafka/src/rdkafka_msg.h +629 -0
- package/deps/librdkafka/src/rdkafka_msgbatch.h +62 -0
- package/deps/librdkafka/src/rdkafka_msgset.h +105 -0
- package/deps/librdkafka/src/rdkafka_msgset_reader.c +2099 -0
- package/deps/librdkafka/src/rdkafka_msgset_writer.c +1474 -0
- package/deps/librdkafka/src/rdkafka_offset.c +1565 -0
- package/deps/librdkafka/src/rdkafka_offset.h +150 -0
- package/deps/librdkafka/src/rdkafka_op.c +1219 -0
- package/deps/librdkafka/src/rdkafka_op.h +1065 -0
- package/deps/librdkafka/src/rdkafka_partition.c +5109 -0
- package/deps/librdkafka/src/rdkafka_partition.h +1215 -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 +739 -0
- package/deps/librdkafka/src/rdkafka_protocol.h +131 -0
- package/deps/librdkafka/src/rdkafka_queue.c +1351 -0
- package/deps/librdkafka/src/rdkafka_queue.h +1235 -0
- package/deps/librdkafka/src/rdkafka_range_assignor.c +1748 -0
- package/deps/librdkafka/src/rdkafka_request.c +7298 -0
- package/deps/librdkafka/src/rdkafka_request.h +761 -0
- package/deps/librdkafka/src/rdkafka_roundrobin_assignor.c +123 -0
- package/deps/librdkafka/src/rdkafka_sasl.c +589 -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 +1833 -0
- package/deps/librdkafka/src/rdkafka_sasl_oauthbearer.h +52 -0
- package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.c +1827 -0
- package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.h +52 -0
- package/deps/librdkafka/src/rdkafka_sasl_plain.c +142 -0
- package/deps/librdkafka/src/rdkafka_sasl_scram.c +858 -0
- package/deps/librdkafka/src/rdkafka_sasl_win32.c +550 -0
- package/deps/librdkafka/src/rdkafka_share_acknowledgement.c +1445 -0
- package/deps/librdkafka/src/rdkafka_share_acknowledgement.h +373 -0
- package/deps/librdkafka/src/rdkafka_ssl.c +2235 -0
- package/deps/librdkafka/src/rdkafka_ssl.h +86 -0
- package/deps/librdkafka/src/rdkafka_sticky_assignor.c +4785 -0
- package/deps/librdkafka/src/rdkafka_subscription.c +411 -0
- package/deps/librdkafka/src/rdkafka_telemetry.c +761 -0
- package/deps/librdkafka/src/rdkafka_telemetry.h +52 -0
- package/deps/librdkafka/src/rdkafka_telemetry_decode.c +1307 -0
- package/deps/librdkafka/src/rdkafka_telemetry_decode.h +59 -0
- package/deps/librdkafka/src/rdkafka_telemetry_encode.c +1309 -0
- package/deps/librdkafka/src/rdkafka_telemetry_encode.h +459 -0
- package/deps/librdkafka/src/rdkafka_timer.c +407 -0
- package/deps/librdkafka/src/rdkafka_timer.h +117 -0
- package/deps/librdkafka/src/rdkafka_topic.c +2382 -0
- package/deps/librdkafka/src/rdkafka_topic.h +369 -0
- package/deps/librdkafka/src/rdkafka_transport.c +1309 -0
- package/deps/librdkafka/src/rdkafka_transport.h +99 -0
- package/deps/librdkafka/src/rdkafka_transport_int.h +100 -0
- package/deps/librdkafka/src/rdkafka_txnmgr.c +3256 -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 +593 -0
- package/deps/librdkafka/src/rdlist.h +444 -0
- package/deps/librdkafka/src/rdlog.c +89 -0
- package/deps/librdkafka/src/rdlog.h +41 -0
- package/deps/librdkafka/src/rdmap.c +508 -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 +151 -0
- package/deps/librdkafka/src/rdrand.h +72 -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 +356 -0
- package/deps/librdkafka/src/rdtypes.h +86 -0
- package/deps/librdkafka/src/rdunittest.c +564 -0
- package/deps/librdkafka/src/rdunittest.h +232 -0
- package/deps/librdkafka/src/rdunittest_acknowledge.c +1177 -0
- package/deps/librdkafka/src/rdunittest_fetcher.c +1211 -0
- package/deps/librdkafka/src/rdunittest_msgset_errors.c +1521 -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 +1352 -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 +210 -0
- package/deps/librdkafka/src/tinycthread_extra.h +218 -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 +3797 -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 +102 -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 +934 -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 +272 -0
- package/deps/librdkafka/tests/0011-produce_batch.c +753 -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 +181 -0
- package/deps/librdkafka/tests/0017-compression.c +140 -0
- package/deps/librdkafka/tests/0018-cgrp_term.c +444 -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 +72 -0
- package/deps/librdkafka/tests/0022-consume_batch.c +331 -0
- package/deps/librdkafka/tests/0025-timers.c +147 -0
- package/deps/librdkafka/tests/0026-consume_pause.c +547 -0
- package/deps/librdkafka/tests/0028-long_topicnames.c +79 -0
- package/deps/librdkafka/tests/0029-assign_offset.c +202 -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 +536 -0
- package/deps/librdkafka/tests/0034-offset_reset.c +398 -0
- package/deps/librdkafka/tests/0035-api_version.c +73 -0
- package/deps/librdkafka/tests/0036-partial_fetch.c +87 -0
- package/deps/librdkafka/tests/0037-destroy_hang_local.c +85 -0
- package/deps/librdkafka/tests/0038-performance.c +121 -0
- package/deps/librdkafka/tests/0039-event.c +284 -0
- package/deps/librdkafka/tests/0040-io_event.c +257 -0
- package/deps/librdkafka/tests/0041-fetch_max_bytes.c +97 -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 +94 -0
- package/deps/librdkafka/tests/0045-subscribe_update.c +1010 -0
- package/deps/librdkafka/tests/0046-rkt_cache.c +65 -0
- package/deps/librdkafka/tests/0047-partial_buf_tmout.c +98 -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 +145 -0
- package/deps/librdkafka/tests/0051-assign_adds.c +126 -0
- package/deps/librdkafka/tests/0052-msg_timestamps.c +238 -0
- package/deps/librdkafka/tests/0053-stats_cb.cpp +527 -0
- package/deps/librdkafka/tests/0054-offset_time.cpp +236 -0
- package/deps/librdkafka/tests/0055-producer_latency.c +539 -0
- package/deps/librdkafka/tests/0056-balanced_group_mt.c +315 -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 +241 -0
- package/deps/librdkafka/tests/0060-op_prio.cpp +163 -0
- package/deps/librdkafka/tests/0061-consumer_lag.cpp +295 -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 +529 -0
- package/deps/librdkafka/tests/0065-yield.cpp +140 -0
- package/deps/librdkafka/tests/0066-plugins.cpp +143 -0
- package/deps/librdkafka/tests/0067-empty_topic.cpp +151 -0
- package/deps/librdkafka/tests/0068-produce_timeout.c +136 -0
- package/deps/librdkafka/tests/0069-consumer_add_parts.c +119 -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 +290 -0
- package/deps/librdkafka/tests/0076-produce_retry.c +452 -0
- package/deps/librdkafka/tests/0077-compaction.c +366 -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 +3095 -0
- package/deps/librdkafka/tests/0081-admin.c +5633 -0
- package/deps/librdkafka/tests/0082-fetch_max_bytes.cpp +137 -0
- package/deps/librdkafka/tests/0083-cb_event.c +233 -0
- package/deps/librdkafka/tests/0084-destroy_flags.c +208 -0
- package/deps/librdkafka/tests/0085-headers.cpp +392 -0
- package/deps/librdkafka/tests/0086-purge.c +368 -0
- package/deps/librdkafka/tests/0088-produce_metadata_timeout.c +162 -0
- package/deps/librdkafka/tests/0089-max_poll_interval.c +511 -0
- package/deps/librdkafka/tests/0090-idempotence.c +171 -0
- package/deps/librdkafka/tests/0091-max_poll_interval_timeout.c +295 -0
- package/deps/librdkafka/tests/0092-mixed_msgver.c +103 -0
- package/deps/librdkafka/tests/0093-holb.c +200 -0
- package/deps/librdkafka/tests/0094-idempotence_msg_timeout.c +231 -0
- package/deps/librdkafka/tests/0095-all_brokers_down.cpp +122 -0
- package/deps/librdkafka/tests/0097-ssl_verify.cpp +674 -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 +836 -0
- package/deps/librdkafka/tests/0103-transactions.c +1383 -0
- package/deps/librdkafka/tests/0104-fetch_from_follower_mock.c +625 -0
- package/deps/librdkafka/tests/0105-transactions_mock.c +3930 -0
- package/deps/librdkafka/tests/0106-cgrp_sess_timeout.c +318 -0
- package/deps/librdkafka/tests/0107-topic_recreate.c +259 -0
- package/deps/librdkafka/tests/0109-auto_create_topics.cpp +278 -0
- package/deps/librdkafka/tests/0110-batch_size.cpp +182 -0
- package/deps/librdkafka/tests/0111-delay_create_topics.cpp +127 -0
- package/deps/librdkafka/tests/0112-assign_unknown_part.c +87 -0
- package/deps/librdkafka/tests/0113-cooperative_rebalance.cpp +3473 -0
- package/deps/librdkafka/tests/0114-sticky_partitioning.cpp +176 -0
- package/deps/librdkafka/tests/0115-producer_auth.cpp +182 -0
- package/deps/librdkafka/tests/0116-kafkaconsumer_close.cpp +216 -0
- package/deps/librdkafka/tests/0117-mock_errors.c +331 -0
- package/deps/librdkafka/tests/0118-commit_rebalance.c +154 -0
- package/deps/librdkafka/tests/0119-consumer_auth.cpp +167 -0
- package/deps/librdkafka/tests/0120-asymmetric_subscription.c +185 -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 +1164 -0
- package/deps/librdkafka/tests/0127-fetch_queue_backoff.cpp +165 -0
- package/deps/librdkafka/tests/0128-sasl_callback_queue.cpp +217 -0
- package/deps/librdkafka/tests/0129-fetch_aborted_msgs.c +79 -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 +179 -0
- package/deps/librdkafka/tests/0133-ssl_keys.c +150 -0
- package/deps/librdkafka/tests/0134-ssl_provider.c +92 -0
- package/deps/librdkafka/tests/0135-sasl_credentials.cpp +279 -0
- package/deps/librdkafka/tests/0136-resolve_cb.c +181 -0
- package/deps/librdkafka/tests/0137-barrier_batch_consume.c +752 -0
- package/deps/librdkafka/tests/0138-admin_mock.c +281 -0
- package/deps/librdkafka/tests/0139-offset_validation_mock.c +950 -0
- package/deps/librdkafka/tests/0140-commit_metadata.cpp +108 -0
- package/deps/librdkafka/tests/0142-reauthentication.c +931 -0
- package/deps/librdkafka/tests/0143-exponential_backoff_mock.c +552 -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 +505 -0
- package/deps/librdkafka/tests/0147-consumer_group_consumer_mock.c +1210 -0
- package/deps/librdkafka/tests/0148-offset_fetch_commit_error_mock.c +569 -0
- package/deps/librdkafka/tests/0149-broker-same-host-port.c +140 -0
- package/deps/librdkafka/tests/0150-telemetry_mock.c +651 -0
- package/deps/librdkafka/tests/0151-purge-brokers.c +566 -0
- package/deps/librdkafka/tests/0152-rebootstrap.c +59 -0
- package/deps/librdkafka/tests/0153-memberid.c +128 -0
- package/deps/librdkafka/tests/0155-share_group_heartbeat_mock.c +2695 -0
- package/deps/librdkafka/tests/0156-share_consumer_fetch_mock.c +1551 -0
- package/deps/librdkafka/tests/0157-share_consumer_ack_mock.c +1788 -0
- package/deps/librdkafka/tests/0158-share_consumer_transactions_mock.c +467 -0
- package/deps/librdkafka/tests/0170-share_consumer_subscription.c +2192 -0
- package/deps/librdkafka/tests/0171-share_consumer_consume.c +2150 -0
- package/deps/librdkafka/tests/0172-share_consumer_acknowledge.c +1919 -0
- package/deps/librdkafka/tests/0173-share_consumer_commit_async.c +2735 -0
- package/deps/librdkafka/tests/0174-share_consumer_concurrency.c +1434 -0
- package/deps/librdkafka/tests/0175-share_consumer_groups.c +574 -0
- package/deps/librdkafka/tests/0176-share_consumer_commit_sync.c +2986 -0
- package/deps/librdkafka/tests/0177-share_consumer_transactions.c +1815 -0
- package/deps/librdkafka/tests/0178-share_consumer_close.c +2102 -0
- package/deps/librdkafka/tests/0179-share_consumer_destroy.c +2482 -0
- package/deps/librdkafka/tests/0180-share_consumer_config.c +1677 -0
- package/deps/librdkafka/tests/0181-share_consumer_topic_delete.c +354 -0
- package/deps/librdkafka/tests/0182-share_consumer_error_handling_mock.c +3358 -0
- package/deps/librdkafka/tests/0183-share_consumer_leader_change_mock.c +1234 -0
- package/deps/librdkafka/tests/0184-share_consumer_topic_recreate.c +1356 -0
- package/deps/librdkafka/tests/0185-share_consumer_max_poll_interval.c +557 -0
- package/deps/librdkafka/tests/0186-share_consumer_fatal_error.c +360 -0
- package/deps/librdkafka/tests/0190-share_consumer_telemetry.c +387 -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 +193 -0
- package/deps/librdkafka/tests/LibrdkafkaTestApp.py +291 -0
- package/deps/librdkafka/tests/Makefile +182 -0
- package/deps/librdkafka/tests/README.md +514 -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 +203 -0
- package/deps/librdkafka/tests/delete-test-topics.sh +56 -0
- package/deps/librdkafka/tests/fixtures/oauthbearer/jwt_assertion_template.json +10 -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.intermediate.p12 +0 -0
- package/deps/librdkafka/tests/fixtures/ssl/client.keystore.p12 +0 -0
- package/deps/librdkafka/tests/fixtures/ssl/client2.certificate.intermediate.pem +72 -0
- package/deps/librdkafka/tests/fixtures/ssl/client2.certificate.pem +50 -0
- package/deps/librdkafka/tests/fixtures/ssl/client2.intermediate.key +46 -0
- package/deps/librdkafka/tests/fixtures/ssl/client2.key +46 -0
- package/deps/librdkafka/tests/fixtures/ssl/create_keys.sh +168 -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 +13 -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-all-tests.sh +81 -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-batches.py +157 -0
- package/deps/librdkafka/tests/run-test.sh +141 -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/share_telemetry_verify/share-otel-collector-config.yaml +28 -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 +8376 -0
- package/deps/librdkafka/tests/test.conf.example +27 -0
- package/deps/librdkafka/tests/test.h +1150 -0
- package/deps/librdkafka/tests/testcpp.cpp +131 -0
- package/deps/librdkafka/tests/testcpp.h +388 -0
- package/deps/librdkafka/tests/testshared.h +416 -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/trivup/trivup-0.15.0.tar.gz +0 -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/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 +282 -0
- package/deps/librdkafka/win32/librdkafkacpp/librdkafkacpp.vcxproj +104 -0
- package/deps/librdkafka/win32/msbuild.ps1 +58 -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 +47 -0
- package/deps/librdkafka/win32/setup-vcpkg.ps1 +34 -0
- package/deps/librdkafka/win32/tests/test.conf.example +25 -0
- package/deps/librdkafka/win32/tests/tests.vcxproj +278 -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 +101 -0
- package/deps/librdkafka/win32/wintime.h +33 -0
- package/deps/librdkafka.gyp +83 -0
- package/deps/windows-install.py +80 -0
- package/index.d.ts +3 -0
- package/lib/admin.js +732 -0
- package/lib/client.js +679 -0
- package/lib/error.js +501 -0
- package/lib/index.js +8 -0
- package/lib/kafka-consumer-stream.js +399 -0
- package/lib/kafka-consumer.js +798 -0
- package/lib/kafkajs/_admin.js +1052 -0
- package/lib/kafkajs/_common.js +887 -0
- package/lib/kafkajs/_consumer.js +2156 -0
- package/lib/kafkajs/_consumer_cache.js +310 -0
- package/lib/kafkajs/_error.js +298 -0
- package/lib/kafkajs/_kafka.js +125 -0
- package/lib/kafkajs/_linked-list.js +220 -0
- package/lib/kafkajs/_producer.js +863 -0
- package/lib/kafkajs/index.js +5 -0
- package/lib/producer/high-level-producer.js +400 -0
- package/lib/producer-stream.js +337 -0
- package/lib/producer.js +405 -0
- package/lib/rdkafka.js +44 -0
- package/lib/tools/ref-counter.js +53 -0
- package/lib/topic-partition.js +91 -0
- package/lib/topic.js +43 -0
- package/lib/util.js +55 -0
- package/librdkafka.js +12 -0
- package/package.json +85 -0
- package/shim/source_location +54 -0
- package/src/admin.cc +1597 -0
- package/src/admin.h +112 -0
- package/src/binding.cc +76 -0
- package/src/binding.h +25 -0
- package/src/callbacks.cc +676 -0
- package/src/callbacks.h +302 -0
- package/src/common.cc +1628 -0
- package/src/common.h +192 -0
- package/src/config.cc +219 -0
- package/src/config.h +61 -0
- package/src/connection.cc +703 -0
- package/src/connection.h +117 -0
- package/src/errors.cc +119 -0
- package/src/errors.h +60 -0
- package/src/kafka-consumer.cc +1539 -0
- package/src/kafka-consumer.h +147 -0
- package/src/producer.cc +917 -0
- package/src/producer.h +124 -0
- package/src/topic.cc +173 -0
- package/src/topic.h +54 -0
- package/src/workers.cc +1714 -0
- package/src/workers.h +690 -0
- package/types/config.d.ts +1269 -0
- package/types/errors.d.ts +373 -0
- package/types/kafkajs.d.ts +568 -0
- package/types/rdkafka.d.ts +571 -0
- package/util/configure.js +32 -0
- package/util/generate-docs.sh +18 -0
- package/util/get-env.js +6 -0
- package/util/test-compile.js +11 -0
- package/util/test-producer-delivery.js +100 -0
|
@@ -0,0 +1,867 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* librdkafka - Apache Kafka C library
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2019-2022, Magnus Edenhill
|
|
5
|
+
* 2023, Confluent Inc.
|
|
6
|
+
* All rights reserved.
|
|
7
|
+
*
|
|
8
|
+
* Redistribution and use in source and binary forms, with or without
|
|
9
|
+
* modification, are permitted provided that the following conditions are met:
|
|
10
|
+
*
|
|
11
|
+
* 1. Redistributions of source code must retain the above copyright notice,
|
|
12
|
+
* this list of conditions and the following disclaimer.
|
|
13
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
14
|
+
* this list of conditions and the following disclaimer in the documentation
|
|
15
|
+
* and/or other materials provided with the distribution.
|
|
16
|
+
*
|
|
17
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
18
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
19
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
20
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
21
|
+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
22
|
+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
23
|
+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
24
|
+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
25
|
+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
26
|
+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
27
|
+
* POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#ifndef _RDKAFKA_MOCK_H_
|
|
31
|
+
#define _RDKAFKA_MOCK_H_
|
|
32
|
+
|
|
33
|
+
#ifndef _RDKAFKA_H_
|
|
34
|
+
#error "rdkafka_mock.h must be included after rdkafka.h"
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
#ifdef __cplusplus
|
|
38
|
+
extern "C" {
|
|
39
|
+
#if 0
|
|
40
|
+
} /* Restore indent */
|
|
41
|
+
#endif
|
|
42
|
+
#endif
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @name Mock cluster
|
|
47
|
+
*
|
|
48
|
+
* Provides a mock Kafka cluster with a configurable number of brokers
|
|
49
|
+
* that support a reasonable subset of Kafka protocol operations,
|
|
50
|
+
* error injection, etc.
|
|
51
|
+
*
|
|
52
|
+
* There are two ways to use the mock clusters, the most simple approach
|
|
53
|
+
* is to configure `test.mock.num.brokers` (to e.g. 3) on the rd_kafka_t
|
|
54
|
+
* in an existing application, which will replace the configured
|
|
55
|
+
* `bootstrap.servers` with the mock cluster brokers.
|
|
56
|
+
* This approach is convenient to easily test existing applications.
|
|
57
|
+
*
|
|
58
|
+
* The second approach is to explicitly create a mock cluster on an
|
|
59
|
+
* rd_kafka_t instance by using rd_kafka_mock_cluster_new().
|
|
60
|
+
*
|
|
61
|
+
* Mock clusters provide localhost listeners that can be used as the bootstrap
|
|
62
|
+
* servers by multiple rd_kafka_t instances.
|
|
63
|
+
*
|
|
64
|
+
* Currently supported functionality:
|
|
65
|
+
* - Producer
|
|
66
|
+
* - Idempotent Producer
|
|
67
|
+
* - Transactional Producer
|
|
68
|
+
* - Low-level consumer
|
|
69
|
+
* - High-level balanced consumer groups with offset commits
|
|
70
|
+
* - Topic Metadata and auto creation
|
|
71
|
+
* - Telemetry (KIP-714)
|
|
72
|
+
*
|
|
73
|
+
* @remark This is an experimental public API that is NOT covered by the
|
|
74
|
+
* librdkafka API or ABI stability guarantees.
|
|
75
|
+
*
|
|
76
|
+
*
|
|
77
|
+
* @warning THIS IS AN EXPERIMENTAL API, SUBJECT TO CHANGE OR REMOVAL.
|
|
78
|
+
*
|
|
79
|
+
* @{
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
typedef struct rd_kafka_mock_cluster_s rd_kafka_mock_cluster_t;
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @brief Create new mock cluster with \p broker_cnt brokers.
|
|
87
|
+
*
|
|
88
|
+
* The broker ids will start at 1 up to and including \p broker_cnt.
|
|
89
|
+
*
|
|
90
|
+
* The \p rk instance is required for internal book keeping but continues
|
|
91
|
+
* to operate as usual.
|
|
92
|
+
*/
|
|
93
|
+
RD_EXPORT
|
|
94
|
+
rd_kafka_mock_cluster_t *rd_kafka_mock_cluster_new(rd_kafka_t *rk,
|
|
95
|
+
int broker_cnt);
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @brief Destroy mock cluster.
|
|
100
|
+
*/
|
|
101
|
+
RD_EXPORT
|
|
102
|
+
void rd_kafka_mock_cluster_destroy(rd_kafka_mock_cluster_t *mcluster);
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @returns the rd_kafka_t instance for a cluster as passed to
|
|
108
|
+
* rd_kafka_mock_cluster_new().
|
|
109
|
+
*/
|
|
110
|
+
RD_EXPORT rd_kafka_t *
|
|
111
|
+
rd_kafka_mock_cluster_handle(const rd_kafka_mock_cluster_t *mcluster);
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @returns the rd_kafka_mock_cluster_t instance as created by
|
|
116
|
+
* setting the `test.mock.num.brokers` configuration property,
|
|
117
|
+
* or NULL if no such instance.
|
|
118
|
+
*/
|
|
119
|
+
RD_EXPORT rd_kafka_mock_cluster_t *
|
|
120
|
+
rd_kafka_handle_mock_cluster(const rd_kafka_t *rk);
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @returns the mock cluster's bootstrap.servers list
|
|
126
|
+
*/
|
|
127
|
+
RD_EXPORT const char *
|
|
128
|
+
rd_kafka_mock_cluster_bootstraps(const rd_kafka_mock_cluster_t *mcluster);
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @brief Clear the cluster's error state for the given \p ApiKey.
|
|
133
|
+
*/
|
|
134
|
+
RD_EXPORT
|
|
135
|
+
void rd_kafka_mock_clear_request_errors(rd_kafka_mock_cluster_t *mcluster,
|
|
136
|
+
int16_t ApiKey);
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @brief Push \p cnt errors in the \p ... va-arg list onto the cluster's
|
|
141
|
+
* error stack for the given \p ApiKey.
|
|
142
|
+
*
|
|
143
|
+
* \p ApiKey is the Kafka protocol request type, e.g., ProduceRequest (0).
|
|
144
|
+
*
|
|
145
|
+
* The following \p cnt protocol requests matching \p ApiKey will fail with the
|
|
146
|
+
* provided error code and removed from the stack, starting with
|
|
147
|
+
* the first error code, then the second, etc.
|
|
148
|
+
*
|
|
149
|
+
* Passing \c RD_KAFKA_RESP_ERR__TRANSPORT will make the mock broker
|
|
150
|
+
* disconnect the client which can be useful to trigger a disconnect on certain
|
|
151
|
+
* requests.
|
|
152
|
+
*/
|
|
153
|
+
RD_EXPORT
|
|
154
|
+
void rd_kafka_mock_push_request_errors(rd_kafka_mock_cluster_t *mcluster,
|
|
155
|
+
int16_t ApiKey,
|
|
156
|
+
size_t cnt,
|
|
157
|
+
...);
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @brief Same as rd_kafka_mock_push_request_errors() but takes
|
|
162
|
+
* an array of errors.
|
|
163
|
+
*/
|
|
164
|
+
RD_EXPORT void
|
|
165
|
+
rd_kafka_mock_push_request_errors_array(rd_kafka_mock_cluster_t *mcluster,
|
|
166
|
+
int16_t ApiKey,
|
|
167
|
+
size_t cnt,
|
|
168
|
+
const rd_kafka_resp_err_t *errors);
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @brief Apply broker configuration group.initial.rebalance.delay.ms
|
|
173
|
+
* to the whole \p mcluster.
|
|
174
|
+
*/
|
|
175
|
+
RD_EXPORT void rd_kafka_mock_group_initial_rebalance_delay_ms(
|
|
176
|
+
rd_kafka_mock_cluster_t *mcluster,
|
|
177
|
+
int32_t delay_ms);
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @brief Push \p cnt errors and RTT tuples in the \p ... va-arg list onto
|
|
182
|
+
* the broker's error stack for the given \p ApiKey.
|
|
183
|
+
*
|
|
184
|
+
* \p ApiKey is the Kafka protocol request type, e.g., ProduceRequest (0).
|
|
185
|
+
*
|
|
186
|
+
* Each entry is a tuple of:
|
|
187
|
+
* rd_kafka_resp_err_t err - error to return (or 0)
|
|
188
|
+
* int rtt_ms - response RTT/delay in milliseconds (or 0)
|
|
189
|
+
*
|
|
190
|
+
* The following \p cnt protocol requests matching \p ApiKey will fail with the
|
|
191
|
+
* provided error code and removed from the stack, starting with
|
|
192
|
+
* the first error code, then the second, etc.
|
|
193
|
+
*
|
|
194
|
+
* @remark The broker errors take precedence over the cluster errors.
|
|
195
|
+
*/
|
|
196
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
197
|
+
rd_kafka_mock_broker_push_request_error_rtts(rd_kafka_mock_cluster_t *mcluster,
|
|
198
|
+
int32_t broker_id,
|
|
199
|
+
int16_t ApiKey,
|
|
200
|
+
size_t cnt,
|
|
201
|
+
...);
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* @brief Get the count of errors in the broker's error stack for
|
|
207
|
+
* the given \p ApiKey.
|
|
208
|
+
*
|
|
209
|
+
* @param mcluster the mock cluster.
|
|
210
|
+
* @param broker_id id of the broker in the cluster.
|
|
211
|
+
* @param ApiKey is the Kafka protocol request type, e.g., ProduceRequest (0).
|
|
212
|
+
* @param cntp pointer for receiving the count.
|
|
213
|
+
*
|
|
214
|
+
* @returns \c RD_KAFKA_RESP_ERR_NO_ERROR if the count was retrieved,
|
|
215
|
+
* \c RD_KAFKA_RESP_ERR__UNKNOWN_BROKER if there was no broker with this id,
|
|
216
|
+
* \c RD_KAFKA_RESP_ERR__INVALID_ARG if some of the parameters are not valid.
|
|
217
|
+
*/
|
|
218
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
219
|
+
rd_kafka_mock_broker_error_stack_cnt(rd_kafka_mock_cluster_t *mcluster,
|
|
220
|
+
int32_t broker_id,
|
|
221
|
+
int16_t ApiKey,
|
|
222
|
+
size_t *cntp);
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* @brief Push \p cnt errors in the \p ... va-arg list onto the partition's
|
|
226
|
+
* error stack for the given \p ApiKey.
|
|
227
|
+
*
|
|
228
|
+
* \p ApiKey is the Kafka protocol request type, e.g., ProduceRequest (0).
|
|
229
|
+
*
|
|
230
|
+
* The injected errors will be returned as the partition-level ErrorCode,
|
|
231
|
+
* one per request, in the order they were pushed, for requests of type
|
|
232
|
+
* \p ApiKey referencing this partition. Other partitions in the same
|
|
233
|
+
* request are not affected.
|
|
234
|
+
*
|
|
235
|
+
* @remark Cluster errors (rd_kafka_mock_push_request_errors()) and broker
|
|
236
|
+
* errors (rd_kafka_mock_broker_push_request_error_rtts()) take
|
|
237
|
+
* precedence over partition errors.
|
|
238
|
+
*
|
|
239
|
+
* @remark The error codes are not validated against the set of errors
|
|
240
|
+
* the Apache Kafka protocol permits for the given \p ApiKey and
|
|
241
|
+
* response field, that is the test's responsibility.
|
|
242
|
+
*
|
|
243
|
+
* @remark If \p topic does not exist in the mock cluster it is
|
|
244
|
+
* auto-created, same as for the other mock partition APIs.
|
|
245
|
+
*
|
|
246
|
+
* @returns RD_KAFKA_RESP_ERR_NO_ERROR on success, or
|
|
247
|
+
* RD_KAFKA_RESP_ERR_UNKNOWN_TOPIC_OR_PART if \p topic exists
|
|
248
|
+
* and \p partition is out of range.
|
|
249
|
+
*/
|
|
250
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
251
|
+
rd_kafka_mock_partition_push_request_errors(rd_kafka_mock_cluster_t *mcluster,
|
|
252
|
+
const char *topic,
|
|
253
|
+
int32_t partition,
|
|
254
|
+
int16_t ApiKey,
|
|
255
|
+
size_t cnt,
|
|
256
|
+
...);
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* @brief Set the topic error to return in protocol requests.
|
|
261
|
+
*
|
|
262
|
+
* Currently only used for TopicMetadataRequest and AddPartitionsToTxnRequest.
|
|
263
|
+
*/
|
|
264
|
+
RD_EXPORT
|
|
265
|
+
void rd_kafka_mock_topic_set_error(rd_kafka_mock_cluster_t *mcluster,
|
|
266
|
+
const char *topic,
|
|
267
|
+
rd_kafka_resp_err_t err);
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* @brief Creates a topic.
|
|
272
|
+
*
|
|
273
|
+
* This is an alternative to automatic topic creation as performed by
|
|
274
|
+
* the client itself.
|
|
275
|
+
*
|
|
276
|
+
* @remark The Topic Admin API (CreateTopics) is not supported by the
|
|
277
|
+
* mock broker.
|
|
278
|
+
*/
|
|
279
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
280
|
+
rd_kafka_mock_topic_create(rd_kafka_mock_cluster_t *mcluster,
|
|
281
|
+
const char *topic,
|
|
282
|
+
int partition_cnt,
|
|
283
|
+
int replication_factor);
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* @brief Deletes a topic and all its partitions.
|
|
288
|
+
*
|
|
289
|
+
* Subsequent requests referencing the topic will receive
|
|
290
|
+
* UNKNOWN_TOPIC_OR_PARTITION.
|
|
291
|
+
*
|
|
292
|
+
* @param mcluster The mock cluster instance.
|
|
293
|
+
* @param topic The topic to delete.
|
|
294
|
+
*
|
|
295
|
+
* @return RD_KAFKA_RESP_ERR_NO_ERROR on success
|
|
296
|
+
* RD_KAFKA_RESP_ERR_UNKNOWN_TOPIC_OR_PART if the topic does not
|
|
297
|
+
* exist.
|
|
298
|
+
*/
|
|
299
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
300
|
+
rd_kafka_mock_topic_delete(rd_kafka_mock_cluster_t *mcluster,
|
|
301
|
+
const char *topic);
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* @brief Delete records before \p before_offset in \p topic [\p partition].
|
|
306
|
+
*
|
|
307
|
+
* Advances the partition's start offset (log start offset) to
|
|
308
|
+
* \p before_offset and removes all message sets fully before that offset.
|
|
309
|
+
*
|
|
310
|
+
* @param mcluster The mock cluster.
|
|
311
|
+
* @param topic Topic name.
|
|
312
|
+
* @param partition Partition id.
|
|
313
|
+
* @param before_offset Delete all records before this offset.
|
|
314
|
+
* The new start offset will be set to this value.
|
|
315
|
+
*
|
|
316
|
+
* @returns RD_KAFKA_RESP_ERR_NO_ERROR on success,
|
|
317
|
+
* RD_KAFKA_RESP_ERR_UNKNOWN_TOPIC_OR_PART if partition doesn't exist,
|
|
318
|
+
* RD_KAFKA_RESP_ERR_OFFSET_OUT_OF_RANGE if before_offset > end_offset.
|
|
319
|
+
*/
|
|
320
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
321
|
+
rd_kafka_mock_partition_delete_records(rd_kafka_mock_cluster_t *mcluster,
|
|
322
|
+
const char *topic,
|
|
323
|
+
int32_t partition,
|
|
324
|
+
int64_t before_offset);
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* @brief Sets the partition leader.
|
|
329
|
+
*
|
|
330
|
+
* The topic will be created if it does not exist.
|
|
331
|
+
*
|
|
332
|
+
* \p broker_id needs to be an existing broker, or -1 to make the
|
|
333
|
+
* partition leader-less.
|
|
334
|
+
*/
|
|
335
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
336
|
+
rd_kafka_mock_partition_set_leader(rd_kafka_mock_cluster_t *mcluster,
|
|
337
|
+
const char *topic,
|
|
338
|
+
int32_t partition,
|
|
339
|
+
int32_t broker_id);
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* @brief Sets the partition's preferred replica / follower.
|
|
343
|
+
*
|
|
344
|
+
* The topic will be created if it does not exist.
|
|
345
|
+
*
|
|
346
|
+
* \p broker_id does not need to point to an existing broker.
|
|
347
|
+
*/
|
|
348
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
349
|
+
rd_kafka_mock_partition_set_follower(rd_kafka_mock_cluster_t *mcluster,
|
|
350
|
+
const char *topic,
|
|
351
|
+
int32_t partition,
|
|
352
|
+
int32_t broker_id);
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* @brief Sets the partition's preferred replica / follower low and high
|
|
356
|
+
* watermarks.
|
|
357
|
+
*
|
|
358
|
+
* The topic will be created if it does not exist.
|
|
359
|
+
*
|
|
360
|
+
* Setting an offset to -1 will revert back to the leader's corresponding
|
|
361
|
+
* watermark.
|
|
362
|
+
*/
|
|
363
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
364
|
+
rd_kafka_mock_partition_set_follower_wmarks(rd_kafka_mock_cluster_t *mcluster,
|
|
365
|
+
const char *topic,
|
|
366
|
+
int32_t partition,
|
|
367
|
+
int64_t lo,
|
|
368
|
+
int64_t hi);
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* @brief Push \p cnt Metadata leader response
|
|
372
|
+
* onto the cluster's stack for the given \p topic and \p partition.
|
|
373
|
+
*
|
|
374
|
+
* @param topic Topic to change
|
|
375
|
+
* @param partition Partition to change in \p topic
|
|
376
|
+
* @param leader_id Broker id of the leader node
|
|
377
|
+
* @param leader_epoch Leader epoch corresponding to the given \p leader_id
|
|
378
|
+
*
|
|
379
|
+
* @return Push operation error code
|
|
380
|
+
*/
|
|
381
|
+
RD_EXPORT
|
|
382
|
+
rd_kafka_resp_err_t
|
|
383
|
+
rd_kafka_mock_partition_push_leader_response(rd_kafka_mock_cluster_t *mcluster,
|
|
384
|
+
const char *topic,
|
|
385
|
+
int partition,
|
|
386
|
+
int32_t leader_id,
|
|
387
|
+
int32_t leader_epoch);
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* @brief Disconnects the broker and disallows any new connections.
|
|
391
|
+
* This does NOT trigger leader change.
|
|
392
|
+
*
|
|
393
|
+
* @param mcluster Mock cluster instance.
|
|
394
|
+
* @param broker_id Use -1 for all brokers, or >= 0 for a specific broker.
|
|
395
|
+
*/
|
|
396
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
397
|
+
rd_kafka_mock_broker_set_down(rd_kafka_mock_cluster_t *mcluster,
|
|
398
|
+
int32_t broker_id);
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* @brief Sets a new \p host and \p port for a given broker identified by
|
|
402
|
+
* \p broker_id.
|
|
403
|
+
*
|
|
404
|
+
* @param mcluster Mock cluster instance.
|
|
405
|
+
* @param broker_id The id of the broker to modify.
|
|
406
|
+
* @param host The new hostname.
|
|
407
|
+
* @param port The new port.
|
|
408
|
+
*/
|
|
409
|
+
RD_EXPORT void
|
|
410
|
+
rd_kafka_mock_broker_set_host_port(rd_kafka_mock_cluster_t *mcluster,
|
|
411
|
+
int32_t broker_id,
|
|
412
|
+
const char *host,
|
|
413
|
+
int port);
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* @brief Makes the broker accept connections again.
|
|
418
|
+
* This does NOT trigger leader change.
|
|
419
|
+
*
|
|
420
|
+
* @param mcluster Mock cluster instance.
|
|
421
|
+
* @param broker_id Use -1 for all brokers, or >= 0 for a specific broker.
|
|
422
|
+
*/
|
|
423
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
424
|
+
rd_kafka_mock_broker_set_up(rd_kafka_mock_cluster_t *mcluster,
|
|
425
|
+
int32_t broker_id);
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* @brief Set broker round-trip-time delay in milliseconds.
|
|
430
|
+
*
|
|
431
|
+
* @param mcluster Mock cluster instance.
|
|
432
|
+
* @param broker_id Use -1 for all brokers, or >= 0 for a specific broker.
|
|
433
|
+
*/
|
|
434
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
435
|
+
rd_kafka_mock_broker_set_rtt(rd_kafka_mock_cluster_t *mcluster,
|
|
436
|
+
int32_t broker_id,
|
|
437
|
+
int rtt_ms);
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* @brief Sets the broker's rack as reported in Metadata to the client.
|
|
441
|
+
*
|
|
442
|
+
* @param mcluster Mock cluster instance.
|
|
443
|
+
* @param broker_id Use -1 for all brokers, or >= 0 for a specific broker.
|
|
444
|
+
*/
|
|
445
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
446
|
+
rd_kafka_mock_broker_set_rack(rd_kafka_mock_cluster_t *mcluster,
|
|
447
|
+
int32_t broker_id,
|
|
448
|
+
const char *rack);
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* @brief Remove and delete a mock broker from a cluster.
|
|
454
|
+
* All partitions assigned to that broker will be
|
|
455
|
+
* reassigned to other brokers.
|
|
456
|
+
*
|
|
457
|
+
* @param cluster The mock cluster containing the broker
|
|
458
|
+
* @param broker_id The broker to delete
|
|
459
|
+
* @returns 0 on success or -1 on error
|
|
460
|
+
*/
|
|
461
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
462
|
+
rd_kafka_mock_broker_decommission(rd_kafka_mock_cluster_t *cluster,
|
|
463
|
+
int32_t broker_id);
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* @brief Hide the broker from Metadata responses without dropping its
|
|
467
|
+
* existing TCP connections or its listen socket.
|
|
468
|
+
*
|
|
469
|
+
* Unlike rd_kafka_mock_broker_decommission(), the broker's connections
|
|
470
|
+
* stay alive so any in-flight requests can still complete on the
|
|
471
|
+
* broker side. The broker is removed from cluster metadata responses
|
|
472
|
+
* and partitions are reassigned away from it. This lets a client's
|
|
473
|
+
* metadata-driven decommission path observe the broker's removal
|
|
474
|
+
* and fail in-flight requests with __DESTROY_BROKER, instead of
|
|
475
|
+
* the connection-drop path failing them with __TRANSPORT.
|
|
476
|
+
*
|
|
477
|
+
* The broker remains in the cluster's broker list; its struct is
|
|
478
|
+
* not freed until the cluster is destroyed (or the broker is added
|
|
479
|
+
* back via the appropriate API in the future).
|
|
480
|
+
*
|
|
481
|
+
* @param mcluster The mock cluster.
|
|
482
|
+
* @param broker_id The broker to hide from metadata.
|
|
483
|
+
*
|
|
484
|
+
* @returns Error value or 0 if no error occurred.
|
|
485
|
+
*/
|
|
486
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
487
|
+
rd_kafka_mock_broker_remove_from_metadata(rd_kafka_mock_cluster_t *mcluster,
|
|
488
|
+
int32_t broker_id);
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* @brief Add a new broker to the cluster.
|
|
492
|
+
* Cluster partition will be reassigned to use the new broker
|
|
493
|
+
* as well.
|
|
494
|
+
*
|
|
495
|
+
* @param mcluster The mock cluster
|
|
496
|
+
* @param broker_id The id of the broker to add
|
|
497
|
+
*
|
|
498
|
+
* @returns Error value or 0 if no error occurred
|
|
499
|
+
*/
|
|
500
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
501
|
+
rd_kafka_mock_broker_add(rd_kafka_mock_cluster_t *mcluster, int32_t broker_id);
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* @brief Explicitly sets the coordinator. If this API is not a standard
|
|
506
|
+
* hashing scheme will be used.
|
|
507
|
+
*
|
|
508
|
+
* @param key_type "transaction" or "group"
|
|
509
|
+
* @param key The transactional.id or group.id
|
|
510
|
+
* @param broker_id The new coordinator, does not have to be a valid broker.
|
|
511
|
+
*/
|
|
512
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
513
|
+
rd_kafka_mock_coordinator_set(rd_kafka_mock_cluster_t *mcluster,
|
|
514
|
+
const char *key_type,
|
|
515
|
+
const char *key,
|
|
516
|
+
int32_t broker_id);
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* @brief Set the allowed ApiVersion range for \p ApiKey.
|
|
522
|
+
*
|
|
523
|
+
* Set \p MinVersion and \p MaxVersion to -1 to disable the API
|
|
524
|
+
* completely.
|
|
525
|
+
*
|
|
526
|
+
* \p MaxVersion MUST not exceed the maximum implemented value,
|
|
527
|
+
* see rdkafka_mock_handlers.c.
|
|
528
|
+
*
|
|
529
|
+
* @param ApiKey Protocol request type/key
|
|
530
|
+
* @param MinVersion Minimum version supported (or -1 to disable).
|
|
531
|
+
* @param MinVersion Maximum version supported (or -1 to disable).
|
|
532
|
+
*/
|
|
533
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
534
|
+
rd_kafka_mock_set_apiversion(rd_kafka_mock_cluster_t *mcluster,
|
|
535
|
+
int16_t ApiKey,
|
|
536
|
+
int16_t MinVersion,
|
|
537
|
+
int16_t MaxVersion);
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* @brief Start tracking RPC requests for this mock cluster.
|
|
541
|
+
* @sa rd_kafka_mock_get_requests to get the requests.
|
|
542
|
+
*/
|
|
543
|
+
RD_EXPORT
|
|
544
|
+
void rd_kafka_mock_start_request_tracking(rd_kafka_mock_cluster_t *mcluster);
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* @brief Stop tracking RPC requests for this mock cluster.
|
|
548
|
+
* Does not clear already tracked requests.
|
|
549
|
+
*/
|
|
550
|
+
RD_EXPORT
|
|
551
|
+
void rd_kafka_mock_stop_request_tracking(rd_kafka_mock_cluster_t *mcluster);
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* @name Represents a request to the mock cluster along with a timestamp.
|
|
555
|
+
*/
|
|
556
|
+
typedef struct rd_kafka_mock_request_s rd_kafka_mock_request_t;
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* @brief Destroy a rd_kafka_mock_request_t * and deallocate memory.
|
|
560
|
+
*/
|
|
561
|
+
RD_EXPORT void rd_kafka_mock_request_destroy(rd_kafka_mock_request_t *mreq);
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* @brief Destroy a rd_kafka_mock_request_t * array and deallocate it.
|
|
565
|
+
*/
|
|
566
|
+
RD_EXPORT void
|
|
567
|
+
rd_kafka_mock_request_destroy_array(rd_kafka_mock_request_t **mreqs,
|
|
568
|
+
size_t mreq_cnt);
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* @brief Get the broker id to which \p mreq was sent.
|
|
572
|
+
*/
|
|
573
|
+
RD_EXPORT int32_t rd_kafka_mock_request_id(rd_kafka_mock_request_t *mreq);
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* @brief Get the ApiKey with which \p mreq was sent.
|
|
577
|
+
*/
|
|
578
|
+
RD_EXPORT int16_t rd_kafka_mock_request_api_key(rd_kafka_mock_request_t *mreq);
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* @brief Get the timestamp in micros at which \p mreq was sent.
|
|
582
|
+
*/
|
|
583
|
+
RD_EXPORT int64_t
|
|
584
|
+
rd_kafka_mock_request_timestamp(rd_kafka_mock_request_t *mreq);
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* @brief Get the list of requests sent to this mock cluster.
|
|
588
|
+
*
|
|
589
|
+
* @param cntp is set to the count of requests.
|
|
590
|
+
* @return List of rd_kafka_mock_request_t *.
|
|
591
|
+
* @remark each element of the returned array must be freed with
|
|
592
|
+
* rd_kafka_mock_request_destroy, and the list itself must be freed too.
|
|
593
|
+
*/
|
|
594
|
+
RD_EXPORT rd_kafka_mock_request_t **
|
|
595
|
+
rd_kafka_mock_get_requests(rd_kafka_mock_cluster_t *mcluster, size_t *cntp);
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* @brief Clear the list of requests sent to this mock broker, in case request
|
|
599
|
+
* tracking is/was turned on.
|
|
600
|
+
*/
|
|
601
|
+
RD_EXPORT void rd_kafka_mock_clear_requests(rd_kafka_mock_cluster_t *mcluster);
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* @brief Set the metrics that are expected by the broker for telemetry
|
|
605
|
+
* collection.
|
|
606
|
+
*
|
|
607
|
+
* @param metrics List of prefixes of metric names or NULL.
|
|
608
|
+
* @param metrics_cnt
|
|
609
|
+
*
|
|
610
|
+
* @note if \p metrics is NULL, no metrics will be expected by the broker. If
|
|
611
|
+
* the first elements of \p metrics is an empty string, that indicates the
|
|
612
|
+
* broker expects all metrics.
|
|
613
|
+
*/
|
|
614
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
615
|
+
rd_kafka_mock_telemetry_set_requested_metrics(rd_kafka_mock_cluster_t *mcluster,
|
|
616
|
+
char **metrics,
|
|
617
|
+
size_t metrics_cnt);
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* @brief Set push frequency to be sent to the client for telemetry collection.
|
|
622
|
+
* when the broker receives GetTelemetrySubscription requests.
|
|
623
|
+
*
|
|
624
|
+
* @param push_interval_ms time for push in milliseconds. Must be more than 0.
|
|
625
|
+
*/
|
|
626
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
627
|
+
rd_kafka_mock_telemetry_set_push_interval(rd_kafka_mock_cluster_t *mcluster,
|
|
628
|
+
int64_t push_interval_ms);
|
|
629
|
+
|
|
630
|
+
typedef struct rd_kafka_mock_cgrp_consumer_target_assignment_s
|
|
631
|
+
rd_kafka_mock_cgrp_consumer_target_assignment_t;
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* @brief Create a new target assignment for \p member_cnt members
|
|
635
|
+
* given a member id and a member assignment for each member `i`,
|
|
636
|
+
* specified in \p member_ids[i] and \p assignment[i].
|
|
637
|
+
*
|
|
638
|
+
* @remark used for mocking target assignment
|
|
639
|
+
* in KIP-848 consumer group protocol.
|
|
640
|
+
*
|
|
641
|
+
* @param member_ids Array of member ids of size \p member_cnt.
|
|
642
|
+
* @param member_cnt Number of members.
|
|
643
|
+
* @param assignment Array of (rd_kafka_topic_partition_list_t *) of size \p
|
|
644
|
+
* member_cnt.
|
|
645
|
+
*/
|
|
646
|
+
RD_EXPORT rd_kafka_mock_cgrp_consumer_target_assignment_t *
|
|
647
|
+
rd_kafka_mock_cgrp_consumer_target_assignment_new(
|
|
648
|
+
char **member_ids,
|
|
649
|
+
int member_cnt,
|
|
650
|
+
rd_kafka_topic_partition_list_t **assignment);
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* @brief Destroy target assignment \p target_assignment .
|
|
654
|
+
*/
|
|
655
|
+
RD_EXPORT void rd_kafka_mock_cgrp_consumer_target_assignment_destroy(
|
|
656
|
+
rd_kafka_mock_cgrp_consumer_target_assignment_t *target_assignment);
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* @brief Sets next target assignment for the group
|
|
660
|
+
* identified by \p group_id to the
|
|
661
|
+
* target assignment contained in \p target_assignment,
|
|
662
|
+
* in the cluster \p mcluster.
|
|
663
|
+
*
|
|
664
|
+
* @remark used for mocking target assignment
|
|
665
|
+
* in KIP-848 consumer group protocol.
|
|
666
|
+
*
|
|
667
|
+
* @param mcluster Mock cluster instance.
|
|
668
|
+
* @param group_id Group id.
|
|
669
|
+
* @param target_assignment Target assignment for all the members.
|
|
670
|
+
*/
|
|
671
|
+
RD_EXPORT void rd_kafka_mock_cgrp_consumer_target_assignment(
|
|
672
|
+
rd_kafka_mock_cluster_t *mcluster,
|
|
673
|
+
const char *group_id,
|
|
674
|
+
rd_kafka_mock_cgrp_consumer_target_assignment_t *target_assignment);
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* @brief Sets group.consumer.session.timeout.ms
|
|
678
|
+
* for the cluster \p mcluster to \p group_consumer_session_timeout_ms.
|
|
679
|
+
*
|
|
680
|
+
* @remark used in KIP-848 consumer group protocol.
|
|
681
|
+
*
|
|
682
|
+
* @param mcluster Mock cluster instance.
|
|
683
|
+
* @param group_consumer_session_timeout_ms Session timeout in milliseconds.
|
|
684
|
+
*/
|
|
685
|
+
RD_EXPORT void rd_kafka_mock_set_group_consumer_session_timeout_ms(
|
|
686
|
+
rd_kafka_mock_cluster_t *mcluster,
|
|
687
|
+
int group_consumer_session_timeout_ms);
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* @brief Sets group.consumer.heartbeat.interval.ms
|
|
691
|
+
* for the cluster \p mcluster to \p
|
|
692
|
+
* group_consumer_heartbeat_interval_ms.
|
|
693
|
+
*
|
|
694
|
+
* @remark used in KIP-848 consumer group protocol.
|
|
695
|
+
*
|
|
696
|
+
* @param mcluster Mock cluster instance.
|
|
697
|
+
* @param group_consumer_heartbeat_interval_ms Heartbeat interval in
|
|
698
|
+
* milliseconds.
|
|
699
|
+
*/
|
|
700
|
+
RD_EXPORT void rd_kafka_mock_set_group_consumer_heartbeat_interval_ms(
|
|
701
|
+
rd_kafka_mock_cluster_t *mcluster,
|
|
702
|
+
int group_consumer_heartbeat_interval_ms);
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* @brief Set the sharegroup session timeout in milliseconds.
|
|
706
|
+
*
|
|
707
|
+
* @param mcluster Mock cluster instance.
|
|
708
|
+
* @param session_timeout_ms Session timeout in milliseconds.
|
|
709
|
+
*/
|
|
710
|
+
RD_EXPORT void
|
|
711
|
+
rd_kafka_mock_sharegroup_set_session_timeout(rd_kafka_mock_cluster_t *mcluster,
|
|
712
|
+
int session_timeout_ms);
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* @brief Set the sharegroup heartbeat interval in milliseconds.
|
|
716
|
+
*
|
|
717
|
+
* @param mcluster Mock cluster instance.
|
|
718
|
+
* @param heartbeat_interval_ms Heartbeat interval in milliseconds.
|
|
719
|
+
*/
|
|
720
|
+
RD_EXPORT void rd_kafka_mock_sharegroup_set_heartbeat_interval(
|
|
721
|
+
rd_kafka_mock_cluster_t *mcluster,
|
|
722
|
+
int heartbeat_interval_ms);
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* @brief Set the maximum number of times a record can be acquired
|
|
726
|
+
* before it is automatically archived (dead-lettered).
|
|
727
|
+
*
|
|
728
|
+
* Default is 5. Set to 0 for unlimited deliveries.
|
|
729
|
+
*
|
|
730
|
+
* @param mcluster Mock cluster instance.
|
|
731
|
+
* @param max_attempts Maximum delivery attempts per record.
|
|
732
|
+
*/
|
|
733
|
+
RD_EXPORT void rd_kafka_mock_sharegroup_set_max_delivery_attempts(
|
|
734
|
+
rd_kafka_mock_cluster_t *mcluster,
|
|
735
|
+
int max_attempts);
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* @brief Set the per-record lock duration in milliseconds.
|
|
739
|
+
*
|
|
740
|
+
* When a record is acquired, its lock expires after this duration.
|
|
741
|
+
* Default is 0, which falls back to the session timeout value.
|
|
742
|
+
*
|
|
743
|
+
* @param mcluster Mock cluster instance.
|
|
744
|
+
* @param lock_duration_ms Lock duration in milliseconds.
|
|
745
|
+
*/
|
|
746
|
+
RD_EXPORT void rd_kafka_mock_sharegroup_set_record_lock_duration(
|
|
747
|
+
rd_kafka_mock_cluster_t *mcluster,
|
|
748
|
+
int lock_duration_ms);
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* @brief Set the share group isolation level for transactions.
|
|
752
|
+
*
|
|
753
|
+
* Controls how the share group handles transactional records:
|
|
754
|
+
* 0 = read_uncommitted (default) — reads up to HWM, no filtering
|
|
755
|
+
* 1 = read_committed — reads up to LSO, filters aborted transaction data
|
|
756
|
+
*
|
|
757
|
+
* @param mcluster Mock cluster instance.
|
|
758
|
+
* @param level Isolation level (0 or 1).
|
|
759
|
+
*/
|
|
760
|
+
RD_EXPORT void
|
|
761
|
+
rd_kafka_mock_sharegroup_set_isolation_level(rd_kafka_mock_cluster_t *mcluster,
|
|
762
|
+
int level);
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* @brief Set the maximum number of members allowed in a share group.
|
|
766
|
+
*
|
|
767
|
+
* New members attempting to join via ShareGroupHeartbeat when the group
|
|
768
|
+
* is at capacity will receive GROUP_MAX_SIZE_REACHED.
|
|
769
|
+
*
|
|
770
|
+
* Default is 0 (unlimited).
|
|
771
|
+
*
|
|
772
|
+
* @param mcluster Mock cluster instance.
|
|
773
|
+
* @param max_size Maximum members allowed. 0 = unlimited.
|
|
774
|
+
*/
|
|
775
|
+
RD_EXPORT void
|
|
776
|
+
rd_kafka_mock_sharegroup_set_max_size(rd_kafka_mock_cluster_t *mcluster,
|
|
777
|
+
int max_size);
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* @brief Set the maximum number of fetch sessions allowed per broker.
|
|
781
|
+
*
|
|
782
|
+
* New sessions attempted via ShareFetch with epoch 0 when the broker
|
|
783
|
+
* is at capacity will receive SHARE_SESSION_LIMIT_REACHED.
|
|
784
|
+
*
|
|
785
|
+
* Default is 2000 (group.share.max.share.sessions).
|
|
786
|
+
*
|
|
787
|
+
* @param mcluster Mock cluster instance.
|
|
788
|
+
* @param max_fetch_sessions Maximum fetch sessions per broker. 0 = unlimited.
|
|
789
|
+
*/
|
|
790
|
+
RD_EXPORT void rd_kafka_mock_sharegroup_set_max_fetch_sessions(
|
|
791
|
+
rd_kafka_mock_cluster_t *mcluster,
|
|
792
|
+
int max_fetch_sessions);
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* @brief Set the maximum number of in-flight record locks per share-partition.
|
|
796
|
+
*
|
|
797
|
+
* Once the limit is reached, no more records are acquired until existing
|
|
798
|
+
* locks are released (via ack, release, reject, or lock expiry).
|
|
799
|
+
*
|
|
800
|
+
* Default is 2000 (group.share.partition.max.record.locks).
|
|
801
|
+
*
|
|
802
|
+
* @param mcluster Mock cluster instance.
|
|
803
|
+
* @param max_record_locks Maximum in-flight records per partition. 0 =
|
|
804
|
+
* unlimited.
|
|
805
|
+
*/
|
|
806
|
+
RD_EXPORT void
|
|
807
|
+
rd_kafka_mock_sharegroup_set_max_record_locks(rd_kafka_mock_cluster_t *mcluster,
|
|
808
|
+
int max_record_locks);
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* @brief Set the auto offset reset policy for share groups.
|
|
812
|
+
*
|
|
813
|
+
* Controls where SPSO is initialized when a share-partition is first
|
|
814
|
+
* consumed.
|
|
815
|
+
*
|
|
816
|
+
* Default is 0 ("latest").
|
|
817
|
+
*
|
|
818
|
+
* @param mcluster Mock cluster instance.
|
|
819
|
+
* @param auto_offset_reset 0 = latest, 1 = earliest.
|
|
820
|
+
*/
|
|
821
|
+
RD_EXPORT void rd_kafka_mock_sharegroup_set_auto_offset_reset(
|
|
822
|
+
rd_kafka_mock_cluster_t *mcluster,
|
|
823
|
+
int auto_offset_reset);
|
|
824
|
+
|
|
825
|
+
/**
|
|
826
|
+
* @brief Set a manual target assignment for a sharegroup.
|
|
827
|
+
*
|
|
828
|
+
* This allows tests to override the automatic partition assignment
|
|
829
|
+
* and manually specify which partitions each member should get.
|
|
830
|
+
*
|
|
831
|
+
* @param mcluster Mock cluster instance.
|
|
832
|
+
* @param group_id The sharegroup ID.
|
|
833
|
+
* @param member_ids Array of member IDs (strings).
|
|
834
|
+
* @param assignments Array of partition lists (one per member).
|
|
835
|
+
* @param member_cnt Number of members (length of both arrays).
|
|
836
|
+
*/
|
|
837
|
+
RD_EXPORT void rd_kafka_mock_sharegroup_target_assignment(
|
|
838
|
+
rd_kafka_mock_cluster_t *mcluster,
|
|
839
|
+
const char *group_id,
|
|
840
|
+
const char **member_ids,
|
|
841
|
+
rd_kafka_topic_partition_list_t **assignments,
|
|
842
|
+
size_t member_cnt);
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* @brief Retrieve the member IDs from a sharegroup.
|
|
846
|
+
*
|
|
847
|
+
* @param mcluster Mock cluster instance.
|
|
848
|
+
* @param group_id The sharegroup ID.
|
|
849
|
+
* @param member_ids_out Output array of member IDs. Caller must free each
|
|
850
|
+
* string with rd_free() and the array itself.
|
|
851
|
+
* @param member_cnt_out Output count of members.
|
|
852
|
+
*
|
|
853
|
+
* @returns RD_KAFKA_RESP_ERR_NO_ERROR on success,
|
|
854
|
+
* RD_KAFKA_RESP_ERR_GROUP_ID_NOT_FOUND if sharegroup not found.
|
|
855
|
+
*/
|
|
856
|
+
RD_EXPORT rd_kafka_resp_err_t
|
|
857
|
+
rd_kafka_mock_sharegroup_get_member_ids(rd_kafka_mock_cluster_t *mcluster,
|
|
858
|
+
const char *group_id,
|
|
859
|
+
char ***member_ids_out,
|
|
860
|
+
size_t *member_cnt_out);
|
|
861
|
+
|
|
862
|
+
/**@}*/
|
|
863
|
+
|
|
864
|
+
#ifdef __cplusplus
|
|
865
|
+
}
|
|
866
|
+
#endif
|
|
867
|
+
#endif /* _RDKAFKA_MOCK_H_ */
|