NATS JetStream icon

NATS JetStream

Manage NATS JetStream streams, consumers, and publish messages

Actions11

Overview

This node interacts with NATS JetStream, a messaging system that supports streams and consumers for reliable message delivery. Specifically, the "Consumer - List" operation retrieves a list of consumers associated with a specified JetStream stream. This is useful when you want to monitor or manage existing consumers on a stream, for example, to audit active consumers, check their configurations, or perform administrative tasks.

Practical examples include:

  • Listing all consumers on a stream to verify which applications or services are currently consuming messages.
  • Integrating with monitoring workflows to alert if no consumers exist on a critical stream.
  • Automating consumer management by retrieving consumer details before updating or deleting them.

Properties

Name Meaning
Stream Name The name of the JetStream stream whose consumers you want to list. The stream must already exist in JetStream.

Output

The output is a JSON object containing the list of consumers for the specified stream. Each consumer entry typically includes details such as the consumer's name and configuration parameters (though exact fields depend on the JetStream API response). The output structure allows further processing or inspection within n8n workflows.

No binary data is produced by this operation.

Example output snippet (conceptual):

{
  "consumers": [
    {
      "name": "consumer1",
      "config": { /* consumer configuration details */ }
    },
    {
      "name": "consumer2",
      "config": { /* consumer configuration details */ }
    }
  ]
}

Dependencies

  • Requires an active connection to a NATS JetStream server.
  • Needs credentials providing access to the NATS server via an API key or authentication token.
  • The target JetStream stream must already exist before listing its consumers.
  • No additional external dependencies beyond the NATS client libraries bundled with the node.

Troubleshooting

  • Common issues:

    • Specifying a non-existent stream name will likely cause an error because the node attempts to list consumers on a stream that does not exist.
    • Network connectivity problems or incorrect credentials can prevent connecting to the NATS server.
    • Using an unsupported or unknown operation or resource will throw an error.
  • Error messages:

    • "Unknown consumer operation: List" — indicates the operation name is misspelled or not implemented.
    • "NATS JetStream operation failed: <message>" — generic failure connecting or executing the request; check credentials, network, and stream existence.
    • "Unknown resource: consumers" — if the resource parameter is incorrect or missing.
  • Resolutions:

    • Verify the stream exists in JetStream before running the node.
    • Confirm credentials and network access to the NATS server.
    • Use the exact operation and resource names supported by the node.

Links and References

Discussion