NATS JetStream icon

NATS JetStream

Manage NATS JetStream streams, consumers, and publish messages

Actions11

Overview

This node manages NATS JetStream consumers, streams, and messages. Specifically for the Consumer Delete operation, it deletes a specified consumer from a given JetStream stream. This is useful in scenarios where you want to clean up or remove consumers that are no longer needed, such as after processing jobs or when reconfiguring your message consumption topology.

Practical example:

  • Automatically deleting a consumer after a batch job completes to avoid unnecessary resource usage.
  • Removing stale or misconfigured consumers during deployment automation.

Properties

Name Meaning
Stream Name The name of the JetStream stream from which the consumer will be deleted. Must exist.
Consumer Name The name of the consumer to delete.

Output

The output JSON contains the result of the delete operation. Typically, this will include confirmation details or status information returned by the JetStream management API about the deleted consumer.

Example output structure (conceptual):

{
  "success": true,
  "streamName": "EVENTS",
  "consumerName": "order-processor",
  "message": "Consumer deleted successfully"
}

No binary data output is involved in this operation.

Dependencies

  • Requires an active connection to a NATS JetStream server.
  • Needs an API key credential configured in n8n for authenticating with the NATS server.
  • Uses internal utilities to manage connections and perform JetStream operations.

Troubleshooting

  • Common issues:

    • Attempting to delete a consumer from a non-existent stream will cause errors.
    • Deleting a consumer that does not exist will likely return an error.
    • Network or authentication failures can prevent successful connection to the NATS server.
  • Error messages:

    • "Unknown consumer operation: delete" — indicates the operation name is incorrect or unsupported.
    • "NATS JetStream operation failed: <error message>" — generic failure; check credentials, network connectivity, and stream/consumer names.
    • "The stream must exist before creating consumers" — ensure the stream exists before attempting consumer operations.
  • Resolutions:

    • Verify stream and consumer names are correct and exist on the server.
    • Confirm API credentials are valid and have sufficient permissions.
    • Check network connectivity to the NATS server.

Links and References

Discussion