What It Does

Guarantees that events are published to NATS, even if NATS is temporarily down.

How It Works

  1. Save data + event to PostgreSQL in same transaction
  2. Background worker (relay) publishes events from outbox to NATS
  3. Automatic retry on failure
  4. Events are marked as published once successful

Key Files

Usage Example

Monitoring

Configuration

  • Poll interval: 1 second
  • Max retries: 3 attempts
  • Cleanup: Deletes published events older than 7 days (configurable)

Testing