Registry / messaging / kubemq-js

kubemq-js

JSON →
library3.0.1jsnpmunverified

Official TypeScript/JavaScript client for KubeMQ (v3.0.1), a Kubernetes-native message broker. Provides gRPC-based access to all messaging patterns: Events (fire-and-forget), Events Store (persisted pub/sub), Queues (guaranteed delivery with ACK), Commands (request/reply), and Queries (request/reply with response). TypeScript-first with full type declarations, auto-retry, structured error handling, and built-in OpenTelemetry integration. Requires Node.js >=20.11.0 and a running KubeMQ server. Active development with monthly releases.

npm install kubemq-js
INSTALL
IMPORT
SIG · KUBEMQ-JS
K
kubemq-js
messagingjavascriptv3.0.1
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.

KubeMQClient
import { KubeMQClient } from 'kubemq-js'
const KubeMQClient = require('kubemq-js').KubeMQClient
Class export. ESM-only since v3. Use default import or named import.
createEventMessage
import { createEventMessage } from 'kubemq-js'
import { EventMessage } from 'kubemq-js'
Factory function for creating event messages. Do not import the EventMessage type directly for construction.
createQueueMessage
import { createQueueMessage } from 'kubemq-js'
import createQueueMessage from 'kubemq-js'
Named export. No default export exists.

Demonstrates creating a KubeMQ client, subscribing to events, and publishing a fire-and-forget event message.

import { KubeMQClient, createEventMessage } from 'kubemq-js'; async function main() { const client = await KubeMQClient.create({ address: process.env.KUBEMQ_ADDRESS ?? 'localhost:50000' }); // Subscribe to events client.subscribeToEvents({ channel: 'events.hello', onEvent: (msg) => console.log('Received:', new TextDecoder().decode(msg.body)), onError: (err) => console.error('Error:', err.message), }); // Publish an event await client.sendEvent(createEventMessage({ channel: 'events.hello', body: 'Hello KubeMQ!' })); console.log('Event sent. Waiting 2 seconds...'); await new Promise((resolve) => setTimeout(resolve, 2000)); await client.shutdown(); } main().catch(console.error);
Debug
Known issues
breakingKubeMQClient is now async factory via create() instead of new KubeMQClient()
fix
Use await KubeMQClient.create({...}) instead of new KubeMQClient({...})
affects: >=3.0.0
breakingAll messaging functions now return promises; no callback-based API
fix
Use async/await or .then() for all send/subscribe/receive calls
affects: >=3.0.0
deprecatedThe old import path 'kubemq-js/dist/...' no longer exists
fix
Import directly from 'kubemq-js'
affects: >=3.0.0
gotchagRPC connections require Node >=20.11.0; older Node versions will fail at runtime
fix
Upgrade Node.js to version 20.11.0 or later
affects: >=3.0.0
gotchaMessage body must be Uint8Array or string; automatic encoding only for string
fix
Pass string directly or manually encode to Uint8Array for binary data
affects: >=3.0.0
Errors
Common errors & fixes
Error: 14 UNAVAILABLE: failed to connect to all addresses
KubeMQ server is not running or address is incorrect
fix
Ensure KubeMQ is running at the configured address (default localhost:50000). Check KUBEMQ_ADDRESS env var.
TypeError: KubeMQClient is not a constructor
Using new KubeMQClient() which is no longer supported in v3
fix
Use await KubeMQClient.create({...}) instead of new KubeMQClient({...})
Error: ESM modules are not supported in this environment
Running in a CommonJS context (e.g., require()) without proper ESM setup
fix
Use import syntax, or set "type": "module" in package.json, or use dynamic import()
Cannot find module 'kubemq-js' or its corresponding type declarations
Package not installed or TypeScript cannot resolve types
fix
Run npm install kubemq-js and ensure tsconfig.json includes 'node' module resolution
Upgrade
Version history
3.0.1latest on npm
Audit
Dependencies
@opentelemetry/apioptionalRequired for distributed tracing via OpenTelemetry
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
kubemq-js — npm install kubemq-js · libregistry