Overview
The Redis Collector node is designed to interact with a Redis data store to save and collect messages from a Redis list using a locking mechanism. It supports two main operation modes:
- Save and Collect: Saves incoming messages to a Redis list, waits for a specified delay, then collects all messages from that list atomically by acquiring a lock to prevent concurrent access.
- Collect Only: Simply collects existing messages from the Redis list without saving new ones.
This node is useful in scenarios where multiple workflows or processes need to aggregate messages or events reliably over a short period before processing them together. For example, it can be used to batch process chat messages, sensor data, or event logs that arrive asynchronously but should be handled collectively.
Practical examples:
- Collecting user chat messages sent within a 5-second window before processing them as a batch.
- Aggregating IoT device telemetry data arriving at irregular intervals.
- Coordinating distributed workflow executions by collecting intermediate results stored in Redis.
Properties
| Name | Meaning |
|---|---|
| Operation Mode | Choose between "Save and Collect" (save incoming messages and then collect) or "Collect Only" (just collect existing messages). |
| Thread ID | The Redis list key used to store and collect messages. Can be auto-extracted from input JSON or specified manually. |
| Auto Save Input | (Only for "Save and Collect") Whether to automatically save incoming input data to the Redis list. |
| Collection Delay (seconds) | (Only for "Save and Collect") Time in seconds to wait after saving before collecting messages. Must be between 1 and 60 seconds. |
| Lock TTL (seconds) | Time-to-live for the Redis lock key in seconds, controlling how long the lock is held. Range: 5 to 300 seconds. |
| Connection Timeout (seconds) | Timeout for connecting to Redis in seconds. Range: 1 to 30 seconds. |
| Enable Debug Logging | Enables detailed debug logging for troubleshooting and monitoring internal operations. |
Output
The node outputs an array of items where:
The first item contains metadata about the collection operation, including:
threadId: The Redis list key used.operationoroperationMode: The mode used ("saveAndCollect" or "collectOnly").messageCount: Number of messages collected.- Additional counts such as how many messages were initially saved or appended.
timestamp: ISO string timestamp of the operation.rawMessages(optional): Raw JSON strings of the collected messages if debug logging is enabled.
Subsequent items represent each collected message as individual JSON objects parsed from the Redis list entries.
If the node operates in "Collect Only" mode, it simply returns the collected messages without saving any new input.
No binary data output is produced by this node.
Dependencies
- Requires a connection to a Redis server with appropriate credentials (host, port, optional password, and database index).
- The node uses a Redis client library to connect and perform list and key operations.
- Requires configuration of Redis credentials in n8n (an API key or password-based authentication).
- The node depends on Redis supporting commands like
LPUSH,LRANGE,DEL, and simple key-value operations for locking (SETwith NX and EX options).
Troubleshooting
Common Issues
- Missing or invalid Thread ID: The node requires a non-empty thread ID to identify the Redis list. Ensure the input JSON contains one of the expected fields (
threadId,ID, orthread_id) or specify it manually. - Redis connection failures: Check network connectivity, Redis host/port correctness, and credential validity.
- Lock acquisition failure: If another process holds the lock, the node may not collect messages immediately. This is expected behavior to avoid race conditions.
- Timeouts: If Redis does not respond within the configured timeout, the node will error out.
- JSON parsing errors: Messages stored in Redis must be valid JSON strings; otherwise, parsing will fail.
Error Messages and Resolutions
"Thread ID is required": Provide a valid thread ID either via input data or manual configuration."Redis credentials are required": Configure Redis credentials properly in n8n."Redis Collector operation failed: <error>": Indicates a Redis command or connection error. Check Redis server status and credentials.- Lock-related debug logs indicate whether the node successfully acquired or failed to acquire the lock. If lock acquisition repeatedly fails, ensure no other process is holding the lock indefinitely.
Enabling debug logging helps trace these issues by providing detailed internal state information.