Skip to main content
Version: 2.6-dev

NATS Nodes

NATS is a lightweight, cloud-native messaging system with sub-millisecond pub/sub and optional JetStream persistence for durable streams. MaestroHub provides two messaging node types for NATS — Publish and Request (RPC-style). For receiving messages, see the NATS Trigger Node.

Configuration Quick Reference

FieldWhat you chooseDetails
ParametersConnection, Function, Function Parameters, Timeout OverrideSelect the NATS connection profile, the function, configure function parameters via expressions, and optionally override timeout.
SettingsDescription, Timeout (seconds), Retry on Timeout, Retry on Fail, On ErrorNode description, maximum execution time, retry behavior, and error handling strategy. All execution settings default to pipeline-level values.
NATS Publish node configuration

NATS Publish Node

NATS Publish Node

Publish messages to a NATS subject. Optionally publish via JetStream for persistent delivery with broker-acknowledged sequence numbers.

Supported Function Types:

Function NamePurposeCommon Use Cases
PublishSend messages to a NATS subject with optional JetStream persistenceEvent broadcasting, IoT telemetry fanout, persistent event log

How It Works

When the pipeline executes, the Publish node:

  1. Connects via the selected NATS connection profile (already established by the connector runtime)
  2. Resolves any ((parameter)) placeholders in subject, payload, and headers from upstream node outputs and trigger data
  3. Publishes the message to the configured subject — either core NATS (fire-and-forget) or JetStream (broker-acknowledged) depending on the function's Use JetStream flag
  4. Returns the publish result

Configuration

FieldWhat you chooseDetails
ConnectionNATS connection profileSelect a pre-configured NATS connection from your connection library
FunctionPublish functionA NATS Publish function that defines subject, payload, headers, and JetStream behaviour
Function ParametersSubject, payload, headers, replyTo, useJetStreamConfigure dynamic values via expressions or upstream node outputs (inherited from function)

Publish Result (core NATS)

{
"subject": "events.sensor.temperature",
"messageSize": 42,
"jetstream": false,
"published": true
}

Publish Result (JetStream)

{
"subject": "events.orders.created",
"messageSize": 84,
"stream": "ORDERS",
"sequence": 4271,
"jetstream": true
}

The sequence is the per-stream monotonic ID assigned by the JetStream broker — store it for at-least-once auditing or downstream deduplication.

For detailed function configuration options including headers and JetStream toggling, see the NATS Function Builder documentation.

NATS Request node configuration

NATS Request Node

NATS Request Node

Send a request on a NATS subject and synchronously await a reply — RPC-style. The pipeline waits on the node until either a reply arrives or the timeout fires.

Supported Function Types:

Function NamePurposeCommon Use Cases
RequestSend a NATS request and wait for a replyRPC-style service calls, synchronous IoT command/response

How It Works

When the pipeline executes, the Request node:

  1. Resolves placeholders in subject and payload from upstream context
  2. Sends the request to the configured subject and registers an inbox subscription for the reply
  3. Blocks until either a single reply arrives or the configured Timeout (ms) elapses
  4. Returns the reply payload to the downstream nodes; on timeout the node fails (the On Error setting determines whether the pipeline halts or continues)

Configuration

FieldWhat you chooseDetails
ConnectionNATS connection profileSelect a pre-configured NATS connection from your connection library
FunctionRequest functionA NATS Request function defining the subject, payload, and timeout
Function ParametersSubject, payload, timeoutMsConfigure dynamic values via expressions or upstream node outputs

Request Result

{
"subject": "device.5f-3a.command",
"replySubject": "_INBOX.aBcD.eFgH",
"reply": "{\"status\":\"ok\",\"value\":23.5}",
"replySize": 31
}

The reply field holds the responder's payload as a string. Use a downstream Code or Set node to JSON-parse it for typed access.

For detailed function configuration options, see the NATS Function Builder documentation.

Choosing Between Core NATS and JetStream

BehaviourCore NATS (Use JetStream = off)JetStream (Use JetStream = on)
PersistenceNone — fire-and-forgetDisk-backed, survives broker restart
Consumer offlineMessage lostStream holds messages, redelivered when consumer returns
ReplayNot supportedReplay from any sequence or timestamp
AckImplicitExplicit (Ack Wait retries on no-ack)
ThroughputHighestHigh but with disk I/O overhead
Use whenTelemetry, fanout events, low-latency RPCOrder events, audit trails, anything that must not be lost

The connection-level Enable JetStream toggle gates whether JetStream is available at all. Individual functions then opt in per operation via Use JetStream — so a single connection can serve both core and JetStream traffic side by side.