Skip to content

Phase 2: Extract Customers

Status: Done
Risk: Low — Customers has no upstream dependencies at the service boundary.
Rollback cost: Low — re-route /v1/customers/* to monolith in Kong; no data loss if dual-write is healthy.


Goal

Customers is the lowest-risk extraction: smallest domain, simplest data model, no dependencies on Orders or Inventory at the service boundary. Extracting it first gives the team a full practice run of the extraction workflow (CDC bootstrap, dual-write, traffic canary, SLA validation) before tackling CQRS and event sourcing.


What Changes

Concern Before After
Customer data store Oracle (shared) PostgreSQL (per-service)
/v1/customers/* handler Monolith Java EE Customers Service (TypeScript/Fastify)
Customer events None CustomerRegistered, AddressUpdated on Kafka
SLA measurement None customers-sla.yaml → SLO → Prometheus alerts

Extraction Sequence

  1. Bootstrap data: Debezium CDC from Oracle customers table → chakra.customers.bootstrap topic → Postgres.
  2. Dual-write enabled: Customers Service writes to Postgres; relay also writes to Oracle.
  3. Canary start: Kong routes 1% of /v1/customers/* to Customers Service.
  4. Canary ramp: 1% → 10% → 50% → 100% (24-hour hold at each weight, SLA must hold).
  5. Dual-write disabled: Once at 100%, relay is stopped. Oracle customers table becomes stale.
  6. Monolith handler decommissioned: After 30 days at 100% with SLA compliance, the monolith customer handler is removed.

Go / No-Go Criteria

  • Customers Service p99 latency ≤ 300ms at all canary weights
  • 0 data divergence between Postgres and Oracle during dual-write (reconciliation job confirms)
  • CustomerRegistered events appearing in Kafka for all new registrations

Rollback

  1. Kong: set /v1/customers/* weight to 0 for Customers Service (monolith receives 100%).
  2. If dual-write is active: no data loss. If dual-write is disabled: Oracle may be stale — restore from Postgres via reverse CDC if required.
  3. Trigger: SLA burn rate > 2× for 15 minutes, or data divergence > 0.1%.