@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 subscribeBatch() wait for that same readiness promise automatically.
Each Pulse client limits its MongoDB application pool to one connection by default instead of the
driver default of 100. Callbacks remain concurrent because they do not retain the socket; only
Pulse’s short coordination operations share it. Configure a larger maxPoolSize only when a
service has measured local pool contention:
close() during graceful shutdown:
Mental model
Pulse persists three kinds of records:
Publishing stores one event. Each subscribed consumer group materializes its own execution state.
A normal receiver uses one delivery per event; a batch receiver stores multiple ordered event IDs
in one delivery. Replicas with the same consumer group compete for those deliveries; services with
different consumer groups receive independent work.
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.