Actions11
Overview
This node manages NATS JetStream streams, consumers, and messages. Specifically for the Stream - Purge operation, it allows users to purge all messages from a specified JetStream stream. This is useful when you want to clear out all stored messages in a stream without deleting the stream itself, for example, to reset the stream state or free up storage.
Practical scenarios include:
- Clearing test data from a stream before starting a new batch of message processing.
- Resetting a stream after an error or misconfiguration.
- Managing storage by purging obsolete messages while keeping the stream configuration intact.
Properties
| Name | Meaning |
|---|---|
| Stream Name | Name of the JetStream stream to purge. Stream names should be descriptive to clearly identify their purpose. |
Output
The node outputs a JSON object representing the result of the purge operation. Typically, this will confirm that the purge was successful or provide details if any issues occurred during the purge.
The output structure is:
{
"json": {
// Result details of the purge operation, e.g. success confirmation or metadata
},
"pairedItem": {
"item": <index_of_input_item>
}
}
No binary data output is involved in this operation.
Dependencies
- Requires a valid connection to a NATS JetStream server.
- Needs an API key credential configured in n8n for authenticating with the NATS server.
- Uses internal utilities to create and manage the NATS connection and JetStream manager.
Troubleshooting
Common Issues:
- Incorrect or missing stream name: The operation requires a valid stream name; ensure the stream exists on the JetStream server.
- Connection failures: Verify network connectivity and correct API credentials.
- Permission errors: The API key used must have permissions to manage streams and perform purge operations.
Error Messages:
Unknown stream operation: purge— indicates the operation name might be misspelled or unsupported; verify the operation parameter.NATS JetStream operation failed: <error message>— generic failure; check the detailed error message for specifics such as authentication failure, stream not found, or permission denied.
Resolution Tips:
- Double-check the stream name spelling and existence.
- Confirm API credentials are correctly set up and have necessary permissions.
- Ensure the NATS JetStream server is reachable from the n8n instance.