Skip to content

[Feature] Implement Redis Advanced Patterns Skill for Java Plugin #147

Description

@giuseppe-trisciuoglio

[Feature] Implement Redis Advanced Patterns Skill for Java Plugin

Overview

This issue proposes the creation and implementation of a new skill for the developer-kit-java plugin focused on Redis Advanced Patterns. While the existing caching skill covers basic usage, Redis is frequently employed for more complex distributed systems patterns such as distributed locking, rate limiting, and lightweight message queuing.

The goal is to provide developers with ready-to-use patterns and implementation knowledge for advanced Redis features, primarily using Spring Data Redis and Redisson.

Proposed Patterns

The new skill will focus on three primary advanced patterns that are essential for modern distributed applications. These patterns go beyond simple caching and leverage Redis's powerful data structures and the Redisson library's high-level abstractions.

Pattern Key Features Primary Implementation
Distributed Locking Reliable lock acquisition, automatic renewal (Watchdog), and deadlock prevention. Redisson (RLock)
Rate Limiting API protection using algorithms like Token Bucket, Fixed Window, or Sliding Window. Redisson (RRateLimiter) or Spring Data Redis
Lightweight Message Queues Robust asynchronous messaging with Consumer Groups and acknowledgments (ACK). Redis Streams (Spring Data Redis)

Distributed Locking with Redisson

The implementation of reliable distributed locks is critical for maintaining data consistency in multi-node environments. This skill will provide guidance on using the Redisson library to manage lock acquisition and expiration. Key topics include the use of the "Watchdog" mechanism for automatic lock renewal and strategies for ensuring high availability within a Redis Cluster or Sentinel setup.

Rate Limiting Strategies

To protect APIs from abuse and ensure fair resource allocation, the skill will detail various rate-limiting strategies. This includes the implementation of Token Bucket or Leaky Bucket algorithms. Developers will learn how to integrate these limits directly into Spring Boot filters or interceptors, either through custom logic with Spring Data Redis or by utilizing the simplified RRateLimiter interface provided by Redisson.

Lightweight Message Queues via Redis Streams

Redis Streams offer a robust alternative to traditional message brokers for lightweight use cases. This pattern will cover the utilization of Streams for asynchronous message processing, including the management of Consumer Groups. Emphasis will be placed on handling message acknowledgments (ACK), implementing retry logic, and establishing dead-letter queue (DLQ) patterns for failed message handling.

Technical Details

  • Target Plugin: developer-kit-java
  • Primary Frameworks: Spring Data Redis (Lettuce/Jedis), Redisson.
  • Skill Structure:
    • SKILL.md: Core documentation, configuration, and usage examples.
    • references/: Detailed guides for each pattern (e.g., distributed-lock.md, rate-limiting.md, redis-streams.md).

Implementation Plan

  • Create the skill directory: ./plugins/developer-kit-java/skills/redis-advanced-patterns.
  • Implement SKILL.md with an overview and configuration snippets.
  • Create reference documentation in the references/ subdirectory.
  • Add code examples for Spring Boot integration.

References

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions