Skip to content

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.

To enable the NATS publisher, set the following environment variables.

VariableDescriptionExample
PUBLISHER_TYPEMust be set to nats.nats
PUBLISHER_URLThe NATS server connection string.nats://localhost:4222
NATS_PUBLISH_TIMEOUTMax time to wait for a JetStream ACK.5s

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.

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:

Terminal window
# Create a stream via NATS CLI
nats stream add ORDERS --subjects "order.*" --storage file --retention limits