KPD closed beta Sign inRequest access

CDC sources and their topics

How a CDC source connector names and creates its topics, and how to design one in KPD step by step.

How a CDC source behaves

A change data capture (CDC) source connector reads a database's change log and writes every insert, update and delete to Kafka. Three things about it catch people out:

So in KPD you list the tables, set the prefix, and draw one topic per table with exactly the name the connector will use. KPD works out those names for you and checks them.

The short version

Fill in the table list and topic.prefix, then click Add topics in the Problems tab. KPD draws one correctly named topic per table, and the Terraform creates them before the connector starts.

Step by step: a MySQL CDC source

This example captures two tables, orders and customers, from a MySQL database called shop. The other CDC connectors work the same way; only the form of the table names and topic names differs (see Topic names by connector).

  1. Add the connector. Search the Palettes panel for mysql and drag MySQL CDC onto the canvas. Give it a name on its General tab, here shop-cdc. Optionally draw the database as an External system and wire it into the connector's input.

    Two warnings appear straight away: the connector has a No tables badge because nothing is listed to capture, and it asks for a topic prefix.

    A new MySQL CDC connector with a No tables badge, and two warnings in the Problems tab.
    A new CDC source: no tables listed and no topic prefix yet.
  2. List the tables. Select the connector and open its Capture tab. In table.include.list, list the tables, comma-separated. For MySQL each one is database.table:

    shop.orders, shop.customers

    The placeholder in the field shows the form your connector expects. The No tables badge goes once the list is filled in.

    The Capture tab of the MySQL CDC connector, with the table list warning under the empty field.
    The table list on the Capture tab. Until it is filled in, the warning sits under the field.
  3. Set the topic prefix. On the Data format tab, set topic.prefix, here retail. KPD can now work out every topic name, and tells you which ones are missing from the design:

    The Problems tab listing retail.shop.orders and retail.shop.customers as captured tables with no topic, with an Add topics button.
    KPD names the topics the connector will write: retail.shop.orders and retail.shop.customers.
  4. Click Add topics. KPD draws one topic per table, named exactly as the connector names it, and wires each one from the connector. Press Ctrl/⌘+S to save.

    The connector now wired to two new topics, retail.shop.orders and retail.shop.customers.
    Two topics added and wired. Give each one a schema and settings as usual.

    Now set each topic up like any other: partitions, retention, a schema on its Schema tab, tags and so on. These are the settings the topic will be created with.

Keeping the names right

KPD keeps checking the names as the design changes.

A topic renamed by hand to orders, with a warning that shop-cdc won't write to it and a Rename button.
A topic called orders would never receive anything: the connector writes retail.shop.orders.

Who creates the topics

Every topic has a Managed by setting on its General tab.

Managed byWhat happensUse it when
KPD (the default)Terraform creates the topic, and creates it before the connector, so the connector finds it ready, with your partitions, retention and schema.Almost always. The design says exactly what each topic is.
ConnectorTerraform doesn't create the topic; the connector does, the first time it runs. KPD passes the topic's partitions, cleanup policy and retention to the connector. The topic is drawn dashed with a connector badge.Your team prefers connectors to own their topics.
ExistingThe topic already exists and someone else owns it. Terraform looks it up and never changes it.The topic was created by another team or an older pipeline.
A topic set to Managed by Connector, drawn with a dashed outline and a connector badge.
Managed by: Connector. The connector creates this topic, using the settings in the design.
Things to know about Managed by: Connector

What the Terraform does

Topic names by connector

ConnectorTable list (Capture tab)Topic for each table
PostgreSQL CDC V2schema.table<topic.prefix>.<schema>.<table>
MySQL CDC V2, MariaDB CDCdatabase.table<topic.prefix>.<database>.<table>
SQL Server CDC V2schema.table, or database.schema.table when database.names lists several databases<topic.prefix>.<database>.<schema>.<table>
MongoDB CDCdatabase.collection (collection.include.list)<topic.prefix>.<database>.<collection>
DynamoDB CDCtable namesthe table name
Oracle CDC, Oracle XStreama regular expression / schema.tableNot worked out by KPD: Oracle builds names from a template that includes the database SID or PDB. Check them against the connector's documentation.
Spanner CDCthe change stream (it decides the tables)Not worked out by KPD: Spanner names topics after the connector's id, which only exists once it is created. Consider Managed by: Connector.

CDC names and your naming standard

Names like retail.shop.orders often don't match a house naming standard such as the DPCF rule (<org>.<env>.raw.<entity>…), so you will also see a naming warning on each topic. Two ways to handle it:

Questions

Can I capture a whole database without listing its tables? The connector can, but KPD asks for the list on purpose: without it, nobody can say which topics will appear, or with what settings. List the tables you need.

The topic names are too long to read on the canvas. Hover over a topic, or select it, to see its full name. The names are long because they are the real names in Kafka.

Does KPD connect to my database to find the tables? No. KPD never connects to anything; the table list is what you type.