Nats Trigger icon

Nats Trigger

Consume messages from a Nats subject

Nats Trigger

AI-generated

Overview

This node acts as a trigger to consume messages from a NATS subject (a messaging queue system). It connects to a specified NATS server, subscribes to a given subject and queue, and emits incoming messages as JSON data. It is useful for workflows that need to react to real-time messages or events published on a NATS subject, such as processing notifications, data streams, or inter-service communication.

Use Case Examples

  1. A workflow that triggers whenever a new message is published to a specific NATS subject, allowing real-time processing of the message content.
  2. A system that listens to a queue for task assignments and triggers automation when new tasks arrive.

Properties

Name Meaning
Subject Name of the queue or subject to consume messages from.
Queue Name of the queue group to join for message consumption.

Output

JSON

  • data - The decoded JSON message received from the NATS subject.

Dependencies

  • NATS server connection with optional username and password authentication

Troubleshooting

  • Ensure the NATS server addresses are correctly configured in the credentials; connection failures may occur otherwise.
  • If authentication is enabled, both username and password must be provided, or the node will throw an error.
  • Messages must be JSON-encoded; otherwise, decoding errors may occur.
  • If the subscription closes unexpectedly, check network stability and server availability.

Discussion