NATS is a messaging system for services, edge deployments, and cloud-native applications. Tenzir integrates with NATS JetStream to consume messages from subjects and publish events back to subjects.
Use from_nats to consume JetStream messages and to_nats to
publish messages.
Examples
Section titled “Examples”Consume JSON messages from a subject
Section titled “Consume JSON messages from a subject”from_nats "alerts", durable="tenzir-alerts"this = string(message).parse_json()The NATS server must have a JetStream stream that captures the subject you consume from.
Publish events to a subject
Section titled “Publish events to a subject”subscribe "alerts"to_nats "alerts"By default, to_nats serializes each event with
this.print_ndjson().
Connect to a secured NATS server
Section titled “Connect to a secured NATS server”from_nats "alerts", url="tls://nats.example.com:4222", auth={token: secret("NATS_TOKEN")}, tls={}this = string(message).parse_json()