← Previous Chapter: Part 6: Phase 1 — Strangler Fig | Series Hub | Next Chapter: Part 8: Phase 3 — Full Cutover →


Answer-first: Dual-writing at the application layer creates race conditions and split-brain states. Instead, Phase 2 implements Change Data Capture (CDC) via Debezium reading the MySQL binlog directly, streaming event deltas through Apache Kafka to populate PostgreSQL microservice databases asynchronously.


flowchart LR
    MagentoAdmin["Magento Admin Update"] --> MySQL["Magento MySQL"]
    MySQL -->|"Binlog Stream"| Debezium["Debezium CDC Connector"]
    Debezium -->|"JSON Event Deltas"| Kafka["Kafka Topic: magento.catalog.products"]
    Kafka -->|"Consumer Group"| GoSync["Go Catalog Sync Worker"]
    GoSync -->|"Upsert JSONB"| Postgres["Target PostgreSQL"]