In this tutorial, we will go over how to set up Debezium Topic Routing SMTs and how this works with Transfer.
Available
After artielabs/transfer:2.0.3+
Why is this useful?
By default, Debezium will map 1 topic to 1 table. There are 2 common scenarios where you'd want this to be different.
A partitioned database. You might want all the messages to show up on the same topic as opposed to one topic per partition.
You don't want to manually create topics. If you are using the pub/sub setting, Debezium does not automatically create topics. This means you will need to manually do so. This can be onerous as you will need to manually create a new topic per table.
Debezium application.properties
# Offset storagedebezium.source.offset.storage.file.filename=/tmp/foodebezium.source.offset.flush.interval.ms=0# Pubsub setup: https://debezium.io/documentation/reference/stable/operations/debezium-server.html#_google_cloud_pubsubdebezium.sink.type=pubsubdebezium.sink.pubsub.project.id=artie-labsdebezium.sink.pubsub.ordering.enabled=true# Postgresdebezium.source.snapshot.mode=initialdebezium.source.connector.class=io.debezium.connector.postgresql.PostgresConnectordebezium.source.database.hostname=postgresdebezium.source.database.port=5432debezium.source.database.user=postgresdebezium.source.database.password=postgresdebezium.source.database.dbname=postgresdebezium.source.topic.prefix=dbserver1# Syncing customers, orders and products table.debezium.source.table.include.list=inventory.customers,inventory.orders,inventory.products,inventory.usersdebezium.source.plugin.name=pgoutput# Re-route them all to the same topic.debezium.transforms=Reroutedebezium.transforms.Reroute.type=io.debezium.transforms.ByLogicalTableRouter# Matches all the tables under the inventory schemadebezium.transforms.Reroute.topic.regex=(.*).inventory(.*)# Becomes, topicPrefix.schema.all_tables => dbserver1.inventory.all_tablesdebezium.transforms.Reroute.topic.replacement=$1.inventory.all_tables