{
  "title": "Change Data Capture",
  "description": "Models a Change Data Capture pattern with database changes flowing through event streams",
  "type": "data",
  "data": {
    "nodes": [
      {
        "id": "data-source-db",
        "type": "data",
        "position": {
          "x": 50,
          "y": 200
        },
        "data": {
          "mode": "full",
          "data": {
            "id": "source-database",
            "name": "Source Database",
            "owners": ["data-team"],
            "schemas": [],
            "version": "1.0.0",
            "summary": "Primary PostgreSQL database with business data that triggers CDC events",
            "type": "Database"
          },
          "editor": {
            "title": "Data Store",
            "subtitle": "Edit the details of the data store",
            "schema": {
              "type": "object",
              "required": [
                "data",
                "mode"
              ],
              "properties": {
                "data": {
                  "type": "object",
                  "required": [
                    "name",
                    "version"
                  ],
                  "properties": {
                    "name": {
                      "type": "string",
                      "title": "Name",
                      "default": "UserDatabase",
                      "description": "The name of the data store"
                    },
                    "version": {
                      "type": "string",
                      "title": "Version",
                      "default": "1.0.0",
                      "description": "The version number (e.g., 1.0.0)",
                      "pattern": "^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:-[\\\\w.-]+)?(?:\\\\+[\\\\w.-]+)?$"
                    },
                    "summary": {
                      "type": "string",
                      "title": "Summary",
                      "default": "",
                      "description": "A brief summary of the data store"
                    },
                    "type": {
                      "type": "string",
                      "title": "Type",
                      "default": "Database",
                      "description": "The type of data store",
                      "enum": [
                        "Database",
                        "Cache",
                        "Queue",
                        "File System",
                        "Data Lake",
                        "Data Warehouse"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "measured": {
          "width": 262,
          "height": 98
        },
        "selected": false,
        "dragging": false
      },
      {
        "id": "service-debezium",
        "type": "service",
        "position": {
          "x": 400,
          "y": 200
        },
        "data": {
          "mode": "full",
          "service": {
            "id": "debezium-connector",
            "name": "Debezium CDC Connector",
            "owners": ["platform-team"],
            "sends": [
              "UserCreated",
              "UserUpdated",
              "UserDeleted",
              "OrderCreated",
              "OrderUpdated"
            ],
            "receives": [],
            "version": "2.4.0",
            "summary": "Debezium connector that captures database changes and publishes CDC events"
          },
          "editor": {
            "title": "Service",
            "subtitle": "Edit the details of the service",
            "schema": {
              "type": "object",
              "required": [
                "service",
                "mode"
              ],
              "properties": {
                "service": {
                  "type": "object",
                  "required": [
                    "name",
                    "version"
                  ],
                  "properties": {
                    "name": {
                      "type": "string",
                      "title": "Name",
                      "default": "Random value",
                      "description": "The name of the service"
                    },
                    "version": {
                      "type": "string",
                      "title": "Version",
                      "default": "1.0.0",
                      "description": "The version number (e.g., 1.0.0)",
                      "pattern": "^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:-[\\\\w.-]+)?(?:\\\\+[\\\\w.-]+)?$"
                    },
                    "summary": {
                      "type": "string",
                      "title": "Summary",
                      "default": "",
                      "description": "A brief summary of the service"
                    }
                  }
                }
              }
            }
          }
        },
        "measured": {
          "width": 262,
          "height": 113
        },
        "selected": false,
        "dragging": false
      },
      {
        "id": "channel-kafka-cdc",
        "type": "channel",
        "position": {
          "x": 800,
          "y": 200
        },
        "data": {
          "mode": "full",
          "channel": {
            "id": "cdc-events-topic",
            "name": "cdc-events",
            "version": "1.0.0",
            "summary": "Kafka topic containing all change data capture events from source database"
          },
          "editor": {
            "title": "Channel",
            "subtitle": "Edit the details of the channel",
            "schema": {
              "type": "object",
              "required": [
                "channel",
                "mode"
              ],
              "properties": {
                "channel": {
                  "type": "object",
                  "required": [
                    "name",
                    "version"
                  ],
                  "properties": {
                    "name": {
                      "type": "string",
                      "title": "Name",
                      "default": "Random value",
                      "description": "The name of the channel"
                    },
                    "version": {
                      "type": "string",
                      "title": "Version",
                      "default": "1.0.0",
                      "description": "The version number (e.g., 1.0.0)",
                      "pattern": "^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:-[\\\\w.-]+)?(?:\\\\+[\\\\w.-]+)?$"
                    },
                    "summary": {
                      "type": "string",
                      "title": "Summary",
                      "default": "",
                      "description": "A brief summary of the channel"
                    }
                  }
                }
              }
            }
          }
        },
        "measured": {
          "width": 262,
          "height": 100
        },
        "selected": false,
        "dragging": false
      },
      {
        "id": "event-user-created",
        "type": "event",
        "position": {
          "x": 1200,
          "y": 60
        },
        "data": {
          "mode": "full",
          "message": {
            "id": "user-created-cdc",
            "name": "UserCreated",
            "version": "1.0.0",
            "summary": "CDC event published when a new user record is inserted into the database"
          },
          "editor": {
            "title": "Event",
            "subtitle": "Edit the details of the event",
            "schema": {
              "type": "object",
              "required": [
                "message",
                "mode"
              ],
              "properties": {
                "message": {
                  "type": "object",
                  "required": [
                    "name",
                    "version"
                  ],
                  "properties": {
                    "name": {
                      "type": "string",
                      "title": "Name",
                      "default": "Random value",
                      "description": "The name of the event"
                    },
                    "version": {
                      "type": "string",
                      "title": "Version",
                      "default": "1.0.0",
                      "description": "The version number (e.g., 1.0.0)",
                      "pattern": "^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:-[\\\\w.-]+)?(?:\\\\+[\\\\w.-]+)?$"
                    },
                    "summary": {
                      "type": "string",
                      "title": "Summary",
                      "default": "",
                      "description": "A brief summary of the event"
                    }
                  }
                }
              }
            }
          }
        },
        "measured": {
          "width": 262,
          "height": 98
        },
        "selected": false,
        "dragging": false
      },
      {
        "id": "event-user-updated",
        "type": "event",
        "position": {
          "x": 1200,
          "y": 280
        },
        "data": {
          "mode": "full",
          "message": {
            "id": "user-updated-cdc",
            "name": "UserUpdated",
            "version": "1.0.0",
            "summary": "CDC event published when a user record is updated in the database"
          },
          "editor": {
            "title": "Event",
            "subtitle": "Edit the details of the event",
            "schema": {
              "type": "object",
              "required": [
                "message",
                "mode"
              ],
              "properties": {
                "message": {
                  "type": "object",
                  "required": [
                    "name",
                    "version"
                  ],
                  "properties": {
                    "name": {
                      "type": "string",
                      "title": "Name",
                      "default": "Random value",
                      "description": "The name of the event"
                    },
                    "version": {
                      "type": "string",
                      "title": "Version",
                      "default": "1.0.0",
                      "description": "The version number (e.g., 1.0.0)",
                      "pattern": "^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:-[\\\\w.-]+)?(?:\\\\+[\\\\w.-]+)?$"
                    },
                    "summary": {
                      "type": "string",
                      "title": "Summary",
                      "default": "",
                      "description": "A brief summary of the event"
                    }
                  }
                }
              }
            }
          }
        },
        "measured": {
          "width": 262,
          "height": 98
        },
        "selected": false,
        "dragging": false
      },
      {
        "id": "service-analytics",
        "type": "service",
        "position": {
          "x": 1650,
          "y": 60
        },
        "data": {
          "mode": "full",
          "service": {
            "id": "analytics-service",
            "name": "Analytics Service",
            "owners": ["analytics-team"],
            "sends": [],
            "receives": [
              "UserCreated",
              "UserUpdated",
              "UserDeleted"
            ],
            "version": "1.0.0",
            "summary": "Real-time analytics service that processes CDC events for user behavior insights"
          },
          "editor": {
            "title": "Service",
            "subtitle": "Edit the details of the service",
            "schema": {
              "type": "object",
              "required": [
                "service",
                "mode"
              ],
              "properties": {
                "service": {
                  "type": "object",
                  "required": [
                    "name",
                    "version"
                  ],
                  "properties": {
                    "name": {
                      "type": "string",
                      "title": "Name",
                      "default": "Random value",
                      "description": "The name of the service"
                    },
                    "version": {
                      "type": "string",
                      "title": "Version",
                      "default": "1.0.0",
                      "description": "The version number (e.g., 1.0.0)",
                      "pattern": "^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:-[\\\\w.-]+)?(?:\\\\+[\\\\w.-]+)?$"
                    },
                    "summary": {
                      "type": "string",
                      "title": "Summary",
                      "default": "",
                      "description": "A brief summary of the service"
                    }
                  }
                }
              }
            }
          }
        },
        "measured": {
          "width": 262,
          "height": 98
        },
        "selected": false,
        "dragging": false
      },
      {
        "id": "data-warehouse",
        "type": "data",
        "position": {
          "x": 1650,
          "y": 320
        },
        "data": {
          "mode": "full",
          "data": {
            "id": "data-warehouse",
            "name": "Data Warehouse",
            "owners": ["analytics-team"],
            "schemas": [],
            "version": "1.0.0",
            "summary": "Snowflake data warehouse for storing processed CDC events and analytics",
            "type": "Data Warehouse"
          },
          "editor": {
            "title": "Data Store",
            "subtitle": "Edit the details of the data store",
            "schema": {
              "type": "object",
              "required": [
                "data",
                "mode"
              ],
              "properties": {
                "data": {
                  "type": "object",
                  "required": [
                    "name",
                    "version"
                  ],
                  "properties": {
                    "name": {
                      "type": "string",
                      "title": "Name",
                      "default": "UserDatabase",
                      "description": "The name of the data store"
                    },
                    "version": {
                      "type": "string",
                      "title": "Version",
                      "default": "1.0.0",
                      "description": "The version number (e.g., 1.0.0)",
                      "pattern": "^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:-[\\\\w.-]+)?(?:\\\\+[\\\\w.-]+)?$"
                    },
                    "summary": {
                      "type": "string",
                      "title": "Summary",
                      "default": "",
                      "description": "A brief summary of the data store"
                    },
                    "type": {
                      "type": "string",
                      "title": "Type",
                      "default": "Database",
                      "description": "The type of data store",
                      "enum": [
                        "Database",
                        "Cache",
                        "Queue",
                        "File System",
                        "Data Lake",
                        "Data Warehouse"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "measured": {
          "width": 262,
          "height": 98
        },
        "selected": false,
        "dragging": false
      },
      {
        "id": "note-cdc-instructions",
        "type": "note",
        "position": {
          "x": 50,
          "y": 400
        },
        "data": {
          "text": "📊 **Change Data Capture (CDC) Pattern**\n\nThis template demonstrates a typical CDC architecture:\n\n**🗄️ Source Database** → **⚙️ Debezium Connector** → **📨 Kafka Topic** → **📢 CDC Events** → **📈 Analytics Service** & **🏢 Data Warehouse**\n\n**Key Benefits:**\n• **Real-time data sync** - Changes flow immediately to downstream systems\n• **Decoupled architecture** - Database changes don't impact consuming services\n• **Audit trail** - Complete history of all data changes\n• **Event-driven** - Enables reactive architectures\n\n**How it works:**\n1. Application writes to source database\n2. Debezium captures transaction log changes\n3. CDC events published to Kafka topic\n4. Downstream services consume events in real-time\n\n**💡 Pro tip:** CDC is perfect for keeping analytics, search indexes, and caches in sync with your primary database!",
          "color": "green"
        },
        "measured": {
          "width": 320,
          "height": 280
        },
        "selected": false,
        "dragging": false,
        "width": 320,
        "height": 280,
        "resizing": false
      }
    ],
    "edges": [
      {
        "source": "data-source-db",
        "target": "service-debezium",
        "label": "Reads Transaction Log",
        "markerEnd": {
          "type": "arrowclosed",
          "color": "#000000"
        },
        "animated": false,
        "type": "default",
        "data": {
          "source": "data",
          "target": "service",
          "message": {
            "collection": "data",
            "opacity": 1
          }
        },
        "id": "xy-edge__data-source-db-service-debezium"
      },
      {
        "source": "service-debezium",
        "target": "channel-kafka-cdc",
        "label": "Publishes CDC Events",
        "markerEnd": {
          "type": "arrowclosed",
          "color": "#000000"
        },
        "animated": true,
        "type": "animatedMessage",
        "data": {
          "source": "service",
          "target": "channel",
          "message": {
            "collection": "events",
            "opacity": 1
          }
        },
        "id": "xy-edge__service-debezium-channel-kafka-cdc"
      },
      {
        "source": "channel-kafka-cdc",
        "target": "event-user-created",
        "label": "Contains",
        "markerEnd": {
          "type": "arrowclosed",
          "color": "#000000"
        },
        "animated": true,
        "type": "animatedMessage",
        "data": {
          "source": "channel",
          "target": "event",
          "message": {
            "collection": "events",
            "opacity": 1
          }
        },
        "id": "xy-edge__channel-kafka-cdc-event-user-created"
      },
      {
        "source": "channel-kafka-cdc",
        "target": "event-user-updated",
        "label": "Contains",
        "markerEnd": {
          "type": "arrowclosed",
          "color": "#000000"
        },
        "animated": true,
        "type": "animatedMessage",
        "data": {
          "source": "channel",
          "target": "event",
          "message": {
            "collection": "events",
            "opacity": 1
          }
        },
        "id": "xy-edge__channel-kafka-cdc-event-user-updated"
      },
      {
        "source": "event-user-created",
        "target": "service-analytics",
        "label": "Consumed by",
        "markerEnd": {
          "type": "arrowclosed",
          "color": "#000000"
        },
        "animated": true,
        "type": "animatedMessage",
        "data": {
          "source": "event",
          "target": "service",
          "message": {
            "collection": "events",
            "opacity": 1
          }
        },
        "id": "xy-edge__event-user-created-service-analytics"
      },
      {
        "source": "event-user-updated",
        "target": "service-analytics",
        "label": "Consumed by",
        "markerEnd": {
          "type": "arrowclosed",
          "color": "#000000"
        },
        "animated": true,
        "type": "animatedMessage",
        "data": {
          "source": "event",
          "target": "service",
          "message": {
            "collection": "events",
            "opacity": 1
          }
        },
        "id": "xy-edge__event-user-updated-service-analytics"
      },
      {
        "source": "service-analytics",
        "target": "data-warehouse",
        "label": "Stores Processed Data",
        "markerEnd": {
          "type": "arrowclosed",
          "color": "#000000"
        },
        "animated": false,
        "type": "default",
        "data": {
          "source": "service",
          "target": "data",
          "message": {
            "collection": "data",
            "opacity": 1
          }
        },
        "id": "xy-edge__service-analytics-data-warehouse"
      }
    ],
    "viewport": {
      "x": 50,
      "y": 50,
      "zoom": 0.7
    },
    "creationDate": "2025-01-01T00:00:00.000Z",
    "name": "Change Data Capture Pattern",
    "version": "1.0.0",
    "source": "https://eventcatalog.dev",
    "appState": {},
    "id": "change-data-capture-pattern"
  },
  "usecase": "Design CDC Architecture",
  "mermaid": "flowchart LR\n    DB[(Database)] --> CDC[CDC Connector]\n    CDC --> K[Kafka]\n    K --> S[Service]",
  "tags": ["Data Management", "Real-time"]
}