Debezium does not specify the partition number for events. That means that Kafka Connect’s producer will then use the default partitioning logic that computes the partition using a consistent hash of the message key, which in Debezium’s case is a struct containing the affected row’s primary/unique key. You can also customize this behavior via the Kafka Connect worker configuration properties that control the producer behavior.
Just be sure that if you’re using more than one partition for a table topic that you understand this will affect the ordering guarantees for the events in that topic, since Kafka only guarantees total order within each topic partition. So, with one partition, all changes events will have the same total order as occurred in the database. With multiple partitions, the order of events in separate partitions will not be guaranteed.
Having said that, some use cases may want to “shard” their events into multiple partitions per topic. This works especially well when downstream consumers care only about the order of change events for each row, but don’t really care how the events for different rows are ordered.
Best regards,
Randall