跳到主要内容
版本:Next
output/natsINPUTBUFFERPROCESSOROUTPUT

NATS

The NATS output publishes messages to a NATS server, either to a regular subject or to a JetStream stream. It supports optional username/password or token authentication.

Configuration

FieldTypeRequiredDefaultDescription
typestringyesFixed value "nats"
urlstringyesNATS server URL (e.g. nats://localhost:4222).
modeobjectyesPublishing mode (see below).
authobjectnoAuthentication configuration (see below).
value_fieldstringnoRecord field used as the message payload.

mode

mode is a tagged object (selected by its type field).

FieldTypeRequiredDefaultDescription
typestringyesregular or jet_stream.
subjectobjectyesNATS subject to publish to (expression; see below).

subject (Expr<String>)

FieldTypeRequiredDescription
typestringyesvalue (static) or expr (SQL expression).
valuestringyes (value)Static subject name.
exprstringyes (expr)SQL expression evaluated per message.

auth

FieldTypeRequiredDefaultDescription
usernamestringnoUsername (use with password).
passwordstringnoPassword (use with username).
tokenstringnoAuthentication token.

Only one of username/password or token should be configured; if both are present, username/password takes precedence.

Examples

Regular subject with username/password

output:
type: "nats"
url: "nats://localhost:4222"
mode:
type: "regular"
subject:
type: "expr"
expr: "concat('orders.', id)"
auth:
username: "user"
password: "pass"
value_field: "message"

JetStream with token

output:
type: "nats"
url: "nats://localhost:4222"
mode:
type: "jet_stream"
subject:
type: "value"
value: "orders.new"
auth:
token: "secret-token"