Skip to content

[Epic] Refactor oneCoupon: EDA + DDD + Clean Architecture (Kafka, Temporal) #20

Description

@Rurutia1027

[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)

  1. Foundationcommon-domain, infrastructure/{outbox,saga,messaging-kafka,event-contract}, ArchUnit rules
  2. Pilot slice — Merchant coupon task → Temporal schedule → outbox → Kafka → Distribution (replace XXL-Job + RocketMQ on this path)
  3. Expand — Engine (redeem, order saga), settlement projections, search (domain events vs Canal)
  4. 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

  • One vertical slice runs on ports + outbox + Kafka with Temporal for scheduling
  • domain-core has no Kafka / JPA / Web dependencies (ArchUnit green)
  • P0 consumers have retry + DLT and idempotent processing
  • Refactor design docs updated with pilot outcomes

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions