How captainlegoo/drpc works
Project type and purpose
• This is a modular, open‑source RPC framework built in Java and Maven. It provides:
• An interface module defining RPC contracts
• A core engine for bootstrapping, proxying, Netty networking, serialization, compression, load balancing, heartbeats
• Pluggable registry center adapters (Zookeeper, Redis)
• Pluggable serialization engines (JDK, Protostuff) and compressors (Deflate, Gzip)
• Example/test consumers and providers (plain Java and Spring‐boot)
File structure
• Top‑level modules:
rpc-common (shared constants, exceptions, utilities)
rpc-interface (service, registry, compress, serialize interfaces)
rpc-core (bootstrapper, Netty starters & handlers, proxy, cache, config, factory, strategy, tasks)
rpc-registrycenter
• redis adapter
• zookeeper adapter
rpc-serialization
• JDK adapter
• Protostuff adapter
rpc-compress
• Deflate adapter
• Gzip adapter
rpc-test (api, plain consumer/provider, Spring consumer/provider)
• Patterns:
• Strategy (SerializeStrategy, CompressStrategy, LoadbalancerStrategy)
• Factory (RegistryFactory, ProxyConfig, Serializer/Compressor factories)
• Builder/Fluent API (DRpcBootstrap)
• Observer/Watcher (registry listeners)
• Runtime components: DRpcBootstrap, ConsumerNettyStarter, ProviderNettyStarter, various handlers
Key insights from the README
• DRpcBootstrap configuration for consumer and provider (with optional Spring integration via BeanPostProcessor)
• Zookeeper node layout under /rpc‑metadata for providers, consumers, config
• How proxies are injected for @RpcReference fields and how @RpcService is used to mark server implementations