Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

メッセージフィルタリングを導入する #3

Merged
merged 2 commits into from Dec 11, 2023

Conversation

kohei-kohei
Copy link
Owner

@kohei-kohei kohei-kohei commented Dec 11, 2023

概要

メッセージフィルタリングを実装する

参考

https://debezium.io/documentation/reference/2.4/transformations/filtering.html

動作確認

データの登録・更新・削除を行う

docker exec mysql mysql -u root -ppassword playground -e "INSERT INTO items (name) VALUE ('Tシャツ');"
docker exec mysql mysql -u root -ppassword playground -e "UPDATE items SET name = 'ロングスリーブTシャツ' WHERE id = 1;"
docker exec mysql mysql -u root -ppassword playground -e "DELETE FROM items WHERE id = 1;"

トピックの中を確認すると登録と更新のメッセージのみが入っていることが分かる

docker exec kafka-broker kafka-console-consumer --bootstrap-server kafka-broker:9092 \
       --topic debezium_playground_topic.playground.items --from-beginning

{"before":null,"after":{"id":1,"name":"Tシャツ","registered_at":1702272672505,"updated_at":1702272672505},"source":{"version":"2.4.1.Final","connector":"mysql","name":"debezium_playground_topic","ts_ms":1702272672000,"snapshot":"false","db":"playground","sequence":null,"table":"items","server_id":1,"gtid":null,"file":"mysql-bin.000003","pos":398,"row":0,"thread":12,"query":null},"op":"c","ts_ms":1702272672528,"transaction":null}
{"before":{"id":1,"name":"Tシャツ","registered_at":1702272672505,"updated_at":1702272672505},"after":{"id":1,"name":"ロングスリーブTシャツ","registered_at":1702272672505,"updated_at":1702272690558},"source":{"version":"2.4.1.Final","connector":"mysql","name":"debezium_playground_topic","ts_ms":1702272690000,"snapshot":"false","db":"playground","sequence":null,"table":"items","server_id":1,"gtid":null,"file":"mysql-bin.000003","pos":748,"row":0,"thread":14,"query":null},"op":"u","ts_ms":1702272690571,"transaction":null}

@kohei-kohei kohei-kohei changed the title メッセージフィルタリング メッセージフィルタリングを導入する Dec 11, 2023
@kohei-kohei kohei-kohei merged commit 4293293 into main Dec 11, 2023
@kohei-kohei kohei-kohei deleted the add/message-filtering branch December 11, 2023 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant