NATS

The NATS connection allows the Intelligence Hub to connect to NATS servers for reading and writing messages, including support for JetStream streams. This page describes the connection, input, and output settings, and supported features.

Connection Settings

Setting Description
Host The hostname or IP address of the NATS server.
Port The port the NATS server listens on. Default is 4222.
Authentication Type How the connection authenticates with the server. Default is None. See the options below.
Username and Password The username and password required by the server. Shown when the Authentication Type is Username / Password.
Token The authentication token required by the server. Stored as a secret. Shown when the Authentication Type is Token.
Connect Timeout (seconds) Maximum time to wait when establishing a connection to the server. Valid range is 1–300 seconds, default 10 seconds.
Request Timeout (ms) How long to wait for a read, write, or request to complete before failing. Valid range is 100–60000 milliseconds, default 5000 ms.
Use TLS? Enable for NATS servers that require transport layer security. Disabled by default. See additional TLS options below.

Authentication Type Options:

Option Description
None Connect without credentials.
Username / Password Authenticate with a username and password.
Token Authenticate with a single token value.

TLS Options (shown when Use TLS? is enabled):

Option Description
Ignore Self-Signed Certificate Accepts any certificate returned from the server. Use only for testing.
CA Certificate The server CA certificate imported into the certificate store. Shown when Ignore Self-Signed Certificate is disabled.
Client Certificate/Key Pair The client certificate/key pair from the certificate store, used when the server requires mutual TLS.

Input Settings

NATS subjects support subscriptions and can be used as a source in an Event Trigger .

Setting Description
Input Type Controls what is read. Default is Last Value. See the options below.
Subject The NATS subject to read from. Branch inputs may include wildcards. See Subject Wildcards below.
Request Body The message body to send with a Request input. Shown when the Input Type is Request.
Use JetStream When enabled, the last value is read from a JetStream stream rather than the core NATS last value. Disabled by default. Shown for Last Value.
Stream Name The JetStream stream to read from. Shown when Use JetStream is enabled.
Payload Type The type of payload to process. Default is Any. See the options below.
Include Metadata When enabled, NATS message metadata (such as subject and headers) is included alongside the value in the read data. Disabled by default.

Input Type Options

Type Description
Last Value Listens on a subject and returns the last received value.
Request Sends a message (the Request Body) on the subject and waits for a reply.
Branch Subscribes with a wildcard subject and returns the last message received per matching subject.

Payload Type Options

Type Description
Any The payload can be JSON, String, or Binary.
JSON The payload is deserialized as JSON. Non-JSON payloads ignored.
UTF-8 The payload is treated as a string.
Binary The payload is treated as a byte array.

Output Settings

Setting Description
Subject The NATS subject to publish messages to.
Use JetStream When enabled, messages are published to a JetStream stream. Otherwise the message is published to core NATS. Disabled by default.
Stream Name The JetStream stream to publish to. Shown when Use JetStream is enabled.
Include Headers When enabled, custom headers are attached to each published message. Disabled by default.
Headers A list of Name/Value header pairs to attach to the message. Shown when Include Headers is enabled.

Subject Wildcards

Branch inputs and subscriptions can use NATS subject wildcards:

  • * matches exactly one token. For example, factory.*.temperature matches factory.line1.temperature and factory.line2.temperature.
  • > matches one or more remaining tokens and must be the last token. For example, factory.> matches factory.line1.temperature and factory.line1.motor.speed.

JetStream

NATS JetStream provides persistence on top of core NATS. Enable Use JetStream on an input or output and provide a Stream Name to read the last value from, or publish messages to, a persisted stream rather than transient core NATS messaging.