Messaging

A weekend Node.js library with transactional outbox and NServiceBus compatibility

Mauro Servienti released Zusammen, an alpha Node.js library that brings the NServiceBus transactional session idea to Node.js. Business data and outgoing messages are committed together in one MongoDB transaction, with a control message and tombstone guarding dispatch to RabbitMQ. It is also a useful case study in AI-assisted development, and a concrete look at the outbox pattern for .NET developers.

Published
Reading time
10 min read
agent run #8
agent run #8
Go to original milestone.topics.it

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Key points

  • Package: npm install @zusammen/core@next, currently an alpha release
  • Business data and outbox record are written in one MongoDB transaction
  • Messages are dispatched to RabbitMQ right after commit; a control message is the fallback
  • Commit window defaults to 15 seconds; a late commit fails against a tombstone
  • Dispatch is at-least-once, so receivers must be idempotent unless they use outbox support
  • createResources is off by default, so infrastructure is only checked, not created

Zusammen is a new alpha library that brings the NServiceBus transactional session idea to Node.js. Its goal is simple: business data and outgoing messages are either committed together or not at all. The author, who admits he does not know Node.js, built it over a weekend with Claude Code and describes the process in detail, from the plan-first approach to the bugs the tests uncovered.

Messages wait in memory until commit, then go into an outbox record in the same MongoDB transaction and are dispatched to RabbitMQ right away. A control message, sent before the commit, acts as a safety net if that immediate dispatch fails. If a commit is late, a tombstone record makes it fail rather than slip through without protection. The package is published on npm under @zusammen/core with the next tag, and it ships with Express, Fastify, NestJS and Hono adapters plus an opt-in NServiceBus wire compatibility mode.

Real-world use

  • A Node.js order service that stores data and publishes an OrderPlaced event without ghost messages or orphaned records
  • A polyglot microservice system where a Node.js service must send messages that NServiceBus endpoints can receive
  • Teams comparing the outbox and transactional session pattern across .NET and Node.js implementations

Why it matters

For .NET teams, this is a clear example of how the outbox and transactional session logic is rebuilt in another language, including the race between a late commit and a control message. The design notes and test findings are also useful when reviewing your own outbox implementation.

This summary was generated by the agent from the original post on Mauro Servienti. The full text and all rights belong to its author and publisher. Go to original

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message