n8n-nodes-redis-collector
TypeScript icon, indicating that this package has built-in type declarations

3.0.9 • Public • Published

Redis Collector Node for n8n

🚀 Version 2.0 - Completely rewritten with improved architecture and reliability!

A powerful n8n community node for collecting messages from Redis lists with multiple collection strategies and robust error handling.

✨ Features

  • Multiple Collection Strategies: RPOP, LPOP, and LRANGE (peek-only)
  • Smart Message Parsing: Automatic JSON parsing with fallback to plain text
  • Robust Error Handling: Comprehensive error management and logging
  • Debug Mode: Detailed logging for troubleshooting
  • Connection Management: Automatic connection cleanup and timeout handling
  • Parameter Validation: Input validation with helpful error messages
  • Performance Optimized: Efficient Redis operations with minimal overhead

📦 Installation

npm install n8n-nodes-redis-collector@2.0.0

🔧 Configuration

Redis Credentials

  1. Go to Credentials in your n8n instance
  2. Create new Redis API credential
  3. Configure:
    • Host: Redis server hostname (default: localhost)
    • Port: Redis server port (default: 6379)
    • Password: Redis password (if required)
    • Database: Redis database number (default: 0)

Node Parameters

Parameter Type Default Description
Thread ID String - Redis list key to collect from
Max Messages Number 10 Maximum messages to collect (1-100)
Collection Strategy Options pop_right How to collect messages
Timeout Number 5 Connection timeout in seconds
Enable Debug Boolean false Enable detailed logging

Collection Strategies

🔄 Pop from Right (RPOP)

  • Use case: LIFO (Last In, First Out) processing
  • Behavior: Removes and returns messages from the right end
  • Best for: Stack-like operations, newest messages first

🔄 Pop from Left (LPOP)

  • Use case: FIFO (First In, First Out) processing
  • Behavior: Removes and returns messages from the left end
  • Best for: Queue-like operations, oldest messages first

👁️ Peek Only (LRANGE)

  • Use case: Read-only operations
  • Behavior: Reads messages without removing them
  • Best for: Monitoring, debugging, non-destructive reads

🎯 Usage Examples

Basic Message Collection

{
  "threadId": "user_messages_123",
  "maxMessages": 5,
  "strategy": "pop_right",
  "timeout": 10,
  "enableDebug": true
}

Queue Processing (FIFO)

{
  "threadId": "task_queue",
  "maxMessages": 20,
  "strategy": "pop_left",
  "timeout": 5,
  "enableDebug": false
}

Monitoring (Non-destructive)

{
  "threadId": "system_logs",
  "maxMessages": 50,
  "strategy": "peek",
  "timeout": 3,
  "enableDebug": true
}

📊 Output Format

Each collected message returns:

{
  "index": 0,
  "threadId": "user_messages_123",
  "strategy": "pop_right",
  "message": { "parsed": "json" },
  "timestamp": "2024-01-15T10:30:00.000Z",
  "rawMessage": "{\"parsed\": \"json\"}"
}

Fields Explanation

  • index: Message position in the collected batch
  • threadId: Source Redis list key
  • strategy: Collection method used
  • message: Parsed message (JSON object or plain string)
  • timestamp: Collection timestamp (ISO format)
  • rawMessage: Original message string from Redis

🐛 Debug Mode

Enable debug logging to see detailed operation information:

[RedisCollector] Connected to Redis: localhost:6379
[RedisCollector] Target list: user_messages_123
[RedisCollector] Strategy: pop_right, Max messages: 5
[RedisCollector] List length: 12
[RedisCollector] Will collect 5 messages
[RedisCollector] RPOP: {"user":"john","action":"login"}
[RedisCollector] RPOP: {"user":"jane","action":"logout"}
[RedisCollector] Collected 5 messages total
[RedisCollector] Returning 5 processed items
[RedisCollector] Disconnected from Redis

⚠️ Error Handling

The node provides comprehensive error handling:

  • Connection Errors: Timeout and network issues
  • Authentication Errors: Invalid credentials
  • Parameter Validation: Invalid inputs
  • Redis Errors: Server-side issues

All errors include descriptive messages for easy troubleshooting.

🔄 What's New in v2.0

✅ Improvements

  • Complete rewrite with modern TypeScript patterns
  • Simplified architecture - removed complex execution tracking
  • Better error handling with specific error types
  • Enhanced debugging with structured logging
  • Multiple collection strategies (RPOP, LPOP, LRANGE)
  • Automatic JSON parsing with fallback
  • Parameter validation with helpful messages
  • Connection management with proper cleanup

🗑️ Removed

  • Complex execution tracking system
  • Wait time parameters (simplified to timeout)
  • Lock mechanisms (not needed with new architecture)
  • Fallback collection methods (replaced with strategies)

🤝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

📄 License

MIT License - see LICENSE file for details.

🆘 Support

If you encounter issues:

  1. Enable debug mode to see detailed logs
  2. Check Redis connection and credentials
  3. Verify Redis list exists and has data
  4. Review n8n logs for additional context

Made with ❤️ for the n8n community

Package Sidebar

Install

npm i n8n-nodes-redis-collector

Weekly Downloads

67

Version

3.0.9

License

MIT

Unpacked Size

26.1 kB

Total Files

9

Last publish

Collaborators

  • ptadigi