Registry / messaging / kafka-rest-client

kafka-rest-client

JSON →
library1.11.7jsnpmunverified

A Node.js client for producing JSON and binary messages to Apache Kafka via the Confluent REST Proxy. Current stable version 1.11.7, released in 2018 with no active maintenance. Supports only CommonJS (require) and callbacks. Key differentiator: simple REST-based Kafka producer without native Kafka protocol dependencies. Limited to producing messages; no consumer support. Not compatible with modern Kafka REST Proxy security features (e.g., SASL, SSL). Not recommended for new projects; consider using kafkajs or node-rdkafka instead.

npm install kafka-rest-client
INSTALL
IMPORT
SIG · KAFKA-REST-CLIENT
K
kafka-rest-client
messagingjavascriptv1.11.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

KafkaRestClient
var KafkaRestClient = require('kafka-rest-client');
import KafkaRestClient from 'kafka-rest-client';
CJS only; does not support ESM imports.

Shows how to connect to a Kafka REST proxy and produce a message using callbacks.

var KafkaRestClient = require('kafka-rest-client'); var configs = { proxyHost: process.env.KAFKA_PROXY_HOST || 'localhost', proxyPort: parseInt(process.env.KAFKA_PROXY_PORT || '18084', 10) }; var kafkaRestClient = new KafkaRestClient(configs, function(err) { if (err) { console.error(err); return; } kafkaRestClient.connect(function(err) { if (err) { console.error(err); return; } kafkaRestClient.produce('test-topic', 'Hello Kafka', function(err, result) { if (err) { console.error(err); return; } console.log('Produced:', result); kafkaRestClient.close(); }); }); });
Debug
Known issues
gotchaConstructor does not use 'new' keyword example but actually requires 'new'.
fix
Always use 'new KafkaRestClient(...)'.
affects: >=1.0.0
breakingCallback is required in constructor, but not documented as mandatory.
fix
Pass a dummy callback if not needed: function(){}.
affects: >=1.0.0 <1.5.0
deprecatedPackage is no longer maintained. Last release in 2018.
fix
Migrate to kafkajs or node-rdkafka.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: kafkaRestClient.produce is not a function
KafkaRestClient instance not fully initialized (connect not called or callback not invoked).
fix
Ensure 'connect' callback is invoked before calling 'produce'.
Error: connect ECONNREFUSED
Kafka REST proxy not running or wrong host/port.
fix
Verify proxyHost and proxyPort, and ensure the proxy is running.
Upgrade
Version history
1.11.7latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
kafka-rest-client — npm install kafka-rest-client · libregistry