Actions11
Overview
This node manages NATS JetStream consumers, specifically allowing you to create new consumers on an existing JetStream stream. It is useful in scenarios where you want to set up message consumers that process or react to messages published on a JetStream stream. For example, you might create a durable consumer to reliably process order events or an ephemeral consumer for transient event processing.
Typical use cases include:
- Creating durable consumers that persist across restarts and maintain state.
- Setting up ephemeral consumers for temporary or one-off message consumption.
- Filtering messages by subject patterns.
- Configuring delivery and acknowledgment policies to control how messages are delivered and acknowledged.
Properties
| Name | Meaning |
|---|---|
| Stream Name | The name of the existing JetStream stream on which the consumer will be created. This stream must already exist. |
| Consumer Configuration | A collection of settings to configure the consumer: - Consumer Name: Name of the consumer (required for durable consumers). Leave empty for ephemeral consumers. - Durable Name: Durable consumer name (persists across restarts). Required for durable consumers. - Description: Human-readable description of the consumer. - Delivery Policy: Controls which messages are delivered: • All • By Start Sequence • By Start Time • Last • Last Per Subject • New - Acknowledgment Policy: How message acknowledgments are handled: • Explicit (messages must be explicitly acknowledged) • All (acknowledging a message acknowledges all previous messages) • None (no acknowledgments required) - Filter Subject: Subject pattern to filter messages this consumer receives. - Start Sequence: Starting sequence number for delivery (used if Delivery Policy is "By Start Sequence"). - Start Time: Starting timestamp for delivery in ISO format (used if Delivery Policy is "By Start Time"). - Acknowledgment Wait (Seconds): Time to wait for acknowledgment before redelivery. - Max Deliver: Maximum delivery attempts (-1 means unlimited). - Max Ack Pending: Maximum number of outstanding acknowledgments. - Max Waiting: Maximum number of outstanding pull requests. - Number of Replicas: Number of replicas for the consumer (0 inherits from stream). |
Output
The node outputs JSON data representing the result of the consumer creation operation. This typically includes details about the created consumer such as its configuration and status as returned by the JetStream management API.
No binary data output is produced by this node.
Dependencies
- Requires a connection to a NATS server with JetStream enabled.
- Needs an API key credential or equivalent authentication configured in n8n to connect to the NATS server.
- The target JetStream stream must already exist before creating a consumer on it.
Troubleshooting
Common issues:
- Attempting to create a consumer on a non-existent stream will fail.
- Providing invalid subject filters or delivery policies may cause errors.
- Missing required fields for durable consumers (like durable name) will cause failures.
- Network or authentication issues connecting to the NATS server.
Error messages:
"Unknown consumer operation": Indicates the specified operation is not supported; verify the operation name."Unknown resource": The resource parameter is incorrect or unsupported."NATS JetStream operation failed: ...": General failure connecting or performing the operation on the NATS server; check credentials and network connectivity.- Validation errors related to subject filters or configuration parameters.
To resolve errors:
- Ensure the stream exists before creating consumers.
- Double-check all required properties are provided.
- Verify the NATS server credentials and network access.
- Use appropriate delivery and acknowledgment policies matching your use case.