NATS Integration
Open Outbox Relay supports NATS JetStream for persistent, reliable event delivery. This allows you to leverage NATS as a lightweight, high-performance message broker.
Core Configuration
Section titled “Core Configuration”To enable the NATS publisher, set the following environment variables.
| Variable | Description | Example |
|---|---|---|
PUBLISHER_TYPE | Must be set to nats. | nats |
PUBLISHER_URL | The NATS server connection string. | nats://localhost:4222 |
NATS_PUBLISH_TIMEOUT | Max time to wait for a JetStream ACK. | 5s |
JetStream Requirement
Section titled “JetStream Requirement”Open Outbox Relay requires NATS JetStream to be enabled on your NATS cluster. The Relay publishes events to subjects, but those subjects must be backed by a Stream to ensure persistence.
Example Setup
Section titled “Example Setup”If your database event_type is order.created, the Relay will publish to that exact NATS subject. You should create a stream that consumes that subject:
# Create a stream via NATS CLInats stream add ORDERS --subjects "order.*" --storage file --retention limits