Context
Services that publish to both Postgres and NATS (objectives, audit, pipeline, approvals) have no transactional outbox. The current pattern in natsbus publishes directly after DB write — a crash between the two leaves state inconsistent:
tx.Commit() // succeeds
nats.Publish(...) // crashes here → event lost, DB state diverged from event stream
This is a fundamental data consistency problem for any event-driven architecture.
Requirements
Affected services
objectives — publishes state transition events
audit — publishes approval decision events
pipeline — publishes deal change events
approvals — publishes approval lifecycle events
notifications — publishes delivery events
Why this matters
Without this, any service restart or NATS blip silently drops events. For audit and compliance use cases, this is a data integrity violation.
Context
Services that publish to both Postgres and NATS (objectives, audit, pipeline, approvals) have no transactional outbox. The current pattern in
natsbuspublishes directly after DB write — a crash between the two leaves state inconsistent:This is a fundamental data consistency problem for any event-driven architecture.
Requirements
outbox.Publishertoservice-runtime/natsbusthat writes events to a Postgresoutboxtable within the same transaction as the domain writeWithOutbox(tx)option on the existingnatsbus.Publishinterface so services can opt in incrementallyAffected services
objectives— publishes state transition eventsaudit— publishes approval decision eventspipeline— publishes deal change eventsapprovals— publishes approval lifecycle eventsnotifications— publishes delivery eventsWhy this matters
Without this, any service restart or NATS blip silently drops events. For audit and compliance use cases, this is a data integrity violation.