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 streaming data. Specifically, the Stream - Get Info operation retrieves detailed information about a specified JetStream stream. This is useful for monitoring and managing streams, such as checking their configuration, status, or metadata.

Common scenarios include:

  • Verifying the existence and configuration of a stream before publishing messages.
  • Auditing stream properties in an automated workflow.
  • Integrating stream status checks into larger event-driven automation pipelines.

For example, you might use this node to fetch details about a stream named "EVENTS" to confirm its retention policy and subjects before sending new messages.

Properties

Name Meaning
Stream Name The name of the JetStream stream to get information about. Stream names should be descriptive (e.g., "EVENTS").

Output

The output JSON contains detailed information about the requested JetStream stream. This typically includes:

  • Stream configuration details (such as subjects, retention policies, max messages, max bytes).
  • Stream state information (like message count, first/last sequence numbers, consumer count).
  • Metadata related to the stream's current status.

The exact structure depends on the JetStream API response but generally provides comprehensive insight into the stream's setup and runtime state.

No binary data output is produced by this operation.

Dependencies

  • Requires a valid connection to a NATS server with JetStream enabled.
  • Needs an API key credential or equivalent authentication configured in n8n to connect securely to the NATS server.
  • Uses bundled NATS client libraries internally to communicate with the JetStream management API.

Troubleshooting

  • Common issues:

    • Incorrect or misspelled stream name will cause the operation to fail because the stream cannot be found.
    • Network connectivity problems or invalid credentials can prevent connecting to the NATS server.
    • Using an unsupported or unknown operation name will throw an error.
  • Error messages:

    • Unknown stream operation: getInfo (or similar): Indicates the operation name is not recognized; verify the operation parameter.
    • NATS JetStream operation failed: ...: General failure connecting or executing the request; check credentials, network, and stream existence.
    • Unknown resource: stream: If the resource parameter is incorrect or missing.

To resolve these errors:

  • Double-check the stream name spelling and existence on the NATS server.
  • Verify that the API key or authentication token is correctly set up in n8n credentials.
  • Ensure the NATS server is reachable from the environment where n8n runs.

Links and References

Discussion