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
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ I am looking for *your* help to make this project even better! If you're interes

The `node-rdkafka` library is a high-performance NodeJS client for [Apache Kafka](http://kafka.apache.org/) that wraps the native [librdkafka](https://github.com/edenhill/librdkafka) library. All the complexity of balancing writes across partitions and managing (possibly ever-changing) brokers should be encapsulated in the library.

__This library currently uses `librdkafka` version `2.10.1`.__
__This library currently uses `librdkafka` version `2.11.1`.__

## Reference Docs

Expand Down Expand Up @@ -60,7 +60,7 @@ Using Alpine Linux? Check out the [docs](https://github.com/Blizzard/node-rdkafk

### Windows

Windows build **is not** compiled from `librdkafka` source but it is rather linked against the appropriate version of [NuGet librdkafka.redist](https://www.nuget.org/packages/librdkafka.redist/) static binary that gets downloaded from `https://globalcdn.nuget.org/packages/librdkafka.redist.2.10.1.nupkg` during installation. This download link can be changed using the environment variable `NODE_RDKAFKA_NUGET_BASE_URL` that defaults to `https://globalcdn.nuget.org/packages/` when it's no set.
Windows build **is not** compiled from `librdkafka` source but it is rather linked against the appropriate version of [NuGet librdkafka.redist](https://www.nuget.org/packages/librdkafka.redist/) static binary that gets downloaded from `https://globalcdn.nuget.org/packages/librdkafka.redist.2.11.1.nupkg` during installation. This download link can be changed using the environment variable `NODE_RDKAFKA_NUGET_BASE_URL` that defaults to `https://globalcdn.nuget.org/packages/` when it's no set.

Requirements:
* [node-gyp for Windows](https://github.com/nodejs/node-gyp#on-windows)
Expand Down Expand Up @@ -97,7 +97,7 @@ const Kafka = require('node-rdkafka');

## Configuration

You can pass many configuration options to `librdkafka`. A full list can be found in `librdkafka`'s [Configuration.md](https://github.com/edenhill/librdkafka/blob/v2.10.1/CONFIGURATION.md)
You can pass many configuration options to `librdkafka`. A full list can be found in `librdkafka`'s [Configuration.md](https://github.com/edenhill/librdkafka/blob/v2.11.1/CONFIGURATION.md)

Configuration keys that have the suffix `_cb` are designated as callbacks. Some
of these keys are informational and you can choose to opt-in (for example, `dr_cb`). Others are callbacks designed to
Expand Down Expand Up @@ -132,7 +132,7 @@ You can also get the version of `librdkafka`
const Kafka = require('node-rdkafka');
console.log(Kafka.librdkafkaVersion);

// #=> 2.10.1
// #=> 2.11.1
```

## Sending Messages
Expand All @@ -145,7 +145,7 @@ const producer = new Kafka.Producer({
});
```

A `Producer` requires only `metadata.broker.list` (the Kafka brokers) to be created. The values in this list are separated by commas. For other configuration options, see the [Configuration.md](https://github.com/edenhill/librdkafka/blob/v2.10.1/CONFIGURATION.md) file described previously.
A `Producer` requires only `metadata.broker.list` (the Kafka brokers) to be created. The values in this list are separated by commas. For other configuration options, see the [Configuration.md](https://github.com/edenhill/librdkafka/blob/v2.11.1/CONFIGURATION.md) file described previously.

The following example illustrates a list with several `librdkafka` options set.

Expand Down
108 changes: 105 additions & 3 deletions config.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ====== Generated from librdkafka 2.10.1 file CONFIGURATION.md ======
// ====== Generated from librdkafka 2.11.1 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 @@ -63,12 +63,19 @@ export interface GlobalConfig {
"max.in.flight"?: number;

/**
* Controls how the client recovers when none of the brokers known to it is available. If set to `none`, the client fails with a fatal error. If set to `rebootstrap`, the client repeats the bootstrap process using `bootstrap.servers` and brokers added through `rd_kafka_brokers_add()`. Rebootstrapping is useful when a client communicates with brokers so infrequently that the set of brokers may change entirely before the client refreshes metadata. Metadata recovery is triggered when all last-known brokers appear unavailable simultaneously.
* Controls how the client recovers when none of the brokers known to it is available. If set to `none`, the client doesn't re-bootstrap. If set to `rebootstrap`, the client repeats the bootstrap process using `bootstrap.servers` and brokers added through `rd_kafka_brokers_add()`. Rebootstrapping is useful when a client communicates with brokers so infrequently that the set of brokers may change entirely before the client refreshes metadata. Metadata recovery is triggered when all last-known brokers appear unavailable simultaneously or the client cannot refresh metadata within `metadata.recovery.rebootstrap.trigger.ms` or it's requested in a metadata response.
*
* @default rebootstrap
*/
"metadata.recovery.strategy"?: 'none' | 'rebootstrap';

/**
* If a client configured to rebootstrap using `metadata.recovery.strategy=rebootstrap` is unable to obtain metadata from any of the brokers for this interval, client repeats the bootstrap process using `bootstrap.servers` configuration and brokers added through `rd_kafka_brokers_add()`.
*
* @default 300000
*/
"metadata.recovery.rebootstrap.trigger.ms"?: number;

/**
* Period of time in milliseconds at which topic and broker metadata is refreshed in order to proactively discover any new brokers, topics, partitions or partition leader changes. Use -1 to disable the intervalled refresh (not recommended). If there are no locally referenced topics (no topic objects created, no messages produced, no subscription or no assignment) then only the broker list will be refreshed every interval but no more often than every 10s.
*
Expand Down Expand Up @@ -192,7 +199,7 @@ export interface GlobalConfig {
"socket.connection.setup.timeout.ms"?: number;

/**
* Close broker connections after the specified time of inactivity. Disable with 0. If this property is left at its default value some heuristics are performed to determine a suitable default value, this is currently limited to identifying brokers on Azure (see librdkafka issue #3109 for more info).
* Close broker connections after the specified time of inactivity. Disable with 0. If this property is left at its default value some heuristics are performed to determine a suitable default value, this is currently limited to identifying brokers on Azure (see librdkafka issue #3109 for more info). Actual value can be lower, up to 2s lower, only if `connections.max.idle.ms` >= 4s, as jitter is added to avoid disconnecting all brokers at the same time.
*
* @default 0
*/
Expand Down Expand Up @@ -432,6 +439,16 @@ export interface GlobalConfig {
*/
"ssl.ca.location"?: string;

/**
* File or directory path to CA certificate(s) for verifying HTTPS endpoints, like `sasl.oauthbearer.token.endpoint.url` used for OAUTHBEARER/OIDC authentication. Mutually exclusive with `https.ca.pem`. Defaults: On Windows the system's CA certificates are automatically looked up in the Windows Root certificate store. On Mac OSX this configuration defaults to `probe`. It is recommended to install openssl using Homebrew, to provide CA certificates. On Linux install the distribution's ca-certificates package. If OpenSSL is statically linked or `https.ca.location` is set to `probe` a list of standard paths will be probed and the first one found will be used as the default CA certificate location path. If OpenSSL is dynamically linked the OpenSSL library's default path will be used (see `OPENSSLDIR` in `openssl version -a`).
*/
"https.ca.location"?: string;

/**
* CA certificate string (PEM format) for verifying HTTPS endpoints. Mutually exclusive with `https.ca.location`. Optional: see `https.ca.location`.
*/
"https.ca.pem"?: string;

/**
* CA certificate string (PEM format) for verifying the broker's key.
*/
Expand Down Expand Up @@ -591,6 +608,16 @@ export interface GlobalConfig {
*/
"sasl.oauthbearer.client.id"?: string;

/**
* Alias for `sasl.oauthbearer.client.id`: Public identifier for the application. Must be unique across all clients that the authorization server handles. Only used when `sasl.oauthbearer.method` is set to "oidc".
*/
"sasl.oauthbearer.client.credentials.client.id"?: string;

/**
* Alias for `sasl.oauthbearer.client.secret`: Client secret only known to the application and the authorization server. This should be a sufficiently random string that is not guessable. Only used when `sasl.oauthbearer.method` is set to "oidc".
*/
"sasl.oauthbearer.client.credentials.client.secret"?: string;

/**
* Client secret only known to the application and the authorization server. This should be a sufficiently random string that is not guessable. Only used when `sasl.oauthbearer.method` is set to "oidc".
*/
Expand All @@ -611,6 +638,81 @@ export interface GlobalConfig {
*/
"sasl.oauthbearer.token.endpoint.url"?: string;

/**
* OAuth grant type to use when communicating with the identity provider.
*
* @default client_credentials
*/
"sasl.oauthbearer.grant.type"?: 'client_credentials' | 'urn:ietf:params:oauth:grant-type:jwt-bearer';

/**
* Algorithm the client should use to sign the assertion sent to the identity provider and in the OAuth alg header in the JWT assertion.
*
* @default RS256
*/
"sasl.oauthbearer.assertion.algorithm"?: 'RS256' | 'ES256';

/**
* Path to client's private key (PEM) used for authentication when using the JWT assertion.
*/
"sasl.oauthbearer.assertion.private.key.file"?: string;

/**
* Private key passphrase for `sasl.oauthbearer.assertion.private.key.file` or `sasl.oauthbearer.assertion.private.key.pem`.
*/
"sasl.oauthbearer.assertion.private.key.passphrase"?: string;

/**
* Client's private key (PEM) used for authentication when using the JWT assertion.
*/
"sasl.oauthbearer.assertion.private.key.pem"?: string;

/**
* Path to the assertion file. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed.
*/
"sasl.oauthbearer.assertion.file"?: string;

/**
* JWT audience claim. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed.
*/
"sasl.oauthbearer.assertion.claim.aud"?: string;

/**
* Assertion expiration time in seconds. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed.
*
* @default 300
*/
"sasl.oauthbearer.assertion.claim.exp.seconds"?: number;

/**
* JWT issuer claim. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed.
*/
"sasl.oauthbearer.assertion.claim.iss"?: string;

/**
* JWT ID claim. When set to `true`, a random UUID is generated. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed.
*
* @default false
*/
"sasl.oauthbearer.assertion.claim.jti.include"?: boolean;

/**
* Assertion not before time in seconds. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed.
*
* @default 60
*/
"sasl.oauthbearer.assertion.claim.nbf.seconds"?: number;

/**
* JWT subject claim. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed.
*/
"sasl.oauthbearer.assertion.claim.sub"?: string;

/**
* Path to the JWT template file. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed.
*/
"sasl.oauthbearer.assertion.jwt.template.file"?: string;

/**
* 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 deps/librdkafka
28 changes: 27 additions & 1 deletion errors.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ====== Generated from librdkafka 2.10.1 file src-cpp/rdkafkacpp.h ======
// ====== Generated from librdkafka 2.11.1 file src-cpp/rdkafkacpp.h ======
export const CODES: { ERRORS: {
/* Internal errors to rdkafka: */
/** Begin internal error codes (**-200**) */
Expand Down Expand Up @@ -128,6 +128,11 @@ export const CODES: { ERRORS: {
ERR__AUTO_OFFSET_RESET: number,
/** Partition log truncation detected (**-139**) */
ERR__LOG_TRUNCATION: number,
/** A different record in the batch was invalid
* and this message failed persisting (**-138**) */
ERR__INVALID_DIFFERENT_RECORD: number,
/** Broker is going away but client isn't terminating (**-137**) */
ERR__DESTROY_BROKER: number,

/** End internal error codes (**-100**) */
ERR__END: number,
Expand Down Expand Up @@ -346,4 +351,25 @@ export const CODES: { ERRORS: {
ERR_FEATURE_UPDATE_FAILED: number,
/** Request principal deserialization failed during forwarding (**97**) */
ERR_PRINCIPAL_DESERIALIZATION_FAILURE: number,
/** Unknown Topic Id (**100**) */
ERR_UNKNOWN_TOPIC_ID: number,
/** The member epoch is fenced by the group coordinator (**110**) */
ERR_FENCED_MEMBER_EPOCH: number,
/** The instance ID is still used by another member in the
* consumer group (**111**) */
ERR_UNRELEASED_INSTANCE_ID: number,
/** The assignor or its version range is not supported by the consumer
* group (**112**) */
ERR_UNSUPPORTED_ASSIGNOR: number,
/** The member epoch is stale (**113**) */
ERR_STALE_MEMBER_EPOCH: number,
/** Client sent a push telemetry request with an invalid or outdated
* subscription ID (**117**) */
ERR_UNKNOWN_SUBSCRIPTION_ID: number,
/** Client sent a push telemetry request larger than the maximum size
* the broker will accept (**118**) */
ERR_TELEMETRY_TOO_LARGE: number,
/** Client metadata is stale,
* client should rebootstrap to obtain new metadata (**129**) */
ERR_REBOOTSTRAP_REQUIRED: number,
}}
30 changes: 28 additions & 2 deletions lib/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LibrdKafkaError.wrap = errorWrap;
* @enum {number}
* @constant
*/
// ====== Generated from librdkafka 2.10.1 file src-cpp/rdkafkacpp.h ======
// ====== Generated from librdkafka 2.11.1 file src-cpp/rdkafkacpp.h ======
LibrdKafkaError.codes = {

/* Internal errors to rdkafka: */
Expand Down Expand Up @@ -158,6 +158,11 @@ LibrdKafkaError.codes = {
ERR__AUTO_OFFSET_RESET: -140,
/** Partition log truncation detected */
ERR__LOG_TRUNCATION: -139,
/** A different record in the batch was invalid
* and this message failed persisting. */
ERR__INVALID_DIFFERENT_RECORD: -138,
/** Broker is going away but client isn't terminating */
ERR__DESTROY_BROKER: -137,

/** End internal error codes */
ERR__END: -100,
Expand Down Expand Up @@ -375,7 +380,28 @@ LibrdKafkaError.codes = {
/** Unable to update finalized features due to server error */
ERR_FEATURE_UPDATE_FAILED: 96,
/** Request principal deserialization failed during forwarding */
ERR_PRINCIPAL_DESERIALIZATION_FAILURE: 97
ERR_PRINCIPAL_DESERIALIZATION_FAILURE: 97,
/** Unknown Topic Id */
ERR_UNKNOWN_TOPIC_ID: 100,
/** The member epoch is fenced by the group coordinator */
ERR_FENCED_MEMBER_EPOCH: 110,
/** The instance ID is still used by another member in the
* consumer group */
ERR_UNRELEASED_INSTANCE_ID: 111,
/** The assignor or its version range is not supported by the consumer
* group */
ERR_UNSUPPORTED_ASSIGNOR: 112,
/** The member epoch is stale */
ERR_STALE_MEMBER_EPOCH: 113,
/** Client sent a push telemetry request with an invalid or outdated
* subscription ID. */
ERR_UNKNOWN_SUBSCRIPTION_ID: 117,
/** Client sent a push telemetry request larger than the maximum size
* the broker will accept. */
ERR_TELEMETRY_TOO_LARGE: 118,
/** Client metadata is stale,
* client should rebootstrap to obtain new metadata. */
ERR_REBOOTSTRAP_REQUIRED: 129
};

/**
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "node-rdkafka",
"version": "v3.4.1",
"version": "v3.5.0",
"description": "Node.js bindings for librdkafka",
"librdkafka": "2.10.1",
"librdkafka": "2.11.1",
"main": "lib/index.js",
"scripts": {
"configure": "node-gyp configure",
Expand Down
Loading