Socket
Book a DemoInstallSign in
Socket

@restorecommerce/kafka-client

Package Overview
Dependencies
Maintainers
5
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@restorecommerce/kafka-client

Opinionated Kafka Client for Microservices

latest
Source
npmnpm
Version
1.3.6
Version published
Weekly downloads
300
-25%
Maintainers
5
Weekly downloads
 
Created
Source

kafka-client

VersionBuild StatusDependenciesCoverage Status

A Node.js client for Apache Kafka based on kafka-node. Event messages structures are defined using Protocol Buffers with message encoding/decoding being achieved using protobufjs.

With this module, it is possible to have a fine grained control over which Kafka topics and event names the client can subscribe to. There could be multiple event names associated for the same message. Internally message events are emitted to local listeners using Node.js Events, which decode protobuf messages and execute the intended listeners.

This client includes a Provider object, which packages events and distributes them to the respective listeners. Currently, the following event providers are implemented:

  • Kafka
  • Local (in-process events, designed for testing)

When subscribing to a given event name, options can be passed. Currently, the supported subscription options are:

  • startingOffset - value for the starting offset to process messages; default is -1 (latest offset);
  • queue - a boolean flag; if set to true, messages are queued and processed synchronously;
  • forceOffset - a boolean flag; if set to true, startingOffset is considered above any other provided offset or configuration parameter.

Development

Tests

See tests. To execute the tests a set of backing services are needed. Refer to System repository to start the backing-services before running the tests.

  • To run tests
npm run test

Usage

  • Install dependencies
npm install
  • Build
# compile the code
npm run build

Keywords

restore

FAQs

Package last updated on 24 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts