Understanding Debezium

1.1k views Asked by At

Provided a use case:

A stream processing architecture; Events go into Kafka then get processed by a job with a MongoDB sink.

Database name: myWebsite Collection: users

and the job sinks user records in the users collection.

  1. So Debezium will monitor the users collection for changes and, at every change, will produce events into Kafka on the topic dbserver1.myWebsite.users ? Assuming dbserver1 is the name of the connector.
  2. If so, then I can have a Kafka consumer that will consume from dbserver1.myWebsite.users topic and react to these events?
  3. From what I understood the events produced by Debezium also contain the value of the database record? If its a change contains old/new value? If a db record is created the old is null?

I would like a some sort of confirmation of my understandings so far. Thank you!

1

There are 1 answers

1
Jiri Pechanec On BEST ANSWER

the answer are simple

  1. Yes
  2. Yes, it can be arbitrary kafka consumer or Kafka stream or you can query it with KSQL
  3. Yes, Debezium records are composed from (not only) old values (before) and new (after) values. In case of INSERT only after is present in case of UPDATE both before and after are present (Postgres need a special setting for it) and in case of DELETE only before is present.