Lucky-cloud icon indicating copy to clipboard operation
Lucky-cloud copied to clipboard

refactor: Replace OpenFeign service calls with Dubbo RPC (Spring Cloud Alibaba + Nacos integration)

Open dennis9486 opened this issue 4 months ago • 0 comments

Title

Replace OpenFeign service calls with Dubbo RPC (Spring Cloud Alibaba + Nacos integration)

Summary

Migrate existing inter-service calls that use OpenFeign to Dubbo RPC and use Nacos for service discovery/configuration. Goals: reduce network overhead, improve high-concurrency performance, and unify governance (services expose/reference interfaces via Dubbo).

Requirements (key points)

  • Use Dubbo (recommend 3.x) for service exposure and consumption, with Nacos as the registry (keep Spring Cloud Alibaba environment).
  • Preserve existing interface contracts (Java interfaces + DTOs) and aim for a non-invasive replacement.
  • Provide timeout, retry, rate-limit and fallback strategies (can integrate Dubbo with Sentinel).
  • Add unit/integration/contract tests to ensure behavioral parity.
  • Provide a rollback plan: allow Feign and Dubbo to run in parallel temporarily to enable staged (canary) switch-over.

Tasks

  • [ ] Add shared Dubbo config in platform/common (Nacos registry, protocol, serialization, metadata-report).
  • [ ] Expose provider services as Dubbo providers (annotations/config) and register to Nacos.
  • [ ] Replace Feign clients with Dubbo references on the consumer side (keep same Java interfaces where possible).
  • [ ] Add circuit-breaker / rate-limiting / fallback strategies (recommend integrating Sentinel) and wire up monitoring metrics.
  • [ ] Implement integration tests: provider/consumer local e2e, contract tests, timeout/retry/fallback scenarios.
  • [ ] Update docs: developer onboarding, config reference, FAQ and rollback steps.

Acceptance Criteria

  • Key service calls after migration behave the same (API semantics, exception behavior, timeout/retry policies).
  • Nacos shows Dubbo service instances and service discovery works reliably.
  • Performance/resource usage meets or improves upon Feign-based implementation.

Migration steps (brief)

  1. Prepare shared Dubbo config and publish it to config-center (Nacos).
  2. Enable Dubbo providers on target services while keeping Feign endpoints active; register providers to Nacos for canary.
  3. Switch some consumers to Dubbo invocation and validate in parallel (or route small percentage of traffic via gateway).
  4. Monitor errors, latency, QPS; expand canary after validation.
  5. Once stable, remove Feign code and fully switch to Dubbo.

Notes / Caveats

  • Ensure DTOs are serializable and pick a compatible serialization (protobuf / fastjson2 / hessian2, etc.) per team standard.
  • Maintain class/interface compatibility between consumer and provider versions.
  • Evaluate gateway and cross-language scenarios (if non-Java clients exist, consider compatibility layer).
  • Keep authentication/authorization controls at Dubbo layer or at gateway as required.

dennis9486 avatar Oct 17 '25 02:10 dennis9486