npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zero.core/api-framework-confluent-kafka-plugin

v1.0.0

Published

Confluent Kafka provider plugin for the ZeroCore API framework.

Downloads

157

Readme

ZeroCore Confluent Kafka Provider Plugin

@zero.core/api-framework-confluent-kafka-plugin registers a Confluent Kafka provider with the @zero.core/api-framework pub/sub bus.

Implemented Scope

  • ConfluentKafkaPubSubProvider
  • ConfluentKafkaPubSubPlugin
  • ConfluentKafkaProviderOptions
  • ConfluentKafkaProviderErrorContext
  • ConfluentKafkaProviderErrorHandler
  • structural Confluent Kafka producer and consumer contracts

This package targets Confluent Kafka JavaScript style producer and consumer contracts. It does not bundle @confluentinc/kafka-javascript; pass clients or thin adapters that implement the exported interfaces. The npm package name is @zero.core/api-framework-confluent-kafka-plugin.

Installation

yarn add @zero.core/api-framework @zero.core/api-framework-confluent-kafka-plugin

Usage

import { ApiRouter, MemoryPubSubProvider, PubSubBus, ServiceContainer } from "@zero.core/api-framework";
import { ConfluentKafkaPubSubPlugin } from "@zero.core/api-framework-confluent-kafka-plugin";

const services = new ServiceContainer();
const pubSub = new PubSubBus(new MemoryPubSubProvider("local"), registrations, {
  defaultProvider: "confluent-kafka",
  services
});

services.addInstance(PubSubBus, pubSub);

new ApiRouter(app, controllers, {
  services,
  plugins: [
    new ConfluentKafkaPubSubPlugin(confluentProducer, confluentConsumer, {
      topicPrefix: "zerocore.",
      fromBeginning: false,
      onError: (error, context) => {
        logger.error({ error, context }, "Confluent Kafka pub/sub delivery failed");
      }
    })
  ]
}).register();

await pubSub.start();

process.once("SIGTERM", () => {
  void pubSub.stop().finally(() => process.exit(0));
});

Use provider: "confluent-kafka" in @Subscribe() or pubSub.publish() options to select this provider explicitly.

Structural Client Contract

The plugin expects app-owned Confluent Kafka clients or adapters:

import type {
  ConfluentKafkaConsumerClient,
  ConfluentKafkaProducerClient,
} from "@zero.core/api-framework-confluent-kafka-plugin";

const producer: ConfluentKafkaProducerClient = {
  send: (request) => confluentProducer.send(request),
  flush: () => confluentProducer.flush?.(),
  disconnect: () => confluentProducer.disconnect(),
};

const consumer: ConfluentKafkaConsumerClient = {
  subscribe: (request) => confluentConsumer.subscribe(request),
  run: (request) => confluentConsumer.run(request),
  stop: () => confluentConsumer.stop?.(),
  disconnect: () => confluentConsumer.disconnect(),
};

The provider calls consumer.run(...) once and dispatches messages by resolved topic. It calls optional lifecycle hooks from close(), which is invoked when PubSubBus.stop() closes providers.

Verification Stages

yarn typecheck
yarn test:contracts
yarn test:unit
yarn build

Run the full gate:

yarn verify:full
yarn pack:check

Stage meaning:

  • typecheck verifies provider and plugin contracts.
  • test:contracts verifies package metadata, legal files, npm payload intent, Confluent send/subscribe/run translation, replay options, error reporting, lifecycle close behavior, and plugin registration errors.
  • test:unit verifies focused provider writes, header/key normalization, handler error reporting, lifecycle close hooks, and plugin registration behavior.
  • build emits the publishable dist package.
  • pack:check builds and runs npm pack --dry-run so the payload can be reviewed before publish.

Production Notes

  • This package intentionally targets Confluent Kafka contracts, not KafkaJS contracts.
  • Your app owns broker connectivity, topic provisioning, consumer group configuration, offsets, and operational policy.
  • Set stable topic prefixes and app-level topic names. Consumer group and broker-level settings belong to the Confluent client or adapter you pass in.
  • Deserialization and handler failures are reported through onError. Handler failures are rethrown by default so the broker/client can apply its offset and retry semantics.
  • Set throwOnHandlerError: false only when your application intentionally wants the provider to report handler failures and continue dispatching later handlers in the same process.
  • close() stops/disconnects the consumer and flushes/disconnects the producer when those lifecycle methods exist.
  • Keep PubSubBus registered in the framework DI container before ApiRouter.register() so ConfluentKafkaPubSubPlugin can add the provider.
  • The npm package publishes compiled dist output plus README.md, LICENSE, and NOTICE; TypeScript source and tests stay out of the npm payload.