@platformatic/kafka 2.0.1 → 2.2.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/README.md +4 -1
- package/dist/apis/admin/alter-client-quotas-v0.d.ts +40 -0
- package/dist/apis/admin/alter-client-quotas-v0.js +60 -0
- package/dist/apis/admin/alter-client-quotas-v1.d.ts +6 -5
- package/dist/apis/admin/alter-client-quotas-v1.js +3 -1
- package/dist/apis/admin/alter-configs-v0.d.ts +7 -0
- package/dist/apis/admin/alter-configs-v0.js +10 -0
- package/dist/apis/admin/alter-configs-v1.d.ts +2 -0
- package/dist/apis/admin/alter-configs-v1.js +5 -0
- package/dist/apis/admin/alter-configs-v2.js +3 -1
- package/dist/apis/admin/alter-partition-reassignments-v0.d.ts +3 -2
- package/dist/apis/admin/alter-partition-reassignments-v0.js +4 -1
- package/dist/apis/admin/alter-partition-reassignments-v1.d.ts +6 -4
- package/dist/apis/admin/alter-partition-reassignments-v1.js +7 -3
- package/dist/apis/admin/alter-partition-v0.d.ts +40 -0
- package/dist/apis/admin/alter-partition-v0.js +81 -0
- package/dist/apis/admin/alter-partition-v1.d.ts +37 -0
- package/dist/apis/admin/alter-partition-v1.js +84 -0
- package/dist/apis/admin/alter-partition-v2.d.ts +36 -0
- package/dist/apis/admin/alter-partition-v2.js +83 -0
- package/dist/apis/admin/alter-partition-v3.d.ts +6 -35
- package/dist/apis/admin/alter-partition-v3.js +10 -8
- package/dist/apis/admin/alter-replica-log-dirs-v0.d.ts +23 -0
- package/dist/apis/admin/alter-replica-log-dirs-v0.js +29 -0
- package/dist/apis/admin/alter-replica-log-dirs-v1.d.ts +4 -0
- package/dist/apis/admin/alter-replica-log-dirs-v1.js +8 -0
- package/dist/apis/admin/alter-replica-log-dirs-v2.d.ts +1 -1
- package/dist/apis/admin/alter-replica-log-dirs-v2.js +1 -0
- package/dist/apis/admin/alter-user-scram-credentials-v0.js +1 -1
- package/dist/apis/admin/client-quotas.d.ts +2 -0
- package/dist/apis/admin/client-quotas.js +1 -0
- package/dist/apis/admin/consumer-group-describe-v0.d.ts +2 -1
- package/dist/apis/admin/consumer-group-describe-v0.js +51 -30
- package/dist/apis/admin/create-acls-v0.d.ts +16 -0
- package/dist/apis/admin/create-acls-v0.js +10 -0
- package/dist/apis/admin/create-acls-v1.d.ts +15 -0
- package/dist/apis/admin/create-acls-v1.js +10 -0
- package/dist/apis/admin/create-acls-v2.js +1 -0
- package/dist/apis/admin/create-acls-v3.js +1 -0
- package/dist/apis/admin/create-delegation-token-v0.d.ts +24 -0
- package/dist/apis/admin/create-delegation-token-v0.js +47 -0
- package/dist/apis/admin/create-delegation-token-v1.d.ts +4 -0
- package/dist/apis/admin/create-delegation-token-v1.js +8 -0
- package/dist/apis/admin/create-delegation-token-v2.d.ts +9 -0
- package/dist/apis/admin/create-delegation-token-v2.js +30 -0
- package/dist/apis/admin/create-delegation-token-v3.js +1 -0
- package/dist/apis/admin/create-partitions-v0.d.ts +2 -0
- package/dist/apis/admin/create-partitions-v0.js +5 -0
- package/dist/apis/admin/create-partitions-v1.d.ts +2 -2
- package/dist/apis/admin/create-partitions-v1.js +5 -5
- package/dist/apis/admin/create-partitions-v2.d.ts +2 -2
- package/dist/apis/admin/create-partitions-v2.js +1 -0
- package/dist/apis/admin/create-partitions-v3.js +1 -0
- package/dist/apis/admin/create-topics-v0.d.ts +42 -0
- package/dist/apis/admin/create-topics-v0.js +63 -0
- package/dist/apis/admin/create-topics-v1.d.ts +42 -0
- package/dist/apis/admin/create-topics-v1.js +65 -0
- package/dist/apis/admin/create-topics-v2.d.ts +42 -0
- package/dist/apis/admin/create-topics-v2.js +66 -0
- package/dist/apis/admin/create-topics-v3.d.ts +42 -0
- package/dist/apis/admin/create-topics-v3.js +66 -0
- package/dist/apis/admin/create-topics-v4.d.ts +42 -0
- package/dist/apis/admin/create-topics-v4.js +66 -0
- package/dist/apis/admin/create-topics-v5.d.ts +42 -0
- package/dist/apis/admin/create-topics-v5.js +88 -0
- package/dist/apis/admin/create-topics-v6.d.ts +42 -0
- package/dist/apis/admin/create-topics-v6.js +88 -0
- package/dist/apis/admin/create-topics-v7.d.ts +2 -1
- package/dist/apis/admin/create-topics-v7.js +20 -5
- package/dist/apis/admin/delete-acls-v0.d.ts +28 -0
- package/dist/apis/admin/delete-acls-v0.js +12 -0
- package/dist/apis/admin/delete-acls-v1.d.ts +27 -0
- package/dist/apis/admin/delete-acls-v1.js +11 -0
- package/dist/apis/admin/delete-acls-v2.js +5 -2
- package/dist/apis/admin/delete-acls-v3.js +1 -0
- package/dist/apis/admin/delete-groups-v0.d.ts +14 -0
- package/dist/apis/admin/delete-groups-v0.js +38 -0
- package/dist/apis/admin/delete-groups-v1.d.ts +14 -0
- package/dist/apis/admin/delete-groups-v1.js +38 -0
- package/dist/apis/admin/delete-groups-v2.js +1 -0
- package/dist/apis/admin/delete-records-v0.d.ts +27 -0
- package/dist/apis/admin/delete-records-v0.js +50 -0
- package/dist/apis/admin/delete-records-v1.d.ts +27 -0
- package/dist/apis/admin/delete-records-v1.js +50 -0
- package/dist/apis/admin/delete-records-v2.js +1 -0
- package/dist/apis/admin/delete-topics-v0.d.ts +19 -0
- package/dist/apis/admin/delete-topics-v0.js +39 -0
- package/dist/apis/admin/delete-topics-v1.d.ts +19 -0
- package/dist/apis/admin/delete-topics-v1.js +37 -0
- package/dist/apis/admin/delete-topics-v2.d.ts +19 -0
- package/dist/apis/admin/delete-topics-v2.js +37 -0
- package/dist/apis/admin/delete-topics-v3.d.ts +19 -0
- package/dist/apis/admin/delete-topics-v3.js +37 -0
- package/dist/apis/admin/delete-topics-v4.d.ts +19 -0
- package/dist/apis/admin/delete-topics-v4.js +41 -0
- package/dist/apis/admin/delete-topics-v5.d.ts +19 -0
- package/dist/apis/admin/delete-topics-v5.js +45 -0
- package/dist/apis/admin/delete-topics-v6.d.ts +1 -1
- package/dist/apis/admin/delete-topics-v6.js +5 -1
- package/dist/apis/admin/describe-acls-v0.d.ts +21 -0
- package/dist/apis/admin/describe-acls-v0.js +19 -0
- package/dist/apis/admin/describe-acls-v1.d.ts +21 -0
- package/dist/apis/admin/describe-acls-v1.js +18 -0
- package/dist/apis/admin/describe-acls-v2.js +1 -0
- package/dist/apis/admin/describe-acls-v3.js +1 -0
- package/dist/apis/admin/describe-client-quotas-v0.d.ts +8 -7
- package/dist/apis/admin/describe-client-quotas-v0.js +28 -25
- package/dist/apis/admin/describe-client-quotas-v1.d.ts +9 -0
- package/dist/apis/admin/describe-client-quotas-v1.js +34 -0
- package/dist/apis/admin/describe-cluster-v0.d.ts +4 -3
- package/dist/apis/admin/describe-cluster-v0.js +3 -1
- package/dist/apis/admin/describe-cluster-v1.d.ts +4 -3
- package/dist/apis/admin/describe-cluster-v1.js +1 -0
- package/dist/apis/admin/describe-configs-v0.d.ts +41 -0
- package/dist/apis/admin/describe-configs-v0.js +72 -0
- package/dist/apis/admin/describe-configs-v1.d.ts +39 -0
- package/dist/apis/admin/describe-configs-v1.js +81 -0
- package/dist/apis/admin/describe-configs-v2.d.ts +9 -8
- package/dist/apis/admin/describe-configs-v2.js +10 -14
- package/dist/apis/admin/describe-configs-v3.d.ts +9 -8
- package/dist/apis/admin/describe-configs-v3.js +7 -7
- package/dist/apis/admin/describe-configs-v4.d.ts +2 -2
- package/dist/apis/admin/describe-configs-v4.js +14 -7
- package/dist/apis/admin/describe-delegation-token-v0.d.ts +31 -0
- package/dist/apis/admin/describe-delegation-token-v0.js +51 -0
- package/dist/apis/admin/describe-delegation-token-v1.d.ts +4 -0
- package/dist/apis/admin/describe-delegation-token-v1.js +8 -0
- package/dist/apis/admin/describe-delegation-token-v2.d.ts +8 -0
- package/dist/apis/admin/describe-delegation-token-v2.js +32 -0
- package/dist/apis/admin/describe-delegation-token-v3.d.ts +4 -27
- package/dist/apis/admin/describe-delegation-token-v3.js +1 -0
- package/dist/apis/admin/describe-groups-v0.d.ts +28 -0
- package/dist/apis/admin/describe-groups-v0.js +60 -0
- package/dist/apis/admin/describe-groups-v1.d.ts +28 -0
- package/dist/apis/admin/describe-groups-v1.js +62 -0
- package/dist/apis/admin/describe-groups-v2.d.ts +28 -0
- package/dist/apis/admin/describe-groups-v2.js +62 -0
- package/dist/apis/admin/describe-groups-v3.d.ts +28 -0
- package/dist/apis/admin/describe-groups-v3.js +64 -0
- package/dist/apis/admin/describe-groups-v4.d.ts +28 -0
- package/dist/apis/admin/describe-groups-v4.js +64 -0
- package/dist/apis/admin/describe-groups-v5.js +1 -0
- package/dist/apis/admin/describe-log-dirs-v0.d.ts +30 -0
- package/dist/apis/admin/describe-log-dirs-v0.js +39 -0
- package/dist/apis/admin/describe-log-dirs-v1.d.ts +4 -0
- package/dist/apis/admin/describe-log-dirs-v1.js +8 -0
- package/dist/apis/admin/describe-log-dirs-v2.d.ts +3 -2
- package/dist/apis/admin/describe-log-dirs-v2.js +9 -5
- package/dist/apis/admin/describe-log-dirs-v3.d.ts +3 -2
- package/dist/apis/admin/describe-log-dirs-v3.js +3 -2
- package/dist/apis/admin/describe-log-dirs-v4.d.ts +3 -2
- package/dist/apis/admin/describe-log-dirs-v4.js +1 -0
- package/dist/apis/admin/describe-producers-v0.js +1 -0
- package/dist/apis/admin/describe-quorum-v0.d.ts +13 -0
- package/dist/apis/admin/describe-quorum-v0.js +85 -0
- package/dist/apis/admin/describe-quorum-v1.d.ts +13 -0
- package/dist/apis/admin/describe-quorum-v1.js +84 -0
- package/dist/apis/admin/describe-quorum-v2.js +1 -0
- package/dist/apis/admin/describe-topic-partitions-v0.d.ts +3 -3
- package/dist/apis/admin/describe-topic-partitions-v0.js +5 -2
- package/dist/apis/admin/describe-transactions-v0.js +1 -0
- package/dist/apis/admin/describe-user-scram-credentials-v0.d.ts +4 -3
- package/dist/apis/admin/describe-user-scram-credentials-v0.js +1 -0
- package/dist/apis/admin/envelope-v0.js +1 -0
- package/dist/apis/admin/expire-delegation-token-v0.d.ts +11 -0
- package/dist/apis/admin/expire-delegation-token-v0.js +29 -0
- package/dist/apis/admin/expire-delegation-token-v1.d.ts +4 -0
- package/dist/apis/admin/expire-delegation-token-v1.js +8 -0
- package/dist/apis/admin/expire-delegation-token-v2.js +1 -0
- package/dist/apis/admin/incremental-alter-configs-v0.d.ts +26 -0
- package/dist/apis/admin/incremental-alter-configs-v0.js +10 -0
- package/dist/apis/admin/incremental-alter-configs-v1.js +1 -0
- package/dist/apis/admin/index.d.ts +60 -0
- package/dist/apis/admin/index.js +60 -0
- package/dist/apis/admin/list-groups-v0.d.ts +18 -0
- package/dist/apis/admin/list-groups-v0.js +30 -0
- package/dist/apis/admin/list-groups-v1.d.ts +18 -0
- package/dist/apis/admin/list-groups-v1.js +37 -0
- package/dist/apis/admin/list-groups-v2.d.ts +18 -0
- package/dist/apis/admin/list-groups-v2.js +37 -0
- package/dist/apis/admin/list-groups-v3.d.ts +18 -0
- package/dist/apis/admin/list-groups-v3.js +38 -0
- package/dist/apis/admin/list-groups-v4.d.ts +4 -3
- package/dist/apis/admin/list-groups-v4.js +15 -4
- package/dist/apis/admin/list-groups-v5.d.ts +3 -3
- package/dist/apis/admin/list-groups-v5.js +25 -3
- package/dist/apis/admin/list-partition-reassignments-v0.d.ts +3 -3
- package/dist/apis/admin/list-partition-reassignments-v0.js +1 -0
- package/dist/apis/admin/list-transactions-v0.d.ts +5 -3
- package/dist/apis/admin/list-transactions-v0.js +23 -1
- package/dist/apis/admin/list-transactions-v1.d.ts +5 -3
- package/dist/apis/admin/list-transactions-v1.js +15 -1
- package/dist/apis/admin/list-transactions-v2.d.ts +5 -4
- package/dist/apis/admin/list-transactions-v2.js +17 -5
- package/dist/apis/admin/renew-delegation-token-v0.d.ts +11 -0
- package/dist/apis/admin/renew-delegation-token-v0.js +29 -0
- package/dist/apis/admin/renew-delegation-token-v1.d.ts +4 -0
- package/dist/apis/admin/renew-delegation-token-v1.js +8 -0
- package/dist/apis/admin/renew-delegation-token-v2.js +1 -0
- package/dist/apis/admin/unregister-broker-v0.js +1 -0
- package/dist/apis/admin/update-features-v0.d.ts +24 -0
- package/dist/apis/admin/update-features-v0.js +59 -0
- package/dist/apis/admin/update-features-v1.d.ts +2 -1
- package/dist/apis/admin/update-features-v1.js +1 -0
- package/dist/apis/callbacks.d.ts +1 -3
- package/dist/apis/callbacks.js +26 -11
- package/dist/apis/consumer/consumer-group-heartbeat-v0.d.ts +2 -2
- package/dist/apis/consumer/consumer-group-heartbeat-v0.js +17 -10
- package/dist/apis/consumer/consumer-group-heartbeat-v1.d.ts +2 -2
- package/dist/apis/consumer/consumer-group-heartbeat-v1.js +17 -10
- package/dist/apis/consumer/fetch-v10.d.ts +51 -0
- package/dist/apis/consumer/fetch-v10.js +122 -0
- package/dist/apis/consumer/fetch-v11.d.ts +51 -0
- package/dist/apis/consumer/fetch-v11.js +125 -0
- package/dist/apis/consumer/fetch-v12.d.ts +20 -4
- package/dist/apis/consumer/fetch-v12.js +29 -12
- package/dist/apis/consumer/fetch-v13.d.ts +20 -4
- package/dist/apis/consumer/fetch-v13.js +25 -7
- package/dist/apis/consumer/fetch-v14.d.ts +20 -4
- package/dist/apis/consumer/fetch-v14.js +25 -7
- package/dist/apis/consumer/fetch-v15.d.ts +20 -4
- package/dist/apis/consumer/fetch-v15.js +25 -7
- package/dist/apis/consumer/fetch-v16.d.ts +27 -4
- package/dist/apis/consumer/fetch-v16.js +36 -8
- package/dist/apis/consumer/fetch-v17.d.ts +28 -4
- package/dist/apis/consumer/fetch-v17.js +43 -9
- package/dist/apis/consumer/fetch-v4.d.ts +51 -0
- package/dist/apis/consumer/fetch-v4.js +87 -0
- package/dist/apis/consumer/fetch-v5.d.ts +51 -0
- package/dist/apis/consumer/fetch-v5.js +89 -0
- package/dist/apis/consumer/fetch-v6.d.ts +51 -0
- package/dist/apis/consumer/fetch-v6.js +99 -0
- package/dist/apis/consumer/fetch-v7.d.ts +51 -0
- package/dist/apis/consumer/fetch-v7.js +117 -0
- package/dist/apis/consumer/fetch-v8.d.ts +51 -0
- package/dist/apis/consumer/fetch-v8.js +117 -0
- package/dist/apis/consumer/fetch-v9.d.ts +51 -0
- package/dist/apis/consumer/fetch-v9.js +122 -0
- package/dist/apis/consumer/heartbeat-v0.d.ts +11 -0
- package/dist/apis/consumer/heartbeat-v0.js +24 -0
- package/dist/apis/consumer/heartbeat-v1.d.ts +11 -0
- package/dist/apis/consumer/heartbeat-v1.js +31 -0
- package/dist/apis/consumer/heartbeat-v2.d.ts +11 -0
- package/dist/apis/consumer/heartbeat-v2.js +31 -0
- package/dist/apis/consumer/heartbeat-v3.d.ts +11 -0
- package/dist/apis/consumer/heartbeat-v3.js +33 -0
- package/dist/apis/consumer/heartbeat-v4.js +1 -0
- package/dist/apis/consumer/index.d.ts +51 -0
- package/dist/apis/consumer/index.js +51 -0
- package/dist/apis/consumer/join-group-v0.d.ts +27 -0
- package/dist/apis/consumer/join-group-v0.js +51 -0
- package/dist/apis/consumer/join-group-v1.d.ts +8 -0
- package/dist/apis/consumer/join-group-v1.js +43 -0
- package/dist/apis/consumer/join-group-v2.d.ts +27 -0
- package/dist/apis/consumer/join-group-v2.js +60 -0
- package/dist/apis/consumer/join-group-v3.d.ts +27 -0
- package/dist/apis/consumer/join-group-v3.js +60 -0
- package/dist/apis/consumer/join-group-v4.d.ts +27 -0
- package/dist/apis/consumer/join-group-v4.js +60 -0
- package/dist/apis/consumer/join-group-v5.d.ts +27 -0
- package/dist/apis/consumer/join-group-v5.js +63 -0
- package/dist/apis/consumer/join-group-v6.d.ts +2 -2
- package/dist/apis/consumer/join-group-v6.js +10 -7
- package/dist/apis/consumer/join-group-v7.d.ts +2 -2
- package/dist/apis/consumer/join-group-v7.js +5 -3
- package/dist/apis/consumer/join-group-v8.d.ts +2 -2
- package/dist/apis/consumer/join-group-v8.js +5 -3
- package/dist/apis/consumer/join-group-v9.d.ts +2 -2
- package/dist/apis/consumer/join-group-v9.js +5 -3
- package/dist/apis/consumer/leave-group-v0.d.ts +22 -0
- package/dist/apis/consumer/leave-group-v0.js +23 -0
- package/dist/apis/consumer/leave-group-v1.d.ts +22 -0
- package/dist/apis/consumer/leave-group-v1.js +30 -0
- package/dist/apis/consumer/leave-group-v2.d.ts +22 -0
- package/dist/apis/consumer/leave-group-v2.js +30 -0
- package/dist/apis/consumer/leave-group-v3.d.ts +22 -0
- package/dist/apis/consumer/leave-group-v3.js +54 -0
- package/dist/apis/consumer/leave-group-v4.d.ts +1 -1
- package/dist/apis/consumer/leave-group-v4.js +4 -2
- package/dist/apis/consumer/leave-group-v5.d.ts +1 -1
- package/dist/apis/consumer/leave-group-v5.js +4 -2
- package/dist/apis/consumer/list-offsets-v0.d.ts +30 -0
- package/dist/apis/consumer/list-offsets-v0.js +50 -0
- package/dist/apis/consumer/list-offsets-v1.d.ts +12 -0
- package/dist/apis/consumer/list-offsets-v1.js +52 -0
- package/dist/apis/consumer/list-offsets-v2.d.ts +30 -0
- package/dist/apis/consumer/list-offsets-v2.js +64 -0
- package/dist/apis/consumer/list-offsets-v3.d.ts +30 -0
- package/dist/apis/consumer/list-offsets-v3.js +64 -0
- package/dist/apis/consumer/list-offsets-v4.d.ts +30 -0
- package/dist/apis/consumer/list-offsets-v4.js +67 -0
- package/dist/apis/consumer/list-offsets-v6.js +6 -3
- package/dist/apis/consumer/list-offsets-v7.js +6 -3
- package/dist/apis/consumer/list-offsets-v8.js +6 -3
- package/dist/apis/consumer/list-offsets-v9.js +6 -3
- package/dist/apis/consumer/offset-commit-v0.d.ts +29 -0
- package/dist/apis/consumer/offset-commit-v0.js +52 -0
- package/dist/apis/consumer/offset-commit-v1.d.ts +7 -0
- package/dist/apis/consumer/offset-commit-v1.js +30 -0
- package/dist/apis/consumer/offset-commit-v2.d.ts +8 -0
- package/dist/apis/consumer/offset-commit-v2.js +31 -0
- package/dist/apis/consumer/offset-commit-v3.d.ts +29 -0
- package/dist/apis/consumer/offset-commit-v3.js +58 -0
- package/dist/apis/consumer/offset-commit-v4.d.ts +29 -0
- package/dist/apis/consumer/offset-commit-v4.js +58 -0
- package/dist/apis/consumer/offset-commit-v5.d.ts +29 -0
- package/dist/apis/consumer/offset-commit-v5.js +56 -0
- package/dist/apis/consumer/offset-commit-v6.d.ts +29 -0
- package/dist/apis/consumer/offset-commit-v6.js +60 -0
- package/dist/apis/consumer/offset-commit-v7.d.ts +29 -0
- package/dist/apis/consumer/offset-commit-v7.js +62 -0
- package/dist/apis/consumer/offset-commit-v8.d.ts +2 -2
- package/dist/apis/consumer/offset-commit-v8.js +6 -3
- package/dist/apis/consumer/offset-commit-v9.d.ts +2 -2
- package/dist/apis/consumer/offset-commit-v9.js +6 -3
- package/dist/apis/consumer/offset-fetch-v0.d.ts +40 -0
- package/dist/apis/consumer/offset-fetch-v0.js +62 -0
- package/dist/apis/consumer/offset-fetch-v1.d.ts +6 -0
- package/dist/apis/consumer/offset-fetch-v1.js +41 -0
- package/dist/apis/consumer/offset-fetch-v2.d.ts +7 -0
- package/dist/apis/consumer/offset-fetch-v2.js +48 -0
- package/dist/apis/consumer/offset-fetch-v3.d.ts +39 -0
- package/dist/apis/consumer/offset-fetch-v3.js +64 -0
- package/dist/apis/consumer/offset-fetch-v4.d.ts +39 -0
- package/dist/apis/consumer/offset-fetch-v4.js +64 -0
- package/dist/apis/consumer/offset-fetch-v5.d.ts +39 -0
- package/dist/apis/consumer/offset-fetch-v5.js +65 -0
- package/dist/apis/consumer/offset-fetch-v6.d.ts +39 -0
- package/dist/apis/consumer/offset-fetch-v6.js +68 -0
- package/dist/apis/consumer/offset-fetch-v7.d.ts +39 -0
- package/dist/apis/consumer/offset-fetch-v7.js +70 -0
- package/dist/apis/consumer/offset-fetch-v8.js +5 -2
- package/dist/apis/consumer/offset-fetch-v9.js +5 -2
- package/dist/apis/consumer/offset-for-leader-epoch-v0.d.ts +29 -0
- package/dist/apis/consumer/offset-for-leader-epoch-v0.js +48 -0
- package/dist/apis/consumer/offset-for-leader-epoch-v1.d.ts +29 -0
- package/dist/apis/consumer/offset-for-leader-epoch-v1.js +54 -0
- package/dist/apis/consumer/offset-for-leader-epoch-v2.d.ts +29 -0
- package/dist/apis/consumer/offset-for-leader-epoch-v2.js +58 -0
- package/dist/apis/consumer/offset-for-leader-epoch-v3.d.ts +29 -0
- package/dist/apis/consumer/offset-for-leader-epoch-v3.js +59 -0
- package/dist/apis/consumer/offset-for-leader-epoch-v4.d.ts +1 -1
- package/dist/apis/consumer/offset-for-leader-epoch-v4.js +11 -8
- package/dist/apis/consumer/sync-group-v0.d.ts +18 -0
- package/dist/apis/consumer/sync-group-v0.js +38 -0
- package/dist/apis/consumer/sync-group-v1.d.ts +18 -0
- package/dist/apis/consumer/sync-group-v1.js +39 -0
- package/dist/apis/consumer/sync-group-v2.d.ts +18 -0
- package/dist/apis/consumer/sync-group-v2.js +39 -0
- package/dist/apis/consumer/sync-group-v3.d.ts +18 -0
- package/dist/apis/consumer/sync-group-v3.js +41 -0
- package/dist/apis/consumer/sync-group-v4.js +1 -0
- package/dist/apis/consumer/sync-group-v5.js +1 -0
- package/dist/apis/enumerations.d.ts +21 -6
- package/dist/apis/enumerations.js +57 -5
- package/dist/apis/index.d.ts +1 -0
- package/dist/apis/index.js +1 -0
- package/dist/apis/metadata/api-versions-v0.d.ts +17 -0
- package/dist/apis/metadata/api-versions-v0.js +24 -0
- package/dist/apis/metadata/api-versions-v1.d.ts +17 -0
- package/dist/apis/metadata/api-versions-v1.js +39 -0
- package/dist/apis/metadata/api-versions-v2.d.ts +17 -0
- package/dist/apis/metadata/api-versions-v2.js +39 -0
- package/dist/apis/metadata/api-versions-v3.d.ts +16 -2
- package/dist/apis/metadata/api-versions-v3.js +43 -4
- package/dist/apis/metadata/api-versions-v4.d.ts +16 -2
- package/dist/apis/metadata/api-versions-v4.js +35 -3
- package/dist/apis/metadata/find-coordinator-v0.d.ts +18 -0
- package/dist/apis/metadata/find-coordinator-v0.js +24 -0
- package/dist/apis/metadata/find-coordinator-v1.d.ts +18 -0
- package/dist/apis/metadata/find-coordinator-v1.js +41 -0
- package/dist/apis/metadata/find-coordinator-v2.d.ts +18 -0
- package/dist/apis/metadata/find-coordinator-v2.js +41 -0
- package/dist/apis/metadata/find-coordinator-v3.d.ts +18 -0
- package/dist/apis/metadata/find-coordinator-v3.js +44 -0
- package/dist/apis/metadata/find-coordinator-v4.js +3 -1
- package/dist/apis/metadata/find-coordinator-v5.js +3 -1
- package/dist/apis/metadata/find-coordinator-v6.js +3 -1
- package/dist/apis/metadata/index.d.ts +16 -0
- package/dist/apis/metadata/index.js +16 -0
- package/dist/apis/metadata/metadata-v0.d.ts +38 -0
- package/dist/apis/metadata/metadata-v0.js +47 -0
- package/dist/apis/metadata/metadata-v1.d.ts +38 -0
- package/dist/apis/metadata/metadata-v1.js +52 -0
- package/dist/apis/metadata/metadata-v10.d.ts +4 -2
- package/dist/apis/metadata/metadata-v10.js +29 -16
- package/dist/apis/metadata/metadata-v11.d.ts +3 -2
- package/dist/apis/metadata/metadata-v11.js +23 -15
- package/dist/apis/metadata/metadata-v12.d.ts +9 -2
- package/dist/apis/metadata/metadata-v12.js +21 -9
- package/dist/apis/metadata/metadata-v2.d.ts +38 -0
- package/dist/apis/metadata/metadata-v2.js +52 -0
- package/dist/apis/metadata/metadata-v3.d.ts +38 -0
- package/dist/apis/metadata/metadata-v3.js +52 -0
- package/dist/apis/metadata/metadata-v4.d.ts +38 -0
- package/dist/apis/metadata/metadata-v4.js +54 -0
- package/dist/apis/metadata/metadata-v5.d.ts +38 -0
- package/dist/apis/metadata/metadata-v5.js +85 -0
- package/dist/apis/metadata/metadata-v6.d.ts +38 -0
- package/dist/apis/metadata/metadata-v6.js +85 -0
- package/dist/apis/metadata/metadata-v7.d.ts +38 -0
- package/dist/apis/metadata/metadata-v7.js +86 -0
- package/dist/apis/metadata/metadata-v8.d.ts +39 -0
- package/dist/apis/metadata/metadata-v8.js +94 -0
- package/dist/apis/metadata/metadata-v9.d.ts +5 -3
- package/dist/apis/metadata/metadata-v9.js +28 -21
- package/dist/apis/producer/add-offsets-to-txn-v0.d.ts +10 -0
- package/dist/apis/producer/add-offsets-to-txn-v0.js +30 -0
- package/dist/apis/producer/add-offsets-to-txn-v3.js +1 -0
- package/dist/apis/producer/add-offsets-to-txn-v4.js +1 -0
- package/dist/apis/producer/add-partitions-to-txn-v0.d.ts +34 -0
- package/dist/apis/producer/add-partitions-to-txn-v0.js +62 -0
- package/dist/apis/producer/add-partitions-to-txn-v1.d.ts +5 -0
- package/dist/apis/producer/add-partitions-to-txn-v1.js +9 -0
- package/dist/apis/producer/add-partitions-to-txn-v2.d.ts +5 -0
- package/dist/apis/producer/add-partitions-to-txn-v2.js +9 -0
- package/dist/apis/producer/add-partitions-to-txn-v3.js +13 -8
- package/dist/apis/producer/add-partitions-to-txn-v4.js +11 -5
- package/dist/apis/producer/add-partitions-to-txn-v5.js +11 -5
- package/dist/apis/producer/end-txn-v0.d.ts +10 -0
- package/dist/apis/producer/end-txn-v0.js +30 -0
- package/dist/apis/producer/end-txn-v1.d.ts +5 -0
- package/dist/apis/producer/end-txn-v1.js +9 -0
- package/dist/apis/producer/end-txn-v2.d.ts +5 -0
- package/dist/apis/producer/end-txn-v2.js +9 -0
- package/dist/apis/producer/end-txn-v3.js +1 -0
- package/dist/apis/producer/end-txn-v4.js +1 -0
- package/dist/apis/producer/index.d.ts +17 -0
- package/dist/apis/producer/index.js +17 -0
- package/dist/apis/producer/init-producer-id-v0.d.ts +13 -0
- package/dist/apis/producer/init-producer-id-v0.js +31 -0
- package/dist/apis/producer/init-producer-id-v1.d.ts +5 -0
- package/dist/apis/producer/init-producer-id-v1.js +9 -0
- package/dist/apis/producer/init-producer-id-v2.d.ts +13 -0
- package/dist/apis/producer/init-producer-id-v2.js +24 -0
- package/dist/apis/producer/init-producer-id-v3.d.ts +2 -2
- package/dist/apis/producer/init-producer-id-v3.js +9 -1
- package/dist/apis/producer/init-producer-id-v4.d.ts +2 -2
- package/dist/apis/producer/init-producer-id-v4.js +9 -1
- package/dist/apis/producer/init-producer-id-v5.d.ts +2 -2
- package/dist/apis/producer/init-producer-id-v5.js +9 -1
- package/dist/apis/producer/produce-v10.d.ts +12 -0
- package/dist/apis/producer/produce-v10.js +42 -5
- package/dist/apis/producer/produce-v11.d.ts +12 -0
- package/dist/apis/producer/produce-v11.js +42 -5
- package/dist/apis/producer/produce-v3.d.ts +29 -0
- package/dist/apis/producer/produce-v3.js +88 -0
- package/dist/apis/producer/produce-v4.d.ts +29 -0
- package/dist/apis/producer/produce-v4.js +88 -0
- package/dist/apis/producer/produce-v5.d.ts +29 -0
- package/dist/apis/producer/produce-v5.js +88 -0
- package/dist/apis/producer/produce-v6.d.ts +29 -0
- package/dist/apis/producer/produce-v6.js +88 -0
- package/dist/apis/producer/produce-v7.js +1 -1
- package/dist/apis/producer/produce-v9.js +7 -3
- package/dist/apis/producer/txn-offset-commit-v0.d.ts +29 -0
- package/dist/apis/producer/txn-offset-commit-v0.js +60 -0
- package/dist/apis/producer/txn-offset-commit-v1.d.ts +29 -0
- package/dist/apis/producer/txn-offset-commit-v1.js +60 -0
- package/dist/apis/producer/txn-offset-commit-v2.d.ts +29 -0
- package/dist/apis/producer/txn-offset-commit-v2.js +62 -0
- package/dist/apis/producer/txn-offset-commit-v3.js +7 -3
- package/dist/apis/producer/txn-offset-commit-v4.js +7 -3
- package/dist/apis/security/index.d.ts +3 -0
- package/dist/apis/security/index.js +3 -0
- package/dist/apis/security/sasl-authenticate-v0.d.ts +15 -0
- package/dist/apis/security/sasl-authenticate-v0.js +30 -0
- package/dist/apis/security/sasl-authenticate-v1.d.ts +15 -0
- package/dist/apis/security/sasl-authenticate-v1.js +30 -0
- package/dist/apis/security/sasl-authenticate-v2.js +1 -0
- package/dist/apis/security/sasl-handshake-v0.d.ts +10 -0
- package/dist/apis/security/sasl-handshake-v0.js +28 -0
- package/dist/apis/tagged-fields.d.ts +7 -0
- package/dist/apis/tagged-fields.js +27 -0
- package/dist/apis/telemetry/compression-types.d.ts +8 -0
- package/dist/apis/telemetry/compression-types.js +7 -0
- package/dist/apis/telemetry/get-telemetry-subscriptions-v0.d.ts +2 -1
- package/dist/apis/telemetry/get-telemetry-subscriptions-v0.js +1 -0
- package/dist/apis/telemetry/index.d.ts +3 -0
- package/dist/apis/telemetry/index.js +3 -0
- package/dist/apis/telemetry/list-client-metrics-resources-v0.d.ts +6 -4
- package/dist/apis/telemetry/list-client-metrics-resources-v0.js +13 -8
- package/dist/apis/telemetry/list-config-resources-v1.d.ts +16 -0
- package/dist/apis/telemetry/list-config-resources-v1.js +38 -0
- package/dist/apis/telemetry/push-telemetry-v0.d.ts +3 -2
- package/dist/apis/telemetry/push-telemetry-v0.js +1 -0
- package/dist/clients/admin/admin.js +428 -378
- package/dist/clients/admin/options.d.ts +62 -6
- package/dist/clients/admin/options.js +41 -10
- package/dist/clients/admin/types.d.ts +8 -2
- package/dist/clients/base/base.d.ts +3 -3
- package/dist/clients/base/base.js +83 -21
- package/dist/clients/base/options.d.ts +3 -0
- package/dist/clients/base/options.js +1 -0
- package/dist/clients/base/types.d.ts +1 -0
- package/dist/clients/consumer/consumer.d.ts +5 -1
- package/dist/clients/consumer/consumer.js +539 -90
- package/dist/clients/consumer/messages-stream.js +254 -65
- package/dist/clients/consumer/options.d.ts +38 -0
- package/dist/clients/consumer/options.js +3 -0
- package/dist/clients/consumer/types.d.ts +44 -2
- package/dist/clients/consumer/types.js +5 -0
- package/dist/clients/consumer/utils.d.ts +2 -0
- package/dist/clients/consumer/utils.js +9 -0
- package/dist/clients/producer/producer.d.ts +1 -1
- package/dist/clients/producer/producer.js +146 -66
- package/dist/clients/serde.d.ts +1 -1
- package/dist/errors.d.ts +4 -0
- package/dist/errors.js +22 -0
- package/dist/network/connection-pool.js +12 -2
- package/dist/network/connection.js +106 -23
- package/dist/network/utils.js +26 -8
- package/dist/protocol/definitions.js +1 -1
- package/dist/protocol/reader.js +11 -6
- package/dist/protocol/records.d.ts +4 -0
- package/dist/protocol/writer.js +17 -4
- package/dist/registries/abstract.d.ts +2 -2
- package/dist/registries/abstract.js +27 -8
- package/dist/registries/confluent-schema-registry.d.ts +57 -4
- package/dist/registries/confluent-schema-registry.js +253 -40
- package/dist/symbols.d.ts +2 -0
- package/dist/symbols.js +2 -0
- package/dist/typescript-4/dist/apis/admin/alter-client-quotas-v0.d.ts +40 -0
- package/dist/typescript-4/dist/apis/admin/alter-client-quotas-v1.d.ts +6 -5
- package/dist/typescript-4/dist/apis/admin/alter-configs-v0.d.ts +7 -0
- package/dist/typescript-4/dist/apis/admin/alter-configs-v1.d.ts +2 -0
- package/dist/typescript-4/dist/apis/admin/alter-partition-reassignments-v0.d.ts +3 -2
- package/dist/typescript-4/dist/apis/admin/alter-partition-reassignments-v1.d.ts +6 -4
- package/dist/typescript-4/dist/apis/admin/alter-partition-v0.d.ts +40 -0
- package/dist/typescript-4/dist/apis/admin/alter-partition-v1.d.ts +37 -0
- package/dist/typescript-4/dist/apis/admin/alter-partition-v2.d.ts +36 -0
- package/dist/typescript-4/dist/apis/admin/alter-partition-v3.d.ts +6 -35
- package/dist/typescript-4/dist/apis/admin/alter-replica-log-dirs-v0.d.ts +23 -0
- package/dist/typescript-4/dist/apis/admin/alter-replica-log-dirs-v1.d.ts +4 -0
- package/dist/typescript-4/dist/apis/admin/alter-replica-log-dirs-v2.d.ts +1 -1
- package/dist/typescript-4/dist/apis/admin/client-quotas.d.ts +2 -0
- package/dist/typescript-4/dist/apis/admin/consumer-group-describe-v0.d.ts +2 -1
- package/dist/typescript-4/dist/apis/admin/create-acls-v0.d.ts +16 -0
- package/dist/typescript-4/dist/apis/admin/create-acls-v1.d.ts +15 -0
- package/dist/typescript-4/dist/apis/admin/create-delegation-token-v0.d.ts +24 -0
- package/dist/typescript-4/dist/apis/admin/create-delegation-token-v1.d.ts +4 -0
- package/dist/typescript-4/dist/apis/admin/create-delegation-token-v2.d.ts +9 -0
- package/dist/typescript-4/dist/apis/admin/create-partitions-v0.d.ts +2 -0
- package/dist/typescript-4/dist/apis/admin/create-partitions-v1.d.ts +2 -2
- package/dist/typescript-4/dist/apis/admin/create-partitions-v2.d.ts +2 -2
- package/dist/typescript-4/dist/apis/admin/create-topics-v0.d.ts +42 -0
- package/dist/typescript-4/dist/apis/admin/create-topics-v1.d.ts +42 -0
- package/dist/typescript-4/dist/apis/admin/create-topics-v2.d.ts +42 -0
- package/dist/typescript-4/dist/apis/admin/create-topics-v3.d.ts +42 -0
- package/dist/typescript-4/dist/apis/admin/create-topics-v4.d.ts +42 -0
- package/dist/typescript-4/dist/apis/admin/create-topics-v5.d.ts +42 -0
- package/dist/typescript-4/dist/apis/admin/create-topics-v6.d.ts +42 -0
- package/dist/typescript-4/dist/apis/admin/create-topics-v7.d.ts +2 -1
- package/dist/typescript-4/dist/apis/admin/delete-acls-v0.d.ts +28 -0
- package/dist/typescript-4/dist/apis/admin/delete-acls-v1.d.ts +27 -0
- package/dist/typescript-4/dist/apis/admin/delete-groups-v0.d.ts +14 -0
- package/dist/typescript-4/dist/apis/admin/delete-groups-v1.d.ts +14 -0
- package/dist/typescript-4/dist/apis/admin/delete-records-v0.d.ts +27 -0
- package/dist/typescript-4/dist/apis/admin/delete-records-v1.d.ts +27 -0
- package/dist/typescript-4/dist/apis/admin/delete-topics-v0.d.ts +19 -0
- package/dist/typescript-4/dist/apis/admin/delete-topics-v1.d.ts +19 -0
- package/dist/typescript-4/dist/apis/admin/delete-topics-v2.d.ts +19 -0
- package/dist/typescript-4/dist/apis/admin/delete-topics-v3.d.ts +19 -0
- package/dist/typescript-4/dist/apis/admin/delete-topics-v4.d.ts +19 -0
- package/dist/typescript-4/dist/apis/admin/delete-topics-v5.d.ts +19 -0
- package/dist/typescript-4/dist/apis/admin/delete-topics-v6.d.ts +1 -1
- package/dist/typescript-4/dist/apis/admin/describe-acls-v0.d.ts +21 -0
- package/dist/typescript-4/dist/apis/admin/describe-acls-v1.d.ts +21 -0
- package/dist/typescript-4/dist/apis/admin/describe-client-quotas-v0.d.ts +8 -7
- package/dist/typescript-4/dist/apis/admin/describe-client-quotas-v1.d.ts +9 -0
- package/dist/typescript-4/dist/apis/admin/describe-cluster-v0.d.ts +4 -3
- package/dist/typescript-4/dist/apis/admin/describe-cluster-v1.d.ts +4 -3
- package/dist/typescript-4/dist/apis/admin/describe-configs-v0.d.ts +41 -0
- package/dist/typescript-4/dist/apis/admin/describe-configs-v1.d.ts +39 -0
- package/dist/typescript-4/dist/apis/admin/describe-configs-v2.d.ts +9 -8
- package/dist/typescript-4/dist/apis/admin/describe-configs-v3.d.ts +9 -8
- package/dist/typescript-4/dist/apis/admin/describe-configs-v4.d.ts +2 -2
- package/dist/typescript-4/dist/apis/admin/describe-delegation-token-v0.d.ts +31 -0
- package/dist/typescript-4/dist/apis/admin/describe-delegation-token-v1.d.ts +4 -0
- package/dist/typescript-4/dist/apis/admin/describe-delegation-token-v2.d.ts +8 -0
- package/dist/typescript-4/dist/apis/admin/describe-delegation-token-v3.d.ts +4 -27
- package/dist/typescript-4/dist/apis/admin/describe-groups-v0.d.ts +28 -0
- package/dist/typescript-4/dist/apis/admin/describe-groups-v1.d.ts +28 -0
- package/dist/typescript-4/dist/apis/admin/describe-groups-v2.d.ts +28 -0
- package/dist/typescript-4/dist/apis/admin/describe-groups-v3.d.ts +28 -0
- package/dist/typescript-4/dist/apis/admin/describe-groups-v4.d.ts +28 -0
- package/dist/typescript-4/dist/apis/admin/describe-log-dirs-v0.d.ts +30 -0
- package/dist/typescript-4/dist/apis/admin/describe-log-dirs-v1.d.ts +4 -0
- package/dist/typescript-4/dist/apis/admin/describe-log-dirs-v2.d.ts +3 -2
- package/dist/typescript-4/dist/apis/admin/describe-log-dirs-v3.d.ts +3 -2
- package/dist/typescript-4/dist/apis/admin/describe-log-dirs-v4.d.ts +3 -2
- package/dist/typescript-4/dist/apis/admin/describe-quorum-v0.d.ts +13 -0
- package/dist/typescript-4/dist/apis/admin/describe-quorum-v1.d.ts +13 -0
- package/dist/typescript-4/dist/apis/admin/describe-topic-partitions-v0.d.ts +3 -3
- package/dist/typescript-4/dist/apis/admin/describe-user-scram-credentials-v0.d.ts +4 -3
- package/dist/typescript-4/dist/apis/admin/expire-delegation-token-v0.d.ts +11 -0
- package/dist/typescript-4/dist/apis/admin/expire-delegation-token-v1.d.ts +4 -0
- package/dist/typescript-4/dist/apis/admin/incremental-alter-configs-v0.d.ts +26 -0
- package/dist/typescript-4/dist/apis/admin/index.d.ts +60 -0
- package/dist/typescript-4/dist/apis/admin/list-groups-v0.d.ts +18 -0
- package/dist/typescript-4/dist/apis/admin/list-groups-v1.d.ts +18 -0
- package/dist/typescript-4/dist/apis/admin/list-groups-v2.d.ts +18 -0
- package/dist/typescript-4/dist/apis/admin/list-groups-v3.d.ts +18 -0
- package/dist/typescript-4/dist/apis/admin/list-groups-v4.d.ts +4 -3
- package/dist/typescript-4/dist/apis/admin/list-groups-v5.d.ts +3 -3
- package/dist/typescript-4/dist/apis/admin/list-partition-reassignments-v0.d.ts +3 -3
- package/dist/typescript-4/dist/apis/admin/list-transactions-v0.d.ts +5 -3
- package/dist/typescript-4/dist/apis/admin/list-transactions-v1.d.ts +5 -3
- package/dist/typescript-4/dist/apis/admin/list-transactions-v2.d.ts +5 -4
- package/dist/typescript-4/dist/apis/admin/renew-delegation-token-v0.d.ts +11 -0
- package/dist/typescript-4/dist/apis/admin/renew-delegation-token-v1.d.ts +4 -0
- package/dist/typescript-4/dist/apis/admin/update-features-v0.d.ts +24 -0
- package/dist/typescript-4/dist/apis/admin/update-features-v1.d.ts +2 -1
- package/dist/typescript-4/dist/apis/callbacks.d.ts +1 -3
- package/dist/typescript-4/dist/apis/consumer/consumer-group-heartbeat-v0.d.ts +2 -2
- package/dist/typescript-4/dist/apis/consumer/consumer-group-heartbeat-v1.d.ts +2 -2
- package/dist/typescript-4/dist/apis/consumer/fetch-v10.d.ts +51 -0
- package/dist/typescript-4/dist/apis/consumer/fetch-v11.d.ts +51 -0
- package/dist/typescript-4/dist/apis/consumer/fetch-v12.d.ts +20 -4
- package/dist/typescript-4/dist/apis/consumer/fetch-v13.d.ts +20 -4
- package/dist/typescript-4/dist/apis/consumer/fetch-v14.d.ts +20 -4
- package/dist/typescript-4/dist/apis/consumer/fetch-v15.d.ts +20 -4
- package/dist/typescript-4/dist/apis/consumer/fetch-v16.d.ts +27 -4
- package/dist/typescript-4/dist/apis/consumer/fetch-v17.d.ts +28 -4
- package/dist/typescript-4/dist/apis/consumer/fetch-v4.d.ts +51 -0
- package/dist/typescript-4/dist/apis/consumer/fetch-v5.d.ts +51 -0
- package/dist/typescript-4/dist/apis/consumer/fetch-v6.d.ts +51 -0
- package/dist/typescript-4/dist/apis/consumer/fetch-v7.d.ts +51 -0
- package/dist/typescript-4/dist/apis/consumer/fetch-v8.d.ts +51 -0
- package/dist/typescript-4/dist/apis/consumer/fetch-v9.d.ts +51 -0
- package/dist/typescript-4/dist/apis/consumer/heartbeat-v0.d.ts +11 -0
- package/dist/typescript-4/dist/apis/consumer/heartbeat-v1.d.ts +11 -0
- package/dist/typescript-4/dist/apis/consumer/heartbeat-v2.d.ts +11 -0
- package/dist/typescript-4/dist/apis/consumer/heartbeat-v3.d.ts +11 -0
- package/dist/typescript-4/dist/apis/consumer/index.d.ts +51 -0
- package/dist/typescript-4/dist/apis/consumer/join-group-v0.d.ts +27 -0
- package/dist/typescript-4/dist/apis/consumer/join-group-v1.d.ts +8 -0
- package/dist/typescript-4/dist/apis/consumer/join-group-v2.d.ts +27 -0
- package/dist/typescript-4/dist/apis/consumer/join-group-v3.d.ts +27 -0
- package/dist/typescript-4/dist/apis/consumer/join-group-v4.d.ts +27 -0
- package/dist/typescript-4/dist/apis/consumer/join-group-v5.d.ts +27 -0
- package/dist/typescript-4/dist/apis/consumer/join-group-v6.d.ts +2 -2
- package/dist/typescript-4/dist/apis/consumer/join-group-v7.d.ts +2 -2
- package/dist/typescript-4/dist/apis/consumer/join-group-v8.d.ts +2 -2
- package/dist/typescript-4/dist/apis/consumer/join-group-v9.d.ts +2 -2
- package/dist/typescript-4/dist/apis/consumer/leave-group-v0.d.ts +22 -0
- package/dist/typescript-4/dist/apis/consumer/leave-group-v1.d.ts +22 -0
- package/dist/typescript-4/dist/apis/consumer/leave-group-v2.d.ts +22 -0
- package/dist/typescript-4/dist/apis/consumer/leave-group-v3.d.ts +22 -0
- package/dist/typescript-4/dist/apis/consumer/leave-group-v4.d.ts +1 -1
- package/dist/typescript-4/dist/apis/consumer/leave-group-v5.d.ts +1 -1
- package/dist/typescript-4/dist/apis/consumer/list-offsets-v0.d.ts +30 -0
- package/dist/typescript-4/dist/apis/consumer/list-offsets-v1.d.ts +12 -0
- package/dist/typescript-4/dist/apis/consumer/list-offsets-v2.d.ts +30 -0
- package/dist/typescript-4/dist/apis/consumer/list-offsets-v3.d.ts +30 -0
- package/dist/typescript-4/dist/apis/consumer/list-offsets-v4.d.ts +30 -0
- package/dist/typescript-4/dist/apis/consumer/offset-commit-v0.d.ts +29 -0
- package/dist/typescript-4/dist/apis/consumer/offset-commit-v1.d.ts +7 -0
- package/dist/typescript-4/dist/apis/consumer/offset-commit-v2.d.ts +8 -0
- package/dist/typescript-4/dist/apis/consumer/offset-commit-v3.d.ts +29 -0
- package/dist/typescript-4/dist/apis/consumer/offset-commit-v4.d.ts +29 -0
- package/dist/typescript-4/dist/apis/consumer/offset-commit-v5.d.ts +29 -0
- package/dist/typescript-4/dist/apis/consumer/offset-commit-v6.d.ts +29 -0
- package/dist/typescript-4/dist/apis/consumer/offset-commit-v7.d.ts +29 -0
- package/dist/typescript-4/dist/apis/consumer/offset-commit-v8.d.ts +2 -2
- package/dist/typescript-4/dist/apis/consumer/offset-commit-v9.d.ts +2 -2
- package/dist/typescript-4/dist/apis/consumer/offset-fetch-v0.d.ts +40 -0
- package/dist/typescript-4/dist/apis/consumer/offset-fetch-v1.d.ts +6 -0
- package/dist/typescript-4/dist/apis/consumer/offset-fetch-v2.d.ts +7 -0
- package/dist/typescript-4/dist/apis/consumer/offset-fetch-v3.d.ts +39 -0
- package/dist/typescript-4/dist/apis/consumer/offset-fetch-v4.d.ts +39 -0
- package/dist/typescript-4/dist/apis/consumer/offset-fetch-v5.d.ts +39 -0
- package/dist/typescript-4/dist/apis/consumer/offset-fetch-v6.d.ts +39 -0
- package/dist/typescript-4/dist/apis/consumer/offset-fetch-v7.d.ts +39 -0
- package/dist/typescript-4/dist/apis/consumer/offset-for-leader-epoch-v0.d.ts +29 -0
- package/dist/typescript-4/dist/apis/consumer/offset-for-leader-epoch-v1.d.ts +29 -0
- package/dist/typescript-4/dist/apis/consumer/offset-for-leader-epoch-v2.d.ts +29 -0
- package/dist/typescript-4/dist/apis/consumer/offset-for-leader-epoch-v3.d.ts +29 -0
- package/dist/typescript-4/dist/apis/consumer/offset-for-leader-epoch-v4.d.ts +1 -1
- package/dist/typescript-4/dist/apis/consumer/sync-group-v0.d.ts +18 -0
- package/dist/typescript-4/dist/apis/consumer/sync-group-v1.d.ts +18 -0
- package/dist/typescript-4/dist/apis/consumer/sync-group-v2.d.ts +18 -0
- package/dist/typescript-4/dist/apis/consumer/sync-group-v3.d.ts +18 -0
- package/dist/typescript-4/dist/apis/enumerations.d.ts +21 -6
- package/dist/typescript-4/dist/apis/index.d.ts +1 -0
- package/dist/typescript-4/dist/apis/metadata/api-versions-v0.d.ts +17 -0
- package/dist/typescript-4/dist/apis/metadata/api-versions-v1.d.ts +17 -0
- package/dist/typescript-4/dist/apis/metadata/api-versions-v2.d.ts +17 -0
- package/dist/typescript-4/dist/apis/metadata/api-versions-v3.d.ts +16 -2
- package/dist/typescript-4/dist/apis/metadata/api-versions-v4.d.ts +16 -2
- package/dist/typescript-4/dist/apis/metadata/find-coordinator-v0.d.ts +18 -0
- package/dist/typescript-4/dist/apis/metadata/find-coordinator-v1.d.ts +18 -0
- package/dist/typescript-4/dist/apis/metadata/find-coordinator-v2.d.ts +18 -0
- package/dist/typescript-4/dist/apis/metadata/find-coordinator-v3.d.ts +18 -0
- package/dist/typescript-4/dist/apis/metadata/index.d.ts +16 -0
- package/dist/typescript-4/dist/apis/metadata/metadata-v0.d.ts +38 -0
- package/dist/typescript-4/dist/apis/metadata/metadata-v1.d.ts +38 -0
- package/dist/typescript-4/dist/apis/metadata/metadata-v10.d.ts +4 -2
- package/dist/typescript-4/dist/apis/metadata/metadata-v11.d.ts +3 -2
- package/dist/typescript-4/dist/apis/metadata/metadata-v12.d.ts +9 -2
- package/dist/typescript-4/dist/apis/metadata/metadata-v2.d.ts +38 -0
- package/dist/typescript-4/dist/apis/metadata/metadata-v3.d.ts +38 -0
- package/dist/typescript-4/dist/apis/metadata/metadata-v4.d.ts +38 -0
- package/dist/typescript-4/dist/apis/metadata/metadata-v5.d.ts +38 -0
- package/dist/typescript-4/dist/apis/metadata/metadata-v6.d.ts +38 -0
- package/dist/typescript-4/dist/apis/metadata/metadata-v7.d.ts +38 -0
- package/dist/typescript-4/dist/apis/metadata/metadata-v8.d.ts +39 -0
- package/dist/typescript-4/dist/apis/metadata/metadata-v9.d.ts +5 -3
- package/dist/typescript-4/dist/apis/producer/add-offsets-to-txn-v0.d.ts +10 -0
- package/dist/typescript-4/dist/apis/producer/add-partitions-to-txn-v0.d.ts +34 -0
- package/dist/typescript-4/dist/apis/producer/add-partitions-to-txn-v1.d.ts +5 -0
- package/dist/typescript-4/dist/apis/producer/add-partitions-to-txn-v2.d.ts +5 -0
- package/dist/typescript-4/dist/apis/producer/end-txn-v0.d.ts +10 -0
- package/dist/typescript-4/dist/apis/producer/end-txn-v1.d.ts +5 -0
- package/dist/typescript-4/dist/apis/producer/end-txn-v2.d.ts +5 -0
- package/dist/typescript-4/dist/apis/producer/index.d.ts +17 -0
- package/dist/typescript-4/dist/apis/producer/init-producer-id-v0.d.ts +13 -0
- package/dist/typescript-4/dist/apis/producer/init-producer-id-v1.d.ts +5 -0
- package/dist/typescript-4/dist/apis/producer/init-producer-id-v2.d.ts +13 -0
- package/dist/typescript-4/dist/apis/producer/init-producer-id-v3.d.ts +2 -2
- package/dist/typescript-4/dist/apis/producer/init-producer-id-v4.d.ts +2 -2
- package/dist/typescript-4/dist/apis/producer/init-producer-id-v5.d.ts +2 -2
- package/dist/typescript-4/dist/apis/producer/produce-v10.d.ts +12 -0
- package/dist/typescript-4/dist/apis/producer/produce-v11.d.ts +12 -0
- package/dist/typescript-4/dist/apis/producer/produce-v3.d.ts +29 -0
- package/dist/typescript-4/dist/apis/producer/produce-v4.d.ts +29 -0
- package/dist/typescript-4/dist/apis/producer/produce-v5.d.ts +29 -0
- package/dist/typescript-4/dist/apis/producer/produce-v6.d.ts +29 -0
- package/dist/typescript-4/dist/apis/producer/txn-offset-commit-v0.d.ts +29 -0
- package/dist/typescript-4/dist/apis/producer/txn-offset-commit-v1.d.ts +29 -0
- package/dist/typescript-4/dist/apis/producer/txn-offset-commit-v2.d.ts +29 -0
- package/dist/typescript-4/dist/apis/security/index.d.ts +3 -0
- package/dist/typescript-4/dist/apis/security/sasl-authenticate-v0.d.ts +15 -0
- package/dist/typescript-4/dist/apis/security/sasl-authenticate-v1.d.ts +15 -0
- package/dist/typescript-4/dist/apis/security/sasl-handshake-v0.d.ts +10 -0
- package/dist/typescript-4/dist/apis/tagged-fields.d.ts +7 -0
- package/dist/typescript-4/dist/apis/telemetry/compression-types.d.ts +8 -0
- package/dist/typescript-4/dist/apis/telemetry/get-telemetry-subscriptions-v0.d.ts +2 -1
- package/dist/typescript-4/dist/apis/telemetry/index.d.ts +3 -0
- package/dist/typescript-4/dist/apis/telemetry/list-client-metrics-resources-v0.d.ts +6 -4
- package/dist/typescript-4/dist/apis/telemetry/list-config-resources-v1.d.ts +16 -0
- package/dist/typescript-4/dist/apis/telemetry/push-telemetry-v0.d.ts +3 -2
- package/dist/typescript-4/dist/clients/admin/options.d.ts +62 -6
- package/dist/typescript-4/dist/clients/admin/types.d.ts +8 -2
- package/dist/typescript-4/dist/clients/base/base.d.ts +3 -3
- package/dist/typescript-4/dist/clients/base/options.d.ts +3 -0
- package/dist/typescript-4/dist/clients/base/types.d.ts +1 -0
- package/dist/typescript-4/dist/clients/consumer/consumer.d.ts +5 -1
- package/dist/typescript-4/dist/clients/consumer/options.d.ts +38 -0
- package/dist/typescript-4/dist/clients/consumer/types.d.ts +44 -2
- package/dist/typescript-4/dist/clients/consumer/utils.d.ts +2 -0
- package/dist/typescript-4/dist/clients/producer/producer.d.ts +1 -1
- package/dist/typescript-4/dist/clients/serde.d.ts +1 -1
- package/dist/typescript-4/dist/errors.d.ts +4 -0
- package/dist/typescript-4/dist/protocol/records.d.ts +4 -0
- package/dist/typescript-4/dist/registries/abstract.d.ts +2 -2
- package/dist/typescript-4/dist/registries/confluent-schema-registry.d.ts +57 -4
- package/dist/typescript-4/dist/symbols.d.ts +2 -0
- package/dist/version.js +1 -1
- package/package.json +12 -3
|
@@ -2,12 +2,12 @@ import { randomUUID } from 'node:crypto';
|
|
|
2
2
|
import { createPromisifiedCallback, kCallbackPromise, runConcurrentCallbacks } from "../../apis/callbacks.js";
|
|
3
3
|
import { FetchIsolationLevels, FindCoordinatorKeyTypes } from "../../apis/enumerations.js";
|
|
4
4
|
import { consumerCommitsChannel, consumerConsumesChannel, consumerFetchesChannel, consumerGroupChannel, consumerHeartbeatChannel, consumerLagChannel, consumerOffsetsChannel, createDiagnosticContext } from "../../diagnostic.js";
|
|
5
|
-
import { protocolErrors, UserError } from "../../errors.js";
|
|
5
|
+
import { findErrorBy, NetworkError, protocolErrors, UserError } from "../../errors.js";
|
|
6
6
|
import { INT32_SIZE } from "../../protocol/definitions.js";
|
|
7
7
|
import { Reader } from "../../protocol/reader.js";
|
|
8
8
|
import { IS_CONTROL } from "../../protocol/records.js";
|
|
9
9
|
import { Writer } from "../../protocol/writer.js";
|
|
10
|
-
import { kAutocommit, kRefreshOffsetsAndFetch } from "../../symbols.js";
|
|
10
|
+
import { kAutocommit, kGetFetchNode, kRefreshOffsetsAndFetch } from "../../symbols.js";
|
|
11
11
|
import { emitExperimentalApiWarning } from "../../utils.js";
|
|
12
12
|
import { Base, kAfterCreate, kCheckNotClosed, kClosed, kConnections, kCreateConnectionPool, kFormatValidationErrors, kGetApi, kGetBootstrapConnection, kGetConnection, kMetadata, kOptions, kPerformDeduplicated, kPerformWithRetry, kPrometheus, kValidateOptions } from "../base/base.js";
|
|
13
13
|
import { ensureMetric } from "../metrics.js";
|
|
@@ -15,6 +15,7 @@ import { MessagesStream } from "./messages-stream.js";
|
|
|
15
15
|
import { commitOptionsValidator, consumeOptionsValidator, consumerOptionsValidator, defaultConsumerOptions, fetchOptionsValidator, getLagOptionsValidator, groupIdAndOptionsValidator, groupOptionsValidator, listCommitsOptionsValidator, listOffsetsOptionsValidator } from "./options.js";
|
|
16
16
|
import { roundRobinAssigner } from "./partitions-assigners.js";
|
|
17
17
|
import { TopicsMap } from "./topics-map.js";
|
|
18
|
+
import { nextFetchEpoch, partitionKey } from "./utils.js";
|
|
18
19
|
export class Consumer extends Base {
|
|
19
20
|
groupId;
|
|
20
21
|
groupInstanceId;
|
|
@@ -31,9 +32,16 @@ export class Consumer extends Base {
|
|
|
31
32
|
#heartbeatInterval;
|
|
32
33
|
#lastHeartbeatIntervalMs;
|
|
33
34
|
#lastHeartbeat;
|
|
35
|
+
#heartbeatStallTimer;
|
|
36
|
+
#heartbeatStallStart;
|
|
37
|
+
#heartbeatStalled;
|
|
38
|
+
#heartbeatStallError;
|
|
34
39
|
#useConsumerGroupProtocol;
|
|
35
40
|
#memberEpoch;
|
|
36
41
|
#groupRemoteAssignor;
|
|
42
|
+
#clientRack;
|
|
43
|
+
#fetchSessions;
|
|
44
|
+
#preferredReadReplicas;
|
|
37
45
|
#streams;
|
|
38
46
|
#lagMonitoring;
|
|
39
47
|
#streamContext;
|
|
@@ -73,11 +81,18 @@ export class Consumer extends Base {
|
|
|
73
81
|
this.#heartbeatInterval = null;
|
|
74
82
|
this.#lastHeartbeatIntervalMs = 0;
|
|
75
83
|
this.#lastHeartbeat = null;
|
|
84
|
+
this.#heartbeatStallTimer = null;
|
|
85
|
+
this.#heartbeatStallStart = null;
|
|
86
|
+
this.#heartbeatStalled = false;
|
|
87
|
+
this.#heartbeatStallError = undefined;
|
|
76
88
|
this.#streams = new Set();
|
|
77
89
|
this.#lagMonitoring = null;
|
|
78
90
|
this.#memberEpoch = 0;
|
|
79
91
|
this.#useConsumerGroupProtocol = this[kOptions].groupProtocol === 'consumer';
|
|
80
92
|
this.#groupRemoteAssignor = this[kOptions].groupRemoteAssignor ?? null;
|
|
93
|
+
this.#clientRack = this[kOptions].clientRack ?? '';
|
|
94
|
+
this.#fetchSessions = new Map();
|
|
95
|
+
this.#preferredReadReplicas = new Map();
|
|
81
96
|
this.#streamContext = options.streamContext ?? options.context;
|
|
82
97
|
this.#validateGroupOptions(this[kOptions], groupIdAndOptionsValidator);
|
|
83
98
|
if (this[kPrometheus]) {
|
|
@@ -114,6 +129,7 @@ export class Consumer extends Base {
|
|
|
114
129
|
}
|
|
115
130
|
this[kClosed] = true;
|
|
116
131
|
clearTimeout(this.#lagMonitoring);
|
|
132
|
+
this.#resetHeartbeatStall();
|
|
117
133
|
let closer;
|
|
118
134
|
if (this.#useConsumerGroupProtocol) {
|
|
119
135
|
closer = this.#leaveGroupConsumerProtocol.bind(this);
|
|
@@ -139,6 +155,7 @@ export class Consumer extends Base {
|
|
|
139
155
|
return;
|
|
140
156
|
}
|
|
141
157
|
this.topics.clear();
|
|
158
|
+
this.#fetchSessions.clear();
|
|
142
159
|
if (this[kPrometheus]) {
|
|
143
160
|
ensureMetric(this[kPrometheus], 'Gauge', 'kafka_consumers', 'Number of active Kafka consumers').dec();
|
|
144
161
|
}
|
|
@@ -170,6 +187,10 @@ export class Consumer extends Base {
|
|
|
170
187
|
callback(validationError);
|
|
171
188
|
return callback[kCallbackPromise];
|
|
172
189
|
}
|
|
190
|
+
if (options.onCorruptedMessage && options.onDeserializationError) {
|
|
191
|
+
callback(new UserError('Cannot specify both onCorruptedMessage and onDeserializationError.'));
|
|
192
|
+
return callback[kCallbackPromise];
|
|
193
|
+
}
|
|
173
194
|
options.autocommit ??= this[kOptions].autocommit ?? true;
|
|
174
195
|
options.maxBytes ??= this[kOptions].maxBytes;
|
|
175
196
|
options.maxBytesPerPartition ??= this[kOptions].maxBytesPerPartition ?? options.maxBytes;
|
|
@@ -354,7 +375,7 @@ export class Consumer extends Base {
|
|
|
354
375
|
if (this[kCheckNotClosed](callback)) {
|
|
355
376
|
return callback[kCallbackPromise];
|
|
356
377
|
}
|
|
357
|
-
if (this.#coordinatorId) {
|
|
378
|
+
if (this.#coordinatorId !== null) {
|
|
358
379
|
callback(null, this.#coordinatorId);
|
|
359
380
|
return callback[kCallbackPromise];
|
|
360
381
|
}
|
|
@@ -387,6 +408,10 @@ export class Consumer extends Base {
|
|
|
387
408
|
options.rebalanceTimeout ??= this[kOptions].rebalanceTimeout;
|
|
388
409
|
options.heartbeatInterval ??= this[kOptions].heartbeatInterval;
|
|
389
410
|
options.protocols ??= this[kOptions].protocols;
|
|
411
|
+
const protocolsMetadata = this[kOptions].protocolsMetadata;
|
|
412
|
+
if (!options.protocolsMetadata && protocolsMetadata) {
|
|
413
|
+
options.protocolsMetadata = protocolsMetadata;
|
|
414
|
+
}
|
|
390
415
|
this.#validateGroupOptions(options);
|
|
391
416
|
this.#membershipActive = true;
|
|
392
417
|
this.#joinGroup(options, callback);
|
|
@@ -408,6 +433,7 @@ export class Consumer extends Base {
|
|
|
408
433
|
return callback[kCallbackPromise];
|
|
409
434
|
}
|
|
410
435
|
this.#membershipActive = false;
|
|
436
|
+
this.#resetHeartbeatStall();
|
|
411
437
|
this.#leaveGroupClassicProtocol(force, error => {
|
|
412
438
|
if (error) {
|
|
413
439
|
this.#membershipActive = true;
|
|
@@ -422,22 +448,76 @@ export class Consumer extends Base {
|
|
|
422
448
|
#consume(options, callback) {
|
|
423
449
|
consumerConsumesChannel.traceCallback(this.#performConsume, 2, createDiagnosticContext({ client: this, operation: 'consume', options }), this, options, true, callback);
|
|
424
450
|
}
|
|
451
|
+
[kGetFetchNode](metadata, topic, partition, now) {
|
|
452
|
+
const partitionMetadata = metadata.topics.get(topic).partitions[partition];
|
|
453
|
+
const key = partitionKey(topic, partition);
|
|
454
|
+
const preferredReadReplica = this.#preferredReadReplicas.get(key);
|
|
455
|
+
if (preferredReadReplica === undefined) {
|
|
456
|
+
return partitionMetadata.leader;
|
|
457
|
+
}
|
|
458
|
+
if (now > preferredReadReplica.expiresAt) {
|
|
459
|
+
this.#preferredReadReplicas.delete(key);
|
|
460
|
+
return partitionMetadata.leader;
|
|
461
|
+
}
|
|
462
|
+
if (metadata.brokers.has(preferredReadReplica.node) &&
|
|
463
|
+
partitionMetadata.replicas.includes(preferredReadReplica.node) &&
|
|
464
|
+
!partitionMetadata.offlineReplicas.includes(preferredReadReplica.node)) {
|
|
465
|
+
return preferredReadReplica.node;
|
|
466
|
+
}
|
|
467
|
+
this.#preferredReadReplicas.delete(key);
|
|
468
|
+
this.clearMetadata();
|
|
469
|
+
return partitionMetadata.leader;
|
|
470
|
+
}
|
|
471
|
+
#topicIdsById(metadata) {
|
|
472
|
+
const topicIds = new Map();
|
|
473
|
+
for (const [topic, { id }] of metadata.topics) {
|
|
474
|
+
topicIds.set(id, topic);
|
|
475
|
+
}
|
|
476
|
+
return topicIds;
|
|
477
|
+
}
|
|
478
|
+
#fetchNodeForRequest(metadata, fallbackNode, topics, topicIds, now) {
|
|
479
|
+
let requestNode;
|
|
480
|
+
for (const topicRequest of topics) {
|
|
481
|
+
const topic = topicIds.get(topicRequest.topicId);
|
|
482
|
+
if (!topic) {
|
|
483
|
+
return fallbackNode;
|
|
484
|
+
}
|
|
485
|
+
for (const { partition } of topicRequest.partitions) {
|
|
486
|
+
const node = this[kGetFetchNode](metadata, topic, partition, now);
|
|
487
|
+
if (requestNode === undefined) {
|
|
488
|
+
requestNode = node;
|
|
489
|
+
}
|
|
490
|
+
else if (requestNode !== node) {
|
|
491
|
+
return fallbackNode;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return requestNode ?? fallbackNode;
|
|
496
|
+
}
|
|
425
497
|
#fetch(options, callback) {
|
|
426
498
|
const isolationLevel = options.isolationLevel ?? this[kOptions].isolationLevel;
|
|
499
|
+
let refreshMetadata = false;
|
|
427
500
|
this[kPerformWithRetry]('fetch', retryCallback => {
|
|
428
|
-
this[kMetadata]({ topics: this.topics.current }, (error, metadata) => {
|
|
501
|
+
this[kMetadata]({ topics: this.topics.current, forceUpdate: refreshMetadata }, (error, metadata) => {
|
|
429
502
|
if (error) {
|
|
503
|
+
refreshMetadata = NetworkError.isRetryable(error);
|
|
430
504
|
retryCallback(error);
|
|
431
505
|
return;
|
|
432
506
|
}
|
|
433
|
-
|
|
507
|
+
refreshMetadata = false;
|
|
508
|
+
const topicIds = this.#topicIdsById(metadata);
|
|
509
|
+
const node = this.#fetchNodeForRequest(metadata, options.node, options.topics, topicIds, Date.now());
|
|
510
|
+
const broker = metadata.brokers.get(node);
|
|
434
511
|
if (!broker) {
|
|
435
|
-
retryCallback(new UserError(`Cannot find broker with node id ${
|
|
512
|
+
retryCallback(new UserError(`Cannot find broker with node id ${node}`));
|
|
436
513
|
return;
|
|
437
514
|
}
|
|
438
515
|
const pool = options.connectionPool ?? this[kConnections];
|
|
439
516
|
pool.get(broker, (error, connection) => {
|
|
440
517
|
if (error) {
|
|
518
|
+
refreshMetadata = NetworkError.isRetryable(error);
|
|
519
|
+
this.#clearPreferredReadReplicas(options.topics, topicIds);
|
|
520
|
+
this.#fetchSessions.delete(node);
|
|
441
521
|
// When a connection was not available (either interrupted or not available) we
|
|
442
522
|
// reset the leader epoch in the options so that when connection is re-established again we can continue
|
|
443
523
|
for (const topic of options.topics) {
|
|
@@ -451,13 +531,107 @@ export class Consumer extends Base {
|
|
|
451
531
|
}
|
|
452
532
|
this[kGetApi]('Fetch', (error, api) => {
|
|
453
533
|
if (error) {
|
|
534
|
+
refreshMetadata = NetworkError.isRetryable(error);
|
|
454
535
|
retryCallback(error);
|
|
455
536
|
return;
|
|
456
537
|
}
|
|
457
|
-
|
|
538
|
+
let session = this.#fetchSessions.get(node);
|
|
539
|
+
if (session && session.pool !== pool) {
|
|
540
|
+
session = undefined;
|
|
541
|
+
}
|
|
542
|
+
const sessionId = session?.id ?? 0;
|
|
543
|
+
const sessionEpoch = session?.epoch ?? 0;
|
|
544
|
+
// The desired state of the session: options.topics always lists all the wanted partitions
|
|
545
|
+
const desired = new Map();
|
|
546
|
+
for (const topic of options.topics) {
|
|
547
|
+
let partitions = desired.get(topic.topicId);
|
|
548
|
+
if (!partitions) {
|
|
549
|
+
partitions = new Map();
|
|
550
|
+
desired.set(topic.topicId, partitions);
|
|
551
|
+
}
|
|
552
|
+
for (const partition of topic.partitions) {
|
|
553
|
+
// Copy the partition since the data is mutated in the error paths
|
|
554
|
+
partitions.set(partition.partition, { ...partition });
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
let requestTopics = options.topics;
|
|
558
|
+
const forgottenTopicsData = [];
|
|
559
|
+
if (session) {
|
|
560
|
+
// Only send the partitions which are new or whose state changed: the broker
|
|
561
|
+
// keeps serving the unchanged ones from the session (KIP-227)
|
|
562
|
+
requestTopics = [];
|
|
563
|
+
for (const [topicId, partitions] of desired) {
|
|
564
|
+
const cached = session.partitions.get(topicId);
|
|
565
|
+
const changed = [];
|
|
566
|
+
for (const partition of partitions.values()) {
|
|
567
|
+
const previous = cached?.get(partition.partition);
|
|
568
|
+
if (!previous ||
|
|
569
|
+
previous.fetchOffset !== partition.fetchOffset ||
|
|
570
|
+
previous.currentLeaderEpoch !== partition.currentLeaderEpoch ||
|
|
571
|
+
previous.lastFetchedEpoch !== partition.lastFetchedEpoch ||
|
|
572
|
+
previous.partitionMaxBytes !== partition.partitionMaxBytes) {
|
|
573
|
+
changed.push(partition);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
if (changed.length > 0) {
|
|
577
|
+
requestTopics.push({ topicId, partitions: changed });
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
// Ask the broker to remove from the session the partitions which are no
|
|
581
|
+
// longer wanted, otherwise it keeps serving them forever
|
|
582
|
+
for (const [topicId, partitions] of session.partitions) {
|
|
583
|
+
const stillDesired = desired.get(topicId);
|
|
584
|
+
const forgotten = [];
|
|
585
|
+
for (const partition of partitions.keys()) {
|
|
586
|
+
if (!stillDesired?.has(partition)) {
|
|
587
|
+
forgotten.push(partition);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
if (forgotten.length > 0) {
|
|
591
|
+
forgottenTopicsData.push({ topic: topicId, partitions: forgotten });
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
// Fetch v12 identifies topics by name, while later versions use UUIDs.
|
|
596
|
+
const useTopicNames = api.version <= 12;
|
|
597
|
+
let topicIdsByName;
|
|
598
|
+
if (useTopicNames) {
|
|
599
|
+
// Built here rather than in the response callback so that the fetch loop allocates
|
|
600
|
+
// it once per request instead of once per request and once per response.
|
|
601
|
+
topicIdsByName = new Map();
|
|
602
|
+
for (const [id, name] of topicIds) {
|
|
603
|
+
topicIdsByName.set(name, id);
|
|
604
|
+
}
|
|
605
|
+
requestTopics = requestTopics.map(topic => ({
|
|
606
|
+
...topic,
|
|
607
|
+
topicId: topicIds.get(topic.topicId) ?? topic.topicId
|
|
608
|
+
}));
|
|
609
|
+
for (const forgotten of forgottenTopicsData) {
|
|
610
|
+
const topicId = forgotten.topicId ?? forgotten.topic;
|
|
611
|
+
forgotten.topicId = topicIds.get(topicId) ?? topicId;
|
|
612
|
+
delete forgotten.topic;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
api(connection, options.maxWaitTime ?? this[kOptions].maxWaitTime, options.minBytes ?? this[kOptions].minBytes, options.maxBytes ?? this[kOptions].maxBytes, isolationLevel, sessionId, sessionEpoch, requestTopics, forgottenTopicsData, this.#clientRack, (error, result) => {
|
|
616
|
+
const response = result ?? error?.response;
|
|
617
|
+
if (response && !response.nodeEndpoints) {
|
|
618
|
+
response.nodeEndpoints = [];
|
|
619
|
+
}
|
|
620
|
+
if (useTopicNames && response) {
|
|
621
|
+
for (const topic of response.responses) {
|
|
622
|
+
topic.topicId = topicIdsByName.get(topic.topicId) ?? topic.topicId;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
458
625
|
if (error) {
|
|
459
|
-
|
|
460
|
-
|
|
626
|
+
refreshMetadata = NetworkError.isRetryable(error);
|
|
627
|
+
this.#clearPreferredReadReplicas(options.topics, topicIds);
|
|
628
|
+
if (findErrorBy(error, 'apiId', 'FETCH_SESSION_ID_NOT_FOUND') ||
|
|
629
|
+
findErrorBy(error, 'apiId', 'INVALID_FETCH_SESSION_EPOCH') ||
|
|
630
|
+
findErrorBy(error, 'apiId', 'FETCH_SESSION_TOPIC_ID_ERROR')) {
|
|
631
|
+
this.#fetchSessions.delete(node);
|
|
632
|
+
}
|
|
633
|
+
if (findErrorBy(error, 'apiId', 'FENCED_LEADER_EPOCH')) {
|
|
634
|
+
this.#fetchSessions.delete(node);
|
|
461
635
|
this.clearMetadata();
|
|
462
636
|
for (const topic of options.topics) {
|
|
463
637
|
for (const partition of topic.partitions) {
|
|
@@ -467,6 +641,10 @@ export class Consumer extends Base {
|
|
|
467
641
|
}
|
|
468
642
|
}
|
|
469
643
|
}
|
|
644
|
+
else {
|
|
645
|
+
this.#updatePreferredReadReplicas(metadata, topicIds, result);
|
|
646
|
+
this.#updateFetchSession(node, pool, sessionEpoch, result.sessionId, desired);
|
|
647
|
+
}
|
|
470
648
|
retryCallback(error, result);
|
|
471
649
|
});
|
|
472
650
|
});
|
|
@@ -484,6 +662,20 @@ export class Consumer extends Base {
|
|
|
484
662
|
callback(error, response);
|
|
485
663
|
}, 0);
|
|
486
664
|
}
|
|
665
|
+
#updateFetchSession(node, pool, sentEpoch, responseSessionId, desired) {
|
|
666
|
+
if (!responseSessionId) {
|
|
667
|
+
this.#fetchSessions.delete(node);
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
// After a successful fetch the broker session contains exactly the desired partitions:
|
|
671
|
+
// unchanged ones already matched it, changed ones were sent and removed ones were forgotten
|
|
672
|
+
this.#fetchSessions.set(node, {
|
|
673
|
+
id: responseSessionId,
|
|
674
|
+
epoch: nextFetchEpoch(sentEpoch),
|
|
675
|
+
pool,
|
|
676
|
+
partitions: desired
|
|
677
|
+
});
|
|
678
|
+
}
|
|
487
679
|
#commit(options, callback, rejoinAttempts = 0) {
|
|
488
680
|
this.#performGroupOperation('commit', (connection, groupCallback) => {
|
|
489
681
|
const topics = new Map();
|
|
@@ -521,12 +713,12 @@ export class Consumer extends Base {
|
|
|
521
713
|
callback(error);
|
|
522
714
|
});
|
|
523
715
|
}
|
|
524
|
-
#listOffsets(withTimestamps, options, callback) {
|
|
716
|
+
#listOffsets(withTimestamps, options, callback, forceUpdateMetadata = false) {
|
|
525
717
|
let topics = options.topics;
|
|
526
718
|
if (!topics || topics.length === 0) {
|
|
527
719
|
topics = this.topics.current;
|
|
528
720
|
}
|
|
529
|
-
this[kMetadata]({ topics }, (error, metadata) => {
|
|
721
|
+
this[kMetadata]({ topics, forceUpdate: forceUpdateMetadata }, (error, metadata) => {
|
|
530
722
|
if (error) {
|
|
531
723
|
callback(error);
|
|
532
724
|
return;
|
|
@@ -581,7 +773,12 @@ export class Consumer extends Base {
|
|
|
581
773
|
}, concurrentCallback, 0);
|
|
582
774
|
}, (error, responses) => {
|
|
583
775
|
if (error) {
|
|
584
|
-
|
|
776
|
+
if (!forceUpdateMetadata && NetworkError.isRetryable(error)) {
|
|
777
|
+
this.clearMetadata();
|
|
778
|
+
this.#listOffsets(withTimestamps, options, callback, true);
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
callback(this.#handleError(error));
|
|
585
782
|
return;
|
|
586
783
|
}
|
|
587
784
|
let offsets = new Map();
|
|
@@ -637,23 +834,33 @@ export class Consumer extends Base {
|
|
|
637
834
|
memberEpoch: this.#useConsumerGroupProtocol ? this.#memberEpoch : -1,
|
|
638
835
|
topics
|
|
639
836
|
}
|
|
640
|
-
], false,
|
|
837
|
+
], false, (error, response) => {
|
|
838
|
+
if (error || api.version >= 8) {
|
|
839
|
+
groupCallback(error, response);
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
const legacyResponse = response;
|
|
843
|
+
groupCallback(null, {
|
|
844
|
+
throttleTimeMs: legacyResponse.throttleTimeMs,
|
|
845
|
+
groups: [{ groupId: this.groupId, topics: legacyResponse.topics, errorCode: legacyResponse.errorCode }]
|
|
846
|
+
});
|
|
847
|
+
});
|
|
641
848
|
});
|
|
642
849
|
}, (error, response) => {
|
|
643
850
|
if (error) {
|
|
644
851
|
if (this.#useConsumerGroupProtocol &&
|
|
645
852
|
staleMemberEpochRetries < this[kOptions].retries &&
|
|
646
|
-
error
|
|
853
|
+
findErrorBy(error, 'apiId', 'STALE_MEMBER_EPOCH')) {
|
|
647
854
|
this.#consumerGroupHeartbeat(this[kOptions], heartbeatError => {
|
|
648
855
|
if (heartbeatError) {
|
|
649
|
-
callback(this.#
|
|
856
|
+
callback(this.#handleError(heartbeatError));
|
|
650
857
|
return;
|
|
651
858
|
}
|
|
652
859
|
this.#listCommittedOffsets(options, callback, staleMemberEpochRetries + 1);
|
|
653
860
|
});
|
|
654
861
|
return;
|
|
655
862
|
}
|
|
656
|
-
callback(this.#
|
|
863
|
+
callback(this.#handleError(error));
|
|
657
864
|
return;
|
|
658
865
|
}
|
|
659
866
|
const committed = new Map();
|
|
@@ -671,7 +878,7 @@ export class Consumer extends Base {
|
|
|
671
878
|
});
|
|
672
879
|
}
|
|
673
880
|
#findGroupCoordinator(callback) {
|
|
674
|
-
if (this.#coordinatorId) {
|
|
881
|
+
if (this.#coordinatorId !== null) {
|
|
675
882
|
callback(null, this.#coordinatorId);
|
|
676
883
|
return;
|
|
677
884
|
}
|
|
@@ -695,6 +902,7 @@ export class Consumer extends Base {
|
|
|
695
902
|
return;
|
|
696
903
|
}
|
|
697
904
|
this.emitWithDebug('consumer:heartbeat', 'start', eventPayload);
|
|
905
|
+
this.#trackHeartbeatStall(options);
|
|
698
906
|
this[kGetApi]('Heartbeat', (error, api) => {
|
|
699
907
|
if (error) {
|
|
700
908
|
groupCallback(error);
|
|
@@ -711,21 +919,43 @@ export class Consumer extends Base {
|
|
|
711
919
|
if (error) {
|
|
712
920
|
this.#cancelHeartbeat();
|
|
713
921
|
if (this.#getRejoinError(error)) {
|
|
922
|
+
// A rejoin can legitimately block up to rebalanceTimeout:
|
|
923
|
+
// - extend the stall window by that bound rather than pausing it
|
|
924
|
+
// - a rejoin that never completes still surfaces as a stall
|
|
925
|
+
this.#resetHeartbeatStall();
|
|
926
|
+
this.#trackHeartbeatStall(options, error, options.rebalanceTimeout + this.#heartbeatStallTimeoutFor(options));
|
|
714
927
|
this[kPerformWithRetry]('rejoinGroup', retryCallback => {
|
|
715
928
|
this.#joinGroup(options, retryCallback);
|
|
716
929
|
}, error => {
|
|
717
930
|
if (error) {
|
|
718
931
|
this.emitWithDebug(null, 'error', error);
|
|
932
|
+
if (!this.#heartbeatStalled) {
|
|
933
|
+
// No more heartbeats will be scheduled: restart the stall window without
|
|
934
|
+
// the rejoin grace, keeping the triggering heartbeat error as lastError.
|
|
935
|
+
const heartbeatError = this.#heartbeatStallError;
|
|
936
|
+
this.#resetHeartbeatStall();
|
|
937
|
+
this.#trackHeartbeatStall(options, heartbeatError);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
else {
|
|
941
|
+
// Rejoin succeeded: drop the extended window; the next heartbeat opens the normal one.
|
|
942
|
+
this.#resetHeartbeatStall();
|
|
719
943
|
}
|
|
720
944
|
this.emitWithDebug('consumer', 'rejoin');
|
|
721
945
|
}, 0);
|
|
722
946
|
return;
|
|
723
947
|
}
|
|
948
|
+
// The error was not group related, so we schedule another heartbeat.
|
|
949
|
+
// Do this before notifying listeners so they can still cancel it.
|
|
950
|
+
this.#heartbeatInterval = setTimeout(() => {
|
|
951
|
+
this.#heartbeat(options);
|
|
952
|
+
}, options.heartbeatInterval);
|
|
724
953
|
this.emitWithDebug('consumer:heartbeat', 'error', { ...eventPayload, error });
|
|
725
|
-
|
|
954
|
+
this.#trackHeartbeatStall(options, error);
|
|
726
955
|
}
|
|
727
956
|
else {
|
|
728
957
|
this.#lastHeartbeat = new Date();
|
|
958
|
+
this.#resetHeartbeatStall();
|
|
729
959
|
this.emitWithDebug('consumer:heartbeat', 'end', eventPayload);
|
|
730
960
|
}
|
|
731
961
|
this.#heartbeatInterval?.refresh();
|
|
@@ -735,6 +965,47 @@ export class Consumer extends Base {
|
|
|
735
965
|
clearTimeout(this.#heartbeatInterval);
|
|
736
966
|
this.#heartbeatInterval = null;
|
|
737
967
|
}
|
|
968
|
+
#heartbeatStallTimeoutFor(options) {
|
|
969
|
+
return (options.heartbeatStallTimeout ??
|
|
970
|
+
this[kOptions].heartbeatStallTimeout ??
|
|
971
|
+
options.rebalanceTimeout ??
|
|
972
|
+
this[kOptions].rebalanceTimeout ??
|
|
973
|
+
defaultConsumerOptions.rebalanceTimeout);
|
|
974
|
+
}
|
|
975
|
+
// Opens the stall window on the first heartbeat attempt after the last success.
|
|
976
|
+
// The window survives retries and only #resetHeartbeatStall closes it.
|
|
977
|
+
#trackHeartbeatStall(options, error, timeout) {
|
|
978
|
+
if (error) {
|
|
979
|
+
this.#heartbeatStallError = error;
|
|
980
|
+
}
|
|
981
|
+
if (this.#heartbeatStalled || this.#heartbeatStallTimer) {
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
timeout ??= this.#heartbeatStallTimeoutFor(options);
|
|
985
|
+
this.#heartbeatStallStart = Date.now();
|
|
986
|
+
this.#heartbeatStallTimer = setTimeout(() => {
|
|
987
|
+
this.#heartbeatStallTimer = null;
|
|
988
|
+
// Emit once per stall episode. The next successful heartbeat re-arms the tracking.
|
|
989
|
+
this.#heartbeatStalled = true;
|
|
990
|
+
if (this[kClosed] || !this.#membershipActive) {
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
this.emitWithDebug('consumer:heartbeat', 'stalled', {
|
|
994
|
+
lastError: this.#heartbeatStallError,
|
|
995
|
+
lastHeartbeat: this.#lastHeartbeat,
|
|
996
|
+
stalledFor: Date.now() - this.#heartbeatStallStart
|
|
997
|
+
});
|
|
998
|
+
}, timeout);
|
|
999
|
+
}
|
|
1000
|
+
#resetHeartbeatStall() {
|
|
1001
|
+
if (this.#heartbeatStallTimer) {
|
|
1002
|
+
clearTimeout(this.#heartbeatStallTimer);
|
|
1003
|
+
this.#heartbeatStallTimer = null;
|
|
1004
|
+
}
|
|
1005
|
+
this.#heartbeatStallStart = null;
|
|
1006
|
+
this.#heartbeatStalled = false;
|
|
1007
|
+
this.#heartbeatStallError = undefined;
|
|
1008
|
+
}
|
|
738
1009
|
#consumerGroupHeartbeat(options, callback) {
|
|
739
1010
|
options.rebalanceTimeout ??= this[kOptions].rebalanceTimeout;
|
|
740
1011
|
consumerHeartbeatChannel.traceCallback(this.#performConsumerGroupHeartbeat, 1, createDiagnosticContext({ client: this, operation: 'consumerGroupHeartbeat' }), this, options, callback);
|
|
@@ -742,17 +1013,18 @@ export class Consumer extends Base {
|
|
|
742
1013
|
#performConsumerGroupHeartbeat(options, callback) {
|
|
743
1014
|
this.#performGroupOperation('consumerGroupHeartbeat', (connection, groupCallback) => {
|
|
744
1015
|
this.emitWithDebug('consumer:heartbeat', 'start');
|
|
1016
|
+
this.#trackHeartbeatStall(options);
|
|
745
1017
|
this[kGetApi]('ConsumerGroupHeartbeat', (error, api) => {
|
|
746
1018
|
if (error) {
|
|
747
1019
|
groupCallback(error);
|
|
748
1020
|
return;
|
|
749
1021
|
}
|
|
750
1022
|
const memberId = this.#getConsumerGroupHeartbeatMemberId(api.version);
|
|
751
|
-
api(connection, this.groupId, memberId, this.#memberEpoch, this.groupInstanceId, null,
|
|
752
|
-
options.rebalanceTimeout, this.topics.current, null, this.#groupRemoteAssignor, this.#assignments, groupCallback);
|
|
1023
|
+
api(connection, this.groupId, memberId, this.#memberEpoch, this.groupInstanceId, this.#clientRack || null, options.rebalanceTimeout, this.topics.current, null, this.#groupRemoteAssignor, this.#assignments, groupCallback);
|
|
753
1024
|
});
|
|
754
1025
|
}, (error, response) => {
|
|
755
1026
|
if (this[kClosed]) {
|
|
1027
|
+
this.#resetHeartbeatStall();
|
|
756
1028
|
this.emitWithDebug('consumer:heartbeat', 'end');
|
|
757
1029
|
callback(null);
|
|
758
1030
|
return;
|
|
@@ -760,10 +1032,12 @@ export class Consumer extends Base {
|
|
|
760
1032
|
if (error) {
|
|
761
1033
|
this.#cancelHeartbeat();
|
|
762
1034
|
this.emitWithDebug('consumer:heartbeat', 'error', { error });
|
|
1035
|
+
this.#trackHeartbeatStall(options, error);
|
|
763
1036
|
const fenced = error.response?.errorCode === protocolErrors.FENCED_MEMBER_EPOCH.code;
|
|
764
1037
|
if (fenced) {
|
|
765
1038
|
this.#assignments = [];
|
|
766
1039
|
this.assignments = [];
|
|
1040
|
+
this.#syncPreferredReadReplicas();
|
|
767
1041
|
this.#memberEpoch = 0;
|
|
768
1042
|
this.#consumerGroupHeartbeat(options, () => { });
|
|
769
1043
|
callback(error);
|
|
@@ -776,6 +1050,7 @@ export class Consumer extends Base {
|
|
|
776
1050
|
return;
|
|
777
1051
|
}
|
|
778
1052
|
this.#lastHeartbeat = new Date();
|
|
1053
|
+
this.#resetHeartbeatStall();
|
|
779
1054
|
this.#memberEpoch = response.memberEpoch;
|
|
780
1055
|
if (response.memberId) {
|
|
781
1056
|
const changed = this.memberId !== response.memberId;
|
|
@@ -825,6 +1100,7 @@ export class Consumer extends Base {
|
|
|
825
1100
|
if (toRevoke.length === 0) {
|
|
826
1101
|
return;
|
|
827
1102
|
}
|
|
1103
|
+
this.emitWithDebug('consumer', 'group:rebalance', { groupId: this.groupId });
|
|
828
1104
|
for (const stream of this.#streams) {
|
|
829
1105
|
stream.pause();
|
|
830
1106
|
stream[kAutocommit]();
|
|
@@ -878,6 +1154,7 @@ export class Consumer extends Base {
|
|
|
878
1154
|
}));
|
|
879
1155
|
this.#assignments = newAssignments;
|
|
880
1156
|
this.assignments = assignments;
|
|
1157
|
+
this.#syncPreferredReadReplicas();
|
|
881
1158
|
callback(null);
|
|
882
1159
|
});
|
|
883
1160
|
}
|
|
@@ -892,7 +1169,35 @@ export class Consumer extends Base {
|
|
|
892
1169
|
callback(err);
|
|
893
1170
|
});
|
|
894
1171
|
}
|
|
895
|
-
#leaveGroupConsumerProtocol(
|
|
1172
|
+
#leaveGroupConsumerProtocol(force, callback) {
|
|
1173
|
+
// Remove streams that might have been exited in the meanwhile
|
|
1174
|
+
for (const stream of this.#streams) {
|
|
1175
|
+
if (stream.closed || stream.destroyed) {
|
|
1176
|
+
this.#streams.delete(stream);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
// Active streams must be closed before leaving the group, exactly like in the classic protocol.
|
|
1180
|
+
// Their fetch loop keeps running until they are closed and, since Consumer.close marks the client
|
|
1181
|
+
// as closed before leaving, any fetch scheduled in the meanwhile would fail with "Client is closed."
|
|
1182
|
+
// and destroy the stream with an error the user never asked for.
|
|
1183
|
+
if (this.#streams.size) {
|
|
1184
|
+
if (!force) {
|
|
1185
|
+
callback(new UserError('Cannot leave group while consuming messages.'));
|
|
1186
|
+
return;
|
|
1187
|
+
}
|
|
1188
|
+
runConcurrentCallbacks('Closing streams failed.', this.#streams, (stream, concurrentCallback) => {
|
|
1189
|
+
stream.close(concurrentCallback);
|
|
1190
|
+
}, error => {
|
|
1191
|
+
/* c8 ignore next 4 - Hard to test */
|
|
1192
|
+
if (error) {
|
|
1193
|
+
callback(error);
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
// All streams are closed, try the operation again without force
|
|
1197
|
+
this.#leaveGroupConsumerProtocol(false, callback);
|
|
1198
|
+
});
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
896
1201
|
// Leave by sending a heartbeat with memberEpoch = -1
|
|
897
1202
|
this.#cancelHeartbeat();
|
|
898
1203
|
this.#performDeduplicateGroupOperaton('leaveGroupConsumerProtocol', (connection, groupCallback) => {
|
|
@@ -903,8 +1208,7 @@ export class Consumer extends Base {
|
|
|
903
1208
|
}
|
|
904
1209
|
const memberId = this.#getConsumerGroupHeartbeatMemberId(api.version);
|
|
905
1210
|
api(connection, this.groupId, memberId, -1, // memberEpoch = -1 signals leave
|
|
906
|
-
this.groupInstanceId, null, //
|
|
907
|
-
0, // rebalanceTimeout
|
|
1211
|
+
this.groupInstanceId, this.#clientRack || null, 0, // rebalanceTimeout
|
|
908
1212
|
[], // subscribedTopicNames
|
|
909
1213
|
null, // subscribedTopicRegex
|
|
910
1214
|
this.#groupRemoteAssignor, [], // topicPartitions
|
|
@@ -916,6 +1220,7 @@ export class Consumer extends Base {
|
|
|
916
1220
|
this.#memberEpoch = -1;
|
|
917
1221
|
this.#assignments = [];
|
|
918
1222
|
this.assignments = [];
|
|
1223
|
+
this.#syncPreferredReadReplicas();
|
|
919
1224
|
callback(null);
|
|
920
1225
|
});
|
|
921
1226
|
}
|
|
@@ -985,7 +1290,12 @@ export class Consumer extends Base {
|
|
|
985
1290
|
retryCallback(error);
|
|
986
1291
|
return;
|
|
987
1292
|
}
|
|
988
|
-
api(connection, FindCoordinatorKeyTypes.GROUP, [this.groupId],
|
|
1293
|
+
api(connection, FindCoordinatorKeyTypes.GROUP, [this.groupId], (error, response) => {
|
|
1294
|
+
if (response && api.version < 4) {
|
|
1295
|
+
response.coordinators[0].key = this.groupId;
|
|
1296
|
+
}
|
|
1297
|
+
retryCallback(error, response);
|
|
1298
|
+
});
|
|
989
1299
|
});
|
|
990
1300
|
});
|
|
991
1301
|
}, (error, response) => {
|
|
@@ -1005,45 +1315,20 @@ export class Consumer extends Base {
|
|
|
1005
1315
|
return;
|
|
1006
1316
|
}
|
|
1007
1317
|
this.#cancelHeartbeat();
|
|
1008
|
-
|
|
1009
|
-
for (const protocol of options.protocols) {
|
|
1010
|
-
protocols.push({
|
|
1011
|
-
name: protocol.name,
|
|
1012
|
-
metadata: this.#encodeProtocolSubscriptionMetadata(protocol, this.topics.current)
|
|
1013
|
-
});
|
|
1014
|
-
}
|
|
1015
|
-
this.#performDeduplicateGroupOperaton('joinGroup', (connection, groupCallback) => {
|
|
1016
|
-
this[kGetApi]('JoinGroup', (error, api) => {
|
|
1017
|
-
if (error) {
|
|
1018
|
-
groupCallback(error);
|
|
1019
|
-
return;
|
|
1020
|
-
}
|
|
1021
|
-
api(connection, this.groupId, options.sessionTimeout, options.rebalanceTimeout, this.memberId ?? '', this.groupInstanceId, 'consumer', protocols, '', groupCallback);
|
|
1022
|
-
});
|
|
1023
|
-
}, (error, response) => {
|
|
1024
|
-
if (!this.#membershipActive) {
|
|
1025
|
-
callback(null);
|
|
1026
|
-
return;
|
|
1027
|
-
}
|
|
1318
|
+
this.#createJoinGroupProtocols(options, (error, protocols) => {
|
|
1028
1319
|
if (error) {
|
|
1029
|
-
if (this.#getRejoinError(error)) {
|
|
1030
|
-
this.#performJoinGroup(options, callback);
|
|
1031
|
-
return;
|
|
1032
|
-
}
|
|
1033
1320
|
callback(error);
|
|
1034
1321
|
return;
|
|
1035
1322
|
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
}
|
|
1045
|
-
// Send a syncGroup request
|
|
1046
|
-
this.#syncGroup(options.partitionAssigner, (error, response) => {
|
|
1323
|
+
this.#performDeduplicateGroupOperaton('joinGroup', (connection, groupCallback) => {
|
|
1324
|
+
this[kGetApi]('JoinGroup', (error, api) => {
|
|
1325
|
+
if (error) {
|
|
1326
|
+
groupCallback(error);
|
|
1327
|
+
return;
|
|
1328
|
+
}
|
|
1329
|
+
api(connection, this.groupId, options.sessionTimeout, options.rebalanceTimeout, this.memberId ?? '', this.groupInstanceId, 'consumer', protocols, '', groupCallback);
|
|
1330
|
+
});
|
|
1331
|
+
}, (error, response) => {
|
|
1047
1332
|
if (!this.#membershipActive) {
|
|
1048
1333
|
callback(null);
|
|
1049
1334
|
return;
|
|
@@ -1056,19 +1341,44 @@ export class Consumer extends Base {
|
|
|
1056
1341
|
callback(error);
|
|
1057
1342
|
return;
|
|
1058
1343
|
}
|
|
1059
|
-
|
|
1060
|
-
this
|
|
1061
|
-
this
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
this
|
|
1065
|
-
|
|
1066
|
-
memberId
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1344
|
+
// This is for Azure Event Hubs compatibility, which does not respond with an error on the first join
|
|
1345
|
+
this.memberId = response.memberId;
|
|
1346
|
+
this.generationId = response.generationId;
|
|
1347
|
+
this.#isLeader = response.leader === this.memberId;
|
|
1348
|
+
this.#protocol = response.protocolName;
|
|
1349
|
+
this.#members = new Map();
|
|
1350
|
+
for (const member of response.members) {
|
|
1351
|
+
this.#members.set(member.memberId, this.#decodeProtocolSubscriptionMetadata(member.memberId, member.metadata));
|
|
1352
|
+
}
|
|
1353
|
+
// Send a syncGroup request
|
|
1354
|
+
this.#syncGroup(options.partitionAssigner, (error, response) => {
|
|
1355
|
+
if (!this.#membershipActive) {
|
|
1356
|
+
callback(null);
|
|
1357
|
+
return;
|
|
1358
|
+
}
|
|
1359
|
+
if (error) {
|
|
1360
|
+
if (this.#getRejoinError(error)) {
|
|
1361
|
+
this.#performJoinGroup(options, callback);
|
|
1362
|
+
return;
|
|
1363
|
+
}
|
|
1364
|
+
callback(error);
|
|
1365
|
+
return;
|
|
1366
|
+
}
|
|
1367
|
+
this.assignments = response;
|
|
1368
|
+
this.#syncPreferredReadReplicas();
|
|
1369
|
+
this.#cancelHeartbeat();
|
|
1370
|
+
this.#heartbeatInterval = setTimeout(() => {
|
|
1371
|
+
this.#heartbeat(options);
|
|
1372
|
+
}, options.heartbeatInterval);
|
|
1373
|
+
this.emitWithDebug('consumer', 'group:join', {
|
|
1374
|
+
groupId: this.groupId,
|
|
1375
|
+
memberId: this.memberId,
|
|
1376
|
+
generationId: this.generationId,
|
|
1377
|
+
isLeader: this.#isLeader,
|
|
1378
|
+
assignments: this.assignments
|
|
1379
|
+
});
|
|
1380
|
+
callback(null, this.memberId);
|
|
1070
1381
|
});
|
|
1071
|
-
callback(null, this.memberId);
|
|
1072
1382
|
});
|
|
1073
1383
|
});
|
|
1074
1384
|
}
|
|
@@ -1111,7 +1421,7 @@ export class Consumer extends Base {
|
|
|
1111
1421
|
});
|
|
1112
1422
|
}, error => {
|
|
1113
1423
|
if (error) {
|
|
1114
|
-
const unknownMemberError = error
|
|
1424
|
+
const unknownMemberError = findErrorBy(error, 'unknownMemberId', true);
|
|
1115
1425
|
// This is to avoid throwing an error if a group join was cancelled.
|
|
1116
1426
|
if (!unknownMemberError) {
|
|
1117
1427
|
callback(error);
|
|
@@ -1126,6 +1436,7 @@ export class Consumer extends Base {
|
|
|
1126
1436
|
this.memberId = null;
|
|
1127
1437
|
this.generationId = 0;
|
|
1128
1438
|
this.assignments = null;
|
|
1439
|
+
this.#syncPreferredReadReplicas();
|
|
1129
1440
|
callback(null);
|
|
1130
1441
|
});
|
|
1131
1442
|
}
|
|
@@ -1148,9 +1459,15 @@ export class Consumer extends Base {
|
|
|
1148
1459
|
topicSubscriptions.push(subscription);
|
|
1149
1460
|
}
|
|
1150
1461
|
}
|
|
1151
|
-
|
|
1462
|
+
const subscribedTopics = Array.from(topicsSubscriptions.keys());
|
|
1463
|
+
this[kMetadata]({ topics: subscribedTopics }, (error, metadata) => {
|
|
1152
1464
|
if (error) {
|
|
1153
|
-
callback(this.#
|
|
1465
|
+
callback(this.#handleError(error));
|
|
1466
|
+
return;
|
|
1467
|
+
}
|
|
1468
|
+
const missingTopic = subscribedTopics.find(topic => !metadata.topics.has(topic));
|
|
1469
|
+
if (missingTopic) {
|
|
1470
|
+
callback(this.#handleError(new NetworkError(`Cannot compute group assignments: metadata for subscribed topic "${missingTopic}" is not available in the current cluster metadata.`, { canRetry: true, hasStaleMetadata: true })));
|
|
1154
1471
|
return;
|
|
1155
1472
|
}
|
|
1156
1473
|
this.#performSyncGroup(partitionsAssigner, this.#createAssignments(partitionsAssigner, metadata), callback);
|
|
@@ -1188,26 +1505,30 @@ export class Consumer extends Base {
|
|
|
1188
1505
|
}, callback);
|
|
1189
1506
|
}
|
|
1190
1507
|
#performGroupOperation(operationId, operation, callback) {
|
|
1191
|
-
this
|
|
1192
|
-
|
|
1193
|
-
callback(error);
|
|
1194
|
-
return;
|
|
1195
|
-
}
|
|
1196
|
-
this[kMetadata]({ topics: this.topics.current }, (error, metadata) => {
|
|
1508
|
+
this[kPerformWithRetry](operationId, retryCallback => {
|
|
1509
|
+
this.#findGroupCoordinator((error, coordinatorId) => {
|
|
1197
1510
|
if (error) {
|
|
1198
|
-
|
|
1511
|
+
retryCallback(error);
|
|
1199
1512
|
return;
|
|
1200
1513
|
}
|
|
1201
|
-
this[
|
|
1514
|
+
this[kMetadata]({ topics: this.topics.current }, (error, metadata) => {
|
|
1515
|
+
if (error) {
|
|
1516
|
+
retryCallback(this.#handleError(error));
|
|
1517
|
+
return;
|
|
1518
|
+
}
|
|
1202
1519
|
this[kGetConnection](metadata.brokers.get(coordinatorId), (error, connection) => {
|
|
1203
1520
|
if (error) {
|
|
1204
|
-
retryCallback(error);
|
|
1521
|
+
retryCallback(this.#handleError(error));
|
|
1205
1522
|
return;
|
|
1206
1523
|
}
|
|
1207
|
-
operation(connection,
|
|
1524
|
+
operation(connection, (error, result) => {
|
|
1525
|
+
retryCallback(this.#handleError(error), result);
|
|
1526
|
+
});
|
|
1208
1527
|
});
|
|
1209
|
-
}
|
|
1528
|
+
});
|
|
1210
1529
|
});
|
|
1530
|
+
}, (error, result) => {
|
|
1531
|
+
callback(this.#handleError(error), result);
|
|
1211
1532
|
});
|
|
1212
1533
|
}
|
|
1213
1534
|
#validateGroupOptions(options, validator) {
|
|
@@ -1217,6 +1538,61 @@ export class Consumer extends Base {
|
|
|
1217
1538
|
throw new UserError(this[kFormatValidationErrors](validator, '/options'));
|
|
1218
1539
|
}
|
|
1219
1540
|
}
|
|
1541
|
+
#createJoinGroupProtocols(options, callback) {
|
|
1542
|
+
if (typeof options.protocolsMetadata !== 'function') {
|
|
1543
|
+
callback(null, options.protocols.map(protocol => ({
|
|
1544
|
+
name: protocol.name,
|
|
1545
|
+
metadata: this.#encodeProtocolSubscriptionMetadata(protocol, this.topics.current)
|
|
1546
|
+
})));
|
|
1547
|
+
return;
|
|
1548
|
+
}
|
|
1549
|
+
this[kMetadata]({ topics: this.topics.current, forceUpdate: true }, (error, metadata) => {
|
|
1550
|
+
if (error) {
|
|
1551
|
+
callback(this.#handleError(error));
|
|
1552
|
+
return;
|
|
1553
|
+
}
|
|
1554
|
+
this.#resolveProtocolsMetadata(options.protocolsMetadata, options.protocols, this.topics.current, metadata, (error, userData) => {
|
|
1555
|
+
if (error) {
|
|
1556
|
+
callback(error);
|
|
1557
|
+
return;
|
|
1558
|
+
}
|
|
1559
|
+
else if (!Buffer.isBuffer(userData)) {
|
|
1560
|
+
callback(new UserError('protocolsMetadata must resolve to a Buffer.'));
|
|
1561
|
+
return;
|
|
1562
|
+
}
|
|
1563
|
+
callback(null, options.protocols.map(protocol => ({
|
|
1564
|
+
name: protocol.name,
|
|
1565
|
+
metadata: this.#encodeProtocolSubscriptionMetadata({ ...protocol, metadata: userData }, this.topics.current)
|
|
1566
|
+
})));
|
|
1567
|
+
});
|
|
1568
|
+
});
|
|
1569
|
+
}
|
|
1570
|
+
#resolveProtocolsMetadata(protocolsMetadata, protocols, topics, metadata, callback) {
|
|
1571
|
+
let settled = false;
|
|
1572
|
+
function resolveCallback(error, userData) {
|
|
1573
|
+
if (settled) {
|
|
1574
|
+
return;
|
|
1575
|
+
}
|
|
1576
|
+
settled = true;
|
|
1577
|
+
callback(error, userData);
|
|
1578
|
+
}
|
|
1579
|
+
let result;
|
|
1580
|
+
try {
|
|
1581
|
+
result = protocolsMetadata(protocols, topics, metadata, resolveCallback);
|
|
1582
|
+
if (typeof result !== 'undefined') {
|
|
1583
|
+
if (typeof result.then === 'function') {
|
|
1584
|
+
;
|
|
1585
|
+
result.then(userData => process.nextTick(resolveCallback, null, userData), error => process.nextTick(resolveCallback, error));
|
|
1586
|
+
}
|
|
1587
|
+
else {
|
|
1588
|
+
resolveCallback(null, result);
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
catch (error) {
|
|
1593
|
+
resolveCallback(error);
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1220
1596
|
/*
|
|
1221
1597
|
The following two methods follow:
|
|
1222
1598
|
https://github.com/apache/kafka/blob/trunk/clients/src/main/resources/common/message/ConsumerProtocolSubscription.json
|
|
@@ -1300,12 +1676,13 @@ export class Consumer extends Base {
|
|
|
1300
1676
|
if (!partition.records) {
|
|
1301
1677
|
continue;
|
|
1302
1678
|
}
|
|
1303
|
-
|
|
1679
|
+
const abortedTransactions = partition.abortedTransactions ?? [];
|
|
1680
|
+
if (abortedTransactions.length) {
|
|
1304
1681
|
const abortedRanges = new Map();
|
|
1305
1682
|
// Find first offsets
|
|
1306
1683
|
// For last offsets we set -1n as special value. It allows us to detect open ranges, whichs means
|
|
1307
1684
|
// that Kafka has not sent the control marker. In that case we ignore the range for safety.
|
|
1308
|
-
for (const aborted of
|
|
1685
|
+
for (const aborted of abortedTransactions) {
|
|
1309
1686
|
abortedRanges.set(aborted.producerId, [aborted.firstOffset, -1n]);
|
|
1310
1687
|
}
|
|
1311
1688
|
// Now find last offsets
|
|
@@ -1326,7 +1703,7 @@ export class Consumer extends Base {
|
|
|
1326
1703
|
}
|
|
1327
1704
|
}
|
|
1328
1705
|
#getRejoinError(error) {
|
|
1329
|
-
const protocolError = error
|
|
1706
|
+
const protocolError = findErrorBy(error, 'needsRejoin', true);
|
|
1330
1707
|
if (!protocolError) {
|
|
1331
1708
|
return null;
|
|
1332
1709
|
}
|
|
@@ -1345,10 +1722,82 @@ export class Consumer extends Base {
|
|
|
1345
1722
|
}
|
|
1346
1723
|
return protocolError;
|
|
1347
1724
|
}
|
|
1348
|
-
#
|
|
1349
|
-
|
|
1725
|
+
#updatePreferredReadReplicas(metadata, topicIds, response) {
|
|
1726
|
+
for (const topicResponse of response.responses) {
|
|
1727
|
+
const topic = topicIds.get(topicResponse.topicId);
|
|
1728
|
+
if (!topic) {
|
|
1729
|
+
continue;
|
|
1730
|
+
}
|
|
1731
|
+
for (const { partitionIndex: partition, preferredReadReplica } of topicResponse.partitions) {
|
|
1732
|
+
if (preferredReadReplica < 0) {
|
|
1733
|
+
continue;
|
|
1734
|
+
}
|
|
1735
|
+
const partitionMetadata = metadata.topics.get(topic).partitions[partition];
|
|
1736
|
+
const key = partitionKey(topic, partition);
|
|
1737
|
+
if (metadata.brokers.has(preferredReadReplica) &&
|
|
1738
|
+
partitionMetadata.replicas.includes(preferredReadReplica) &&
|
|
1739
|
+
!partitionMetadata.offlineReplicas.includes(preferredReadReplica)) {
|
|
1740
|
+
const cachedPreferredReadReplica = this.#preferredReadReplicas.get(key);
|
|
1741
|
+
if (cachedPreferredReadReplica?.node !== preferredReadReplica) {
|
|
1742
|
+
this.#preferredReadReplicas.set(key, {
|
|
1743
|
+
node: preferredReadReplica,
|
|
1744
|
+
expiresAt: Date.now() + this[kOptions].metadataMaxAge
|
|
1745
|
+
});
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
else {
|
|
1749
|
+
this.#preferredReadReplicas.delete(key);
|
|
1750
|
+
this.clearMetadata();
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
#clearPreferredReadReplicas(topics, topicIds) {
|
|
1756
|
+
let cleared = false;
|
|
1757
|
+
for (const topicRequest of topics) {
|
|
1758
|
+
const topic = topicIds.get(topicRequest.topicId);
|
|
1759
|
+
if (!topic) {
|
|
1760
|
+
continue;
|
|
1761
|
+
}
|
|
1762
|
+
for (const { partition } of topicRequest.partitions) {
|
|
1763
|
+
cleared = this.#preferredReadReplicas.delete(partitionKey(topic, partition)) || cleared;
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
return cleared;
|
|
1767
|
+
}
|
|
1768
|
+
// Drops cached preferred replicas for partitions that are no longer assigned.
|
|
1769
|
+
// Called whenever `this.assignments` changes so the cache does not retain
|
|
1770
|
+
// entries for partitions the consumer has lost during a rebalance.
|
|
1771
|
+
#syncPreferredReadReplicas() {
|
|
1772
|
+
if (this.#preferredReadReplicas.size === 0) {
|
|
1773
|
+
return;
|
|
1774
|
+
}
|
|
1775
|
+
if (!this.assignments?.length) {
|
|
1776
|
+
this.#preferredReadReplicas.clear();
|
|
1777
|
+
return;
|
|
1778
|
+
}
|
|
1779
|
+
const assignedKeys = new Set();
|
|
1780
|
+
for (const { topic, partitions } of this.assignments) {
|
|
1781
|
+
for (const partition of partitions) {
|
|
1782
|
+
assignedKeys.add(partitionKey(topic, partition));
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
for (const key of this.#preferredReadReplicas.keys()) {
|
|
1786
|
+
if (!assignedKeys.has(key)) {
|
|
1787
|
+
this.#preferredReadReplicas.delete(key);
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
#handleError(error) {
|
|
1792
|
+
if (findErrorBy(error, 'hasStaleMetadata', true)) {
|
|
1350
1793
|
this.clearMetadata();
|
|
1351
1794
|
}
|
|
1795
|
+
else if (findErrorBy(error, 'code', 'PLT_KFK_NETWORK') ||
|
|
1796
|
+
findErrorBy(error, 'apiId', 'COORDINATOR_LOAD_IN_PROGRESS') ||
|
|
1797
|
+
findErrorBy(error, 'apiId', 'COORDINATOR_NOT_AVAILABLE') ||
|
|
1798
|
+
findErrorBy(error, 'apiId', 'NOT_COORDINATOR')) {
|
|
1799
|
+
this.#coordinatorId = null;
|
|
1800
|
+
}
|
|
1352
1801
|
return error;
|
|
1353
1802
|
}
|
|
1354
1803
|
}
|