$ show ZhangBlossom/BlossomGateway
BlossomGateway is a custom API gateway built on Netty, supporting HTTP and Dubbo protocols. It uses Nacos for service registration and configuration, Redis for distributed rate limiting, and provides a pluggable filter chain for routing, load balancing (random, round-robin, weighted, consistent hash), authentication (JWT), gray release, flow control (Guava/Redis), circuit breaking (Hystrix), monitoring (Prometheus), and mocking. The gateway core is a Netty server that processes incoming HTTP requests, creates a GatewayContext, and runs through a chain of filters before routing to backend services. It also includes a client SDK (BlossomGateway-Client) for downstream services to register themselves. Additionally, the repository contains a separate custom RPC framework (BlossomRPC) with its own protocol, serialization, and dynamic proxy, which appears to be experimental/educational. The project is structured as a multi-module Maven project with clear separation of concerns. However, the codebase shows signs of being a learning project with many TODOs, hardcoded values, and personal promotional content, indicating it may not be production-ready.
The LLM identified 4 files worth highlighting for reuse:
Encapsulates LMAX Disruptor for high-performance asynchronous event processing. Uses a builder pattern for configuration (buffer size, wait strategy, exception handler) and provides a clean API for publishing events. Self-contained and extractable for any project needing a fast, bounded async queue.
Implements consistent hashing for load balancing using a TreeMap and MD5 hash. Supports virtual nodes for better distribution. Standalone algorithm class that can be reused in any distributed system requiring consistent routing.
Implements distributed rate limiting using Redis with Lua scripting for atomicity. Uses a sliding window counter approach. Self-contained and reusable for any application needing distributed rate limiting.
Custom binary protocol encoder for RPC messages. Handles header construction (version, compression, serialization type, request ID, length) and body serialization. Demonstrates non-obvious skill in binary protocol design and can be extracted for other custom RPC implementations.