Debezium supports outbox[1] pattern out of the box. All your application needs to do is to write to the outbox table and debezium will do the rest mentioned in the post and publish your events to kafka.
1: https://debezium.io/documentation/reference/stable/transform...