Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# confluent-kafka-javascript 1.6.0

v1.6.0 is a feature release. It is supported for all usage.

### Enhancements

1. References librdkafka v2.12.0. Refer to the [librdkafka v2.12.0 release notes](https://github.com/confluentinc/librdkafka/releases/tag/v2.12.0) for more information.
2. OAuth OIDC method example for Kafka metadata based authentication with
an Azure IMDS endpoint using an attached managed identity as principal (#377).


# confluent-kafka-javascript 1.5.0

v1.5.0 is a feature release. It is supported for all usage.
Expand Down
2 changes: 1 addition & 1 deletion deps/librdkafka
Submodule librdkafka updated 48 files
+1 −0 .gitignore
+3 −3 .semaphore/run-all-tests.yml
+250 −0 .semaphore/semaphore-integration.yml
+50 −76 .semaphore/semaphore.yml
+56 −0 CHANGELOG.md
+1 −0 CONFIGURATION.md
+427 −242 INTRODUCTION.md
+2 −2 Makefile
+0 −2 packaging/cp/verify-packages.sh
+0 −7 packaging/mingw-w64/export-variables.sh
+1 −1 packaging/mingw-w64/semaphoreci-build.sh
+31 −0 packaging/tools/Dockerfile
+1 −0 packaging/tools/build-configurations-checks.sh
+28 −0 packaging/tools/run-in-docker.sh
+31 −0 packaging/tools/run-integration-tests.sh
+4 −0 packaging/tools/run-style-check.sh
+1 −1 src-cpp/rdkafkacpp.h
+260 −99 src/rdhttp.c
+21 −5 src/rdhttp.h
+44 −7 src/rdkafka.c
+1 −1 src/rdkafka.h
+11 −3 src/rdkafka_broker.c
+18 −17 src/rdkafka_cgrp.c
+218 −182 src/rdkafka_conf.c
+20 −0 src/rdkafka_conf.h
+3 −1 src/rdkafka_int.h
+0 −1 src/rdkafka_metadata.c
+3 −1 src/rdkafka_mock_handlers.c
+2 −0 src/rdkafka_msg.c
+8 −2 src/rdkafka_partition.c
+49 −12 src/rdkafka_request.c
+3 −0 src/rdkafka_request.h
+1 −4 src/rdkafka_sasl_oauthbearer.c
+119 −0 src/rdkafka_sasl_oauthbearer_oidc.c
+5 −0 src/rdkafka_sasl_oauthbearer_oidc.h
+3 −5 tests/0085-headers.cpp
+109 −2 tests/0126-oauthbearer_oidc.c
+563 −0 tests/0148-offset_fetch_commit_error_mock.c
+1 −0 tests/CMakeLists.txt
+1 −1 tests/requirements.txt
+1 −1 tests/run-all-tests.sh
+2 −1 tests/test.c
+ tests/trivup/trivup-0.13.0.tar.gz
+ tests/trivup/trivup-0.14.0.tar.gz
+1 −1 vcpkg.json
+24 −8 win32/setup-msys2.ps1
+28 −6 win32/setup-vcpkg.ps1
+1 −0 win32/tests/tests.vcxproj
30 changes: 30 additions & 0 deletions examples/kafkajs/oauthbearer_oidc_azure_imds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const { Kafka } = require('@confluentinc/kafka-javascript').KafkaJS;

async function run() {
const bootstrapServers = "";
Comment on lines +3 to +4
Copy link

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty values in bootstrapServers and azureIMDSQueryParams should include comments explaining what values users need to provide. Consider adding inline comments or a header comment with examples of valid values.

Suggested change
async function run() {
const bootstrapServers = "";
async function run() {
// Specify the Kafka bootstrap servers as a comma-separated list.
// Example: "my-kafka-broker1:9093,my-kafka-broker2:9093"
const bootstrapServers = "";
// Specify Azure IMDS query parameters.
// Example: "api-version=2018-02-01&resource=https://my-resource&client_id=my-client-id"

Copilot uses AI. Check for mistakes.

const azureIMDSQueryParams = "api-version=&resource=&client_id=";
const kafka = new Kafka({
'bootstrap.servers': bootstrapServers,
'security.protocol': 'SASL_SSL',
'sasl.mechanisms': 'OAUTHBEARER',
'sasl.oauthbearer.method': 'oidc',
'sasl.oauthbearer.metadata.authentication.type': 'azure_imds',
'sasl.oauthbearer.config': `query=${azureIMDSQueryParams}`
});
const producer = kafka.producer();

await producer.connect();
console.log("Producer connected");

const deliveryReport = await producer.send({
topic: 'topic',
messages: [
{ value: 'Hello world!' },
],
});
console.log("Producer sent message", deliveryReport);

await producer.disconnect();
}

run().catch(console.error);
2 changes: 1 addition & 1 deletion lib/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ LibrdKafkaError.wrap = errorWrap;
* @constant
* @memberof RdKafka
*/
// ====== Generated from librdkafka 2.11.1 file src-cpp/rdkafkacpp.h ======
// ====== Generated from librdkafka v2.12.0-RC2 file src-cpp/rdkafkacpp.h ======
LibrdKafkaError.codes = {

/* Internal errors to rdkafka: */
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "@confluentinc/kafka-javascript",
"version": "1.5.0",
"description": "Node.js bindings for librdkafka",
"librdkafka": "2.11.1",
"librdkafka_win": "2.11.1",
"librdkafka": "v2.12.0-RC2",
"librdkafka_win": "v2.12.0-RC2",
"main": "lib/index.js",
"types": "types/index.d.ts",
"scripts": {
Expand Down
9 changes: 8 additions & 1 deletion types/config.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ====== Generated from librdkafka 2.11.1 file CONFIGURATION.md ======
// ====== Generated from librdkafka v2.12.0-RC2 file CONFIGURATION.md ======
// Code that generated this is a derivative work of the code from Nam Nguyen
// https://gist.github.com/ntgn81/066c2c8ec5b4238f85d1e9168a04e3fb

Expand Down Expand Up @@ -713,6 +713,13 @@ export interface GlobalConfig {
*/
"sasl.oauthbearer.assertion.jwt.template.file"?: string;

/**
* Type of metadata-based authentication to use for OAUTHBEARER/OIDC `azure_imds` authenticates using the Azure IMDS endpoint. Sets a default value for `sasl.oauthbearer.token.endpoint.url` if missing. Configuration values specific of chosen authentication type can be passed through `sasl.oauthbearer.config`.
*
* @default none
*/
"sasl.oauthbearer.metadata.authentication.type"?: 'none' | 'azure_imds';

/**
* List of plugin libraries to load (; separated). The library search path is platform dependent (see dlopen(3) for Unix and LoadLibrary() for Windows). If no filename extension is specified the platform-specific extension (such as .dll or .so) will be appended automatically.
*/
Expand Down
2 changes: 1 addition & 1 deletion types/errors.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ====== Generated from librdkafka 2.11.1 file src-cpp/rdkafkacpp.h ======
// ====== Generated from librdkafka v2.12.0-RC2 file src-cpp/rdkafkacpp.h ======
export const CODES: { ERRORS: {
/* Internal errors to rdkafka: */
/** Begin internal error codes (**-200**) */
Expand Down