[Epic] Refactor oneCoupon: EDA + DDD + Clean Architecture (Kafka, Temporal)
Goal
Evolve Promption-Engine from layered Spring microservices (shared DB, duplicated RocketMQ glue) into an event-driven, domain-centric platform:
| Pillar |
Target |
| Clean Architecture |
Domain at the center; Kafka, JPA, Redis, Temporal as adapters behind ports |
| DDD |
Bounded contexts, aggregates, domain events -- business rules in domain-core, not *ServiceImpl |
| EDA |
Kafka + outbox + Avro contracts; sagas for cross-service flows; idempotent consumers |
Why
- Shared MySQL + duplicated
*DO / MQ templates block true service boundaries.
- RocketMQ delay/DLQ does not map 1:1 to strict EDA - migrate to Kafka + Temporal + retry/DLT topics
Scope (phased)
- Foundation —
common-domain, infrastructure/{outbox,saga,messaging-kafka,event-contract}, ArchUnit rules
- Pilot slice — Merchant coupon task → Temporal schedule → outbox → Kafka → Distribution (replace XXL-Job + RocketMQ on this path)
- Expand — Engine (redeem, order saga), settlement projections, search (domain events vs Canal)
- Retire — RocketMQ dependencies, per-module send templates, shared-table coupling
Out of Scope (for now)
- Full DB-per-service cutover for all contexts
- Production multi-region / full K8s platform
Done when
[Epic] Refactor oneCoupon: EDA + DDD + Clean Architecture (Kafka, Temporal)
Goal
Evolve Promption-Engine from layered Spring microservices (shared DB, duplicated RocketMQ glue) into an event-driven, domain-centric platform:
domain-core, not*ServiceImplWhy
*DO/ MQ templates block true service boundaries.Scope (phased)
common-domain,infrastructure/{outbox,saga,messaging-kafka,event-contract}, ArchUnit rulesOut of Scope (for now)
Done when
domain-corehas no Kafka / JPA / Web dependencies (ArchUnit green)