How kwsc98/fusen-rs works
Project type and purpose
• Type: A Rust-based RPC microservice framework with compile-time code generation via macros.
• Purpose: Provide a lightweight, high-performance abstraction over multiple RPC protocols (HTTP1/2 JSON, gRPC, Dubbo3), service registration/discovery (Nacos), and middleware (load-balancer, AOP–style aspects), all without external code generation scripts.
File structure
• Workspace crates:
• fusen-common: shared utilities (config parsers, logging, errors, codec abstractions, registry client, date utils).
• fusen-macro: derives and procedural macros that generate RPC client/server boilerplate at compile time.
• fusen (core runtime): implements the server and client runtime, protocol handlers (HTTP, gRPC, Dubbo “triple”), routing, filters, registration, and built-in support modules (compression, shutdown, telemetry).
• examples: demonstration client and server projects showing how to configure and run fusen in standalone, Fusen-registry, Dubbo, and SpringCloud modes.
• Key patterns:
• *Builder pattern* for FusenApplicationContext (initialization, adding servers/clients/handlers).
• *Plugin/AOP pattern* for Handlers: load-balance, logging aspect, etc.
• *Macro-driven RPC trait expansions* via #[fusen_trait], #[fusen_server], and client stubs like DemoServiceClient.
• Config and deployment files:
• *-config.yaml in examples → service registry (Nacos) & network settings.
• Cargo.toml at each crate → dependency graph / build.
README for additional insights
• Multi-protocol support (HTTP1/2, gRPC, Dubbo3 “tri”)
• Service registry integration with Nacos for Rust ↔ Java interoperability.
• Extensibility points: custom load balancers, AOP aspects, custom codecs.
Detail
• How application context wires together common utilities, registry client, protocol servers, and handler chain.
• example apps only as instantiations of the framework: user code → macros → runtime.