@orion-js/pulse, but it does not depend on Orionjs. You can use it from an Orionjs service, an older Orionjs application, or a standalone Node.js or Bun process.
Pulse replaces the event-delivery part of Kafka for services that fit MongoDB’s operational model. It is not Kafka protocol-compatible and does not provide partitions, a globally ordered log, or Kafka administration APIs.
Install
MongoDB is a peer dependency. The only direct runtime dependency is the UUIDv7 generator used for Pulse document IDs.Quick start
Define an event map to make topics and payloads type-safe:connect() returns immediately and starts initialization in the background. awaitConnection() resolves only after MongoDB is connected and every required collection and index has been created and validated. publish(), subscribe(), and history reads wait for that same readiness promise automatically.
Call close() during graceful shutdown:
Mental model
Pulse persists four kinds of records:
Publishing stores one event. Each subscribed consumer group materializes its own delivery and attempt history. Replicas with the same consumer group compete for that delivery; services with different consumer groups each receive it.
pending before it calls your handler. A renewable lease and UUIDv7 fencing token protect the attempt while it is running. Polling and reconciliation recover partial writes or dead workers; MongoDB Change Streams can reduce latency but are never the source of correctness.
Choose a consumer group
Use one stable consumer group for all replicas that perform the same responsibility:- Two
billingreplicas share work and process each event once as a group. billingandanalyticseach get an independent delivery.- Renaming a consumer group creates a new durable consumption identity.