Home > Software design >  In Debezium is there a way to route tables to different topics?
In Debezium is there a way to route tables to different topics?

Time:01-20

My tables:

  1. users
  2. clients
  3. notifications
  4. alerts

By default I want information to go to topic user_service.$tableName but for specific tables, I want the information in different tables.

Expected Output

  1. users => user_service.users
  2. clients => user_service.clients
  3. notifications => notification_service.notifications
  4. alerts => alert_service.alerts

I have the configuration that is working for one table like notifications but not sure how I can adjust if for multiple tables

Existing Config:

"transforms": "unwrap,Reroute",
"transforms.Reroute.type": "io.debezium.transforms.ByLogicalTableRouter",
"transforms.Reroute.topic.regex": "(.*)notifications",
"transforms.Reroute.topic.replacement": "notificaton_service.notifications",

CodePudding user response:

Got it working with

"transforms": "unwrap,Reroute",
"transforms.Reroute.type": "io.debezium.transforms.ByLogicalTableRouter",
"transforms.Reroute.topic.regex": "(.*)(notifications|alerts)",
"transforms.Reroute.topic.replacement": "$2_service.$2",
  • Related