SlideShare a Scribd company logo
1 of 54
Download to read offline
How to build an event driven architecture
with Kafka & Kafka Connect
Nov 12, 2020
Lợi Nguyễn - Technical Architect @ VeXeRe
1
Vietnam’s largest online bus booking systemvexere.com
Name: Nguyễn Văn Lợi
Company:
● Vexere - #1 Saas based bus ticket platform in Vietnam
● Chotot - #1 Classified Marketplace in Vietnam
● Blue Orchid - A start-up founded by ex-Grab CTO
● Softfoundry - VoIP product
2
Vietnam’s largest online bus booking systemvexere.com
VeXeRe.com is a Vietnamese online bus ticket booking system that operates through
many transportation companies.
3
Vietnam’s largest online bus booking systemvexere.com 4
Vietnam’s largest online bus booking systemvexere.com 5
Vietnam’s largest online bus booking systemvexere.com
● Why event driven architecture?
● What is “Event Driven” architecture?
○ Event-carried State Transfer
○ Event Sourcing
● Event Sourcing in real world
○ What is 2 phase write?
○ MSSQL / transaction log
○ Postgresql / WAL
● What is Kafka & Kafka Connect?
○ Connector/Task/Worker
■ MSSQL Source Connector
○ Transform
○ Kafka and Kafka Connect @ vexere
○ Pros/Cons of Kafka Connect vs Custom Producer
● Use Case/Demo
○ Customer Journey Map Notification
○ Social Proof
○ Event Sourcing + CQRS
○ Data Warehouse
● Experience / Tools / Troubleshoot
○ Tools: (kafka manager, kafka tool)
○ Troubleshoot connector
○ Monitoring
○ Domain Event vs Event Sourcing Event
● Q & A & Discussion
6
Vietnam’s largest online bus booking systemvexere.com 7
Vietnam’s largest online bus booking systemvexere.com 8
Phase Challenges
Launch ● Business Idea Profitability
● Limit resource:
○ Time
○ Technology
○ Money
Growth/Expansion ● Increasing Customers
● Increasing Feature
● Adding New Products/BU
Vietnam’s largest online bus booking systemvexere.com
● Event-carried State Transfer
● Event Sourcing
9
Vietnam’s largest online bus booking systemvexere.com
10
Vietnam’s largest online bus booking systemvexere.com
11
Vietnam’s largest online bus booking systemvexere.com
12
Vietnam’s largest online bus booking systemvexere.com
● Two representation of the world:
○ Application State: the current representation of the world, and
○ log of all the events: that changed that world
● The test definition of Event Sourcing:
○ at any time we can blow away the application state and confidently rebuild it from
the log.
● Benefit:
○ Audits
○ Debugging
13
Vietnam’s largest online bus booking systemvexere.com
● What is “Event Driven” architecture?
○ Event-carried State Transfer
○ Event Sourcing
14
Vietnam’s largest online bus booking systemvexere.com
● Event Sourcing in real world
○ What is 2 phase write?
○ MSSQL / transaction log
○ Postgresql / WAL
15
Vietnam’s largest online bus booking systemvexere.com
16
Insert without WAL
Vietnam’s largest online bus booking systemvexere.com
17
Insertion operations with WAL
Vietnam’s largest online bus booking systemvexere.com
18
Vietnam’s largest online bus booking systemvexere.com
19
Vietnam’s largest online bus booking systemvexere.com
● Event Sourcing in real world
○ What is 2 phase write?
○ MSSQL / transaction log
○ Postgresql / WAL
20
Vietnam’s largest online bus booking systemvexere.com
● What is Kafka & Kafka Connect?
○ Connector/Task/Worker
○ Transform
○ How we use Kafka and Kafka Connect @ vexere
○ Pros/Cons of Kafka Connect vs Custom Producer
21
Vietnam’s largest online bus booking systemvexere.com
● topic
● producer
● consumer
● broker
● partition
● consumer group
22
Vietnam’s largest online bus booking systemvexere.com
23
Vietnam’s largest online bus booking systemvexere.com
24
Vietnam’s largest online bus booking systemvexere.com
25
Vietnam’s largest online bus booking systemvexere.com 26
Vietnam’s largest online bus booking systemvexere.com 27
Vietnam’s largest online bus booking systemvexere.com 28
Vietnam’s largest online bus booking systemvexere.com
Kafka Connect is a framework to stream data into and out of Apache Kafka
● Connectors – the high level abstraction that coordinates data streaming by managing tasks
● Tasks – the implementation of how data is copied to or from Kafka
● Workers – the running processes that execute connectors and tasks
● Converters – the code used to translate data between Connect and the system sending or receiving data
● Transforms – simple logic to alter each message produced by or sent to a connector
● Dead Letter Queue – how Connect handles connector errors
29
Vietnam’s largest online bus booking systemvexere.com
No coding required, just json config:
30
Vietnam’s largest online bus booking systemvexere.com 31
Vietnam’s largest online bus booking systemvexere.com 32
Vietnam’s largest online bus booking systemvexere.com 33
Vietnam’s largest online bus booking systemvexere.com 34
Vietnam’s largest online bus booking systemvexere.com 35
Vietnam’s largest online bus booking systemvexere.com 36
Vietnam’s largest online bus booking systemvexere.com
Pros Cons
● Many Connectors (source/sink)
● No coding required
● Simple transform only
● Hard to customize or write your own
connector
37
Vietnam’s largest online bus booking systemvexere.com
● What is Kafka & Kafka Connect?
○ Connector/Task/Worker
■ MSSQL Source Connector
○ Transform
○ How we use Kafka and Kafka Connect @ vexere
○ Pros/Cons of Kafka Connect vs Custom Producer
38
Vietnam’s largest online bus booking systemvexere.com
● Monitor kafka connect job
● AlwaysOn Cluster Config
● Database schema evolution
39
Vietnam’s largest online bus booking systemvexere.com 40
Vietnam’s largest online bus booking systemvexere.com
In Kafka Connect, task is being killed and will not recover until manually
restarted
Solution:
● Cronjob to monitor task status, then restart task by calling restful to
task api
● Dead Letter Queue to handle error in:
○ Convert
○ Transform
41
Vietnam’s largest online bus booking systemvexere.com 42
Reference: https://debezium.io/documentation/reference/connectors/sqlserver.html#sqlserver-schema-evolution
Vietnam’s largest online bus booking systemvexere.com 43
Vietnam’s largest online bus booking systemvexere.com 44
● NVARCHAR(max) is not supported in CDC table (cannot record before value,
only have after update value)
Vietnam’s largest online bus booking systemvexere.com
● Experience / Tools / Troubleshoot
○ Tools: (kafka manager, kafka tool)
○ Troubleshoot connector
○ Monitoring
45
Vietnam’s largest online bus booking systemvexere.com 46
Reward
Thay đổi thông tin tài xế, biển số xe
Đánh giá sau chuyến điThanh toán
Vietnam’s largest online bus booking systemvexere.com
Calculated from Ticket & Booking event
47
Vietnam’s largest online bus booking systemvexere.com
Separate read & write model
Write model: MSSQL
Read model: Elasticsearch
MSSQL ⇒ Kafka ⇒ Kafka consumer ⇒ Elasticsearch
48
Vietnam’s largest online bus booking systemvexere.com
Example: Real Time sync data from MSSQL ⇒ Stagging Postgres ⇒ Bigquery
Note:
● be careful when backfill data
● If we new column, we have to trigger dummy update to trigger all record event
=> a lot of trash in transaction log ==> need to write your own job
49
Vietnam’s largest online bus booking systemvexere.com
50
Vietnam’s largest online bus booking systemvexere.com 51
Reference: https://www.enterpriseintegrationpatterns.com/patterns/messaging/index.html
Vietnam’s largest online bus booking systemvexere.com
● https://martinfowler.com/articles/201701-event-driven.html
● https://www.confluent.io/blog/announcing-kafka-connect-building-large-scale-low-latenc
y-data-pipelines/
● https://docs.microsoft.com/en-us/sql/relational-databases/track-changes/about-change-
data-capture-sql-server?view=sql-server-2017
● https://docs.confluent.io/current/connect/concepts.html
● https://www.slideshare.net/ConfluentInc/from-zero-to-hero-with-kafka-connect
● https://www.innoq.com/en/blog/domain-events-versus-event-sourcing/#eventsfromeven
tsourcing%E2%89%A0domainevents
52
Vietnam’s largest online bus booking systemvexere.com 53
Vietnam’s largest online bus booking systemvexere.com 54

More Related Content

What's hot

Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banksGrokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
Grokking VN
 

What's hot (20)

Tiki.vn - How we scale as a tech startup
Tiki.vn - How we scale as a tech startupTiki.vn - How we scale as a tech startup
Tiki.vn - How we scale as a tech startup
 
Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banksGrokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
Grokking Techtalk #46: Lessons from years hacking and defending Vietnamese banks
 
Grokking Techtalk #37: Data intensive problem
 Grokking Techtalk #37: Data intensive problem Grokking Techtalk #37: Data intensive problem
Grokking Techtalk #37: Data intensive problem
 
Building Bizweb Microservices with Docker
Building Bizweb Microservices with DockerBuilding Bizweb Microservices with Docker
Building Bizweb Microservices with Docker
 
Grokking Techtalk #37: Software design and refactoring
 Grokking Techtalk #37: Software design and refactoring Grokking Techtalk #37: Software design and refactoring
Grokking Techtalk #37: Software design and refactoring
 
SOLID & Design Patterns
SOLID & Design PatternsSOLID & Design Patterns
SOLID & Design Patterns
 
Introduction to Docker - 2017
Introduction to Docker - 2017Introduction to Docker - 2017
Introduction to Docker - 2017
 
Toi uu hoa he thong 30 trieu nguoi dung
Toi uu hoa he thong 30 trieu nguoi dungToi uu hoa he thong 30 trieu nguoi dung
Toi uu hoa he thong 30 trieu nguoi dung
 
Microservices Architecture - Cloud Native Apps
Microservices Architecture - Cloud Native AppsMicroservices Architecture - Cloud Native Apps
Microservices Architecture - Cloud Native Apps
 
Autoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive ModeAutoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive Mode
 
Dual write strategies for microservices
Dual write strategies for microservicesDual write strategies for microservices
Dual write strategies for microservices
 
Kafka as an Event Store - is it Good Enough?
Kafka as an Event Store - is it Good Enough?Kafka as an Event Store - is it Good Enough?
Kafka as an Event Store - is it Good Enough?
 
RedisConf17- Using Redis at scale @ Twitter
RedisConf17- Using Redis at scale @ TwitterRedisConf17- Using Redis at scale @ Twitter
RedisConf17- Using Redis at scale @ Twitter
 
5 Factors When Selecting a High Performance, Low Latency Database
5 Factors When Selecting a High Performance, Low Latency Database5 Factors When Selecting a High Performance, Low Latency Database
5 Factors When Selecting a High Performance, Low Latency Database
 
Kubernetes in Docker
Kubernetes in DockerKubernetes in Docker
Kubernetes in Docker
 
OpenTelemetry For Developers
OpenTelemetry For DevelopersOpenTelemetry For Developers
OpenTelemetry For Developers
 
Understand your system like never before with OpenTelemetry, Grafana, and Pro...
Understand your system like never before with OpenTelemetry, Grafana, and Pro...Understand your system like never before with OpenTelemetry, Grafana, and Pro...
Understand your system like never before with OpenTelemetry, Grafana, and Pro...
 
eBPF - Observability In Deep
eBPF - Observability In DeepeBPF - Observability In Deep
eBPF - Observability In Deep
 
Microservices Part 3 Service Mesh and Kafka
Microservices Part 3 Service Mesh and KafkaMicroservices Part 3 Service Mesh and Kafka
Microservices Part 3 Service Mesh and Kafka
 
Automate Your Kafka Cluster with Kubernetes Custom Resources
Automate Your Kafka Cluster with Kubernetes Custom Resources Automate Your Kafka Cluster with Kubernetes Custom Resources
Automate Your Kafka Cluster with Kubernetes Custom Resources
 

Similar to Grokking Techtalk #39: How to build an event driven architecture with Kafka & Kafka Connect

Andersen-Portfolio-Latest Projects
Andersen-Portfolio-Latest ProjectsAndersen-Portfolio-Latest Projects
Andersen-Portfolio-Latest Projects
Roman Minin
 
Grokking Techtalk #43: Payment gateway demystified
Grokking Techtalk #43: Payment gateway demystifiedGrokking Techtalk #43: Payment gateway demystified
Grokking Techtalk #43: Payment gateway demystified
Grokking VN
 

Similar to Grokking Techtalk #39: How to build an event driven architecture with Kafka & Kafka Connect (20)

How to build an event driven architecture with kafka and kafka connect
How to build an event driven architecture with kafka and kafka connectHow to build an event driven architecture with kafka and kafka connect
How to build an event driven architecture with kafka and kafka connect
 
Andersen-Portfolio-Latest Projects ENG
Andersen-Portfolio-Latest Projects ENGAndersen-Portfolio-Latest Projects ENG
Andersen-Portfolio-Latest Projects ENG
 
Andersen Potfolio
Andersen PotfolioAndersen Potfolio
Andersen Potfolio
 
Andersen-Portfolio-Latest Projects
Andersen-Portfolio-Latest ProjectsAndersen-Portfolio-Latest Projects
Andersen-Portfolio-Latest Projects
 
"Payment System: Survival Guide", Oleksandr Tarasenko
"Payment System: Survival Guide",  Oleksandr Tarasenko"Payment System: Survival Guide",  Oleksandr Tarasenko
"Payment System: Survival Guide", Oleksandr Tarasenko
 
VictoriaMetrics: Welcome to the Virtual Meet Up March 2023
VictoriaMetrics: Welcome to the Virtual Meet Up March 2023VictoriaMetrics: Welcome to the Virtual Meet Up March 2023
VictoriaMetrics: Welcome to the Virtual Meet Up March 2023
 
Flink Forward San Francisco 2018: - Jinkui Shi and Radu Tudoran "Flink real-t...
Flink Forward San Francisco 2018: - Jinkui Shi and Radu Tudoran "Flink real-t...Flink Forward San Francisco 2018: - Jinkui Shi and Radu Tudoran "Flink real-t...
Flink Forward San Francisco 2018: - Jinkui Shi and Radu Tudoran "Flink real-t...
 
Improve search optimization engine with ssr in nextjs
Improve search optimization engine with ssr in nextjsImprove search optimization engine with ssr in nextjs
Improve search optimization engine with ssr in nextjs
 
Grokking Techtalk #43: Payment gateway demystified
Grokking Techtalk #43: Payment gateway demystifiedGrokking Techtalk #43: Payment gateway demystified
Grokking Techtalk #43: Payment gateway demystified
 
Day in the life event-driven workshop
Day in the life  event-driven workshopDay in the life  event-driven workshop
Day in the life event-driven workshop
 
Network Solution
Network SolutionNetwork Solution
Network Solution
 
Open Source Networking Days- Service Mesh
Open Source Networking Days- Service MeshOpen Source Networking Days- Service Mesh
Open Source Networking Days- Service Mesh
 
9th docker meetup 2016.07.13
9th docker meetup 2016.07.139th docker meetup 2016.07.13
9th docker meetup 2016.07.13
 
Devoxx 2018 - Pivotal and AxonIQ - Quickstart your event driven architecture
Devoxx 2018 -  Pivotal and AxonIQ - Quickstart your event driven architectureDevoxx 2018 -  Pivotal and AxonIQ - Quickstart your event driven architecture
Devoxx 2018 - Pivotal and AxonIQ - Quickstart your event driven architecture
 
Rami Yasser C.V
Rami Yasser C.VRami Yasser C.V
Rami Yasser C.V
 
Julio andradecv
Julio andradecvJulio andradecv
Julio andradecv
 
Real-time Fraudulent Trips Detection with Xueyao Jiang
Real-time Fraudulent Trips Detection with Xueyao JiangReal-time Fraudulent Trips Detection with Xueyao Jiang
Real-time Fraudulent Trips Detection with Xueyao Jiang
 
RouterOS Migration From v6 to v7
RouterOS Migration From v6 to v7RouterOS Migration From v6 to v7
RouterOS Migration From v6 to v7
 
Xpdays: Kubernetes CI-CD Frameworks Case Study
Xpdays: Kubernetes CI-CD Frameworks Case StudyXpdays: Kubernetes CI-CD Frameworks Case Study
Xpdays: Kubernetes CI-CD Frameworks Case Study
 
Fast exchange
Fast exchangeFast exchange
Fast exchange
 

More from Grokking VN

Grokking Techtalk #45: First Principles Thinking
Grokking Techtalk #45: First Principles ThinkingGrokking Techtalk #45: First Principles Thinking
Grokking Techtalk #45: First Principles Thinking
Grokking VN
 
Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer...
 Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer... Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer...
Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer...
Grokking VN
 

More from Grokking VN (20)

Grokking Techtalk #45: First Principles Thinking
Grokking Techtalk #45: First Principles ThinkingGrokking Techtalk #45: First Principles Thinking
Grokking Techtalk #45: First Principles Thinking
 
Grokking Techtalk #42: Engineering challenges on building data platform for M...
Grokking Techtalk #42: Engineering challenges on building data platform for M...Grokking Techtalk #42: Engineering challenges on building data platform for M...
Grokking Techtalk #42: Engineering challenges on building data platform for M...
 
Grokking Techtalk #40: AWS’s philosophy on designing MLOps platform
Grokking Techtalk #40: AWS’s philosophy on designing MLOps platformGrokking Techtalk #40: AWS’s philosophy on designing MLOps platform
Grokking Techtalk #40: AWS’s philosophy on designing MLOps platform
 
Grokking Techtalk #38: Escape Analysis in Go compiler
 Grokking Techtalk #38: Escape Analysis in Go compiler Grokking Techtalk #38: Escape Analysis in Go compiler
Grokking Techtalk #38: Escape Analysis in Go compiler
 
Grokking TechTalk #35: Efficient spellchecking
Grokking TechTalk #35: Efficient spellcheckingGrokking TechTalk #35: Efficient spellchecking
Grokking TechTalk #35: Efficient spellchecking
 
Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer...
 Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer... Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer...
Grokking Techtalk #34: K8S On-premise: Incident & Lesson Learned ZaloPay Mer...
 
Grokking TechTalk #33: Architecture of AI-First Systems - Engineering for Big...
Grokking TechTalk #33: Architecture of AI-First Systems - Engineering for Big...Grokking TechTalk #33: Architecture of AI-First Systems - Engineering for Big...
Grokking TechTalk #33: Architecture of AI-First Systems - Engineering for Big...
 
Grokking TechTalk #31: Asynchronous Communications
Grokking TechTalk #31: Asynchronous CommunicationsGrokking TechTalk #31: Asynchronous Communications
Grokking TechTalk #31: Asynchronous Communications
 
Grokking TechTalk #30: From App to Ecosystem: Lessons Learned at Scale
Grokking TechTalk #30: From App to Ecosystem: Lessons Learned at ScaleGrokking TechTalk #30: From App to Ecosystem: Lessons Learned at Scale
Grokking TechTalk #30: From App to Ecosystem: Lessons Learned at Scale
 
Grokking TechTalk #29: Building Realtime Metrics Platform at LinkedIn
Grokking TechTalk #29: Building Realtime Metrics Platform at LinkedInGrokking TechTalk #29: Building Realtime Metrics Platform at LinkedIn
Grokking TechTalk #29: Building Realtime Metrics Platform at LinkedIn
 
Grokking TechTalk #27: Optimal Binary Search Tree
Grokking TechTalk #27: Optimal Binary Search TreeGrokking TechTalk #27: Optimal Binary Search Tree
Grokking TechTalk #27: Optimal Binary Search Tree
 
Grokking TechTalk #26: Kotlin, Understand the Magic
Grokking TechTalk #26: Kotlin, Understand the MagicGrokking TechTalk #26: Kotlin, Understand the Magic
Grokking TechTalk #26: Kotlin, Understand the Magic
 
Grokking TechTalk #26: Compare ios and android platform
Grokking TechTalk #26: Compare ios and android platformGrokking TechTalk #26: Compare ios and android platform
Grokking TechTalk #26: Compare ios and android platform
 
Grokking TechTalk #24: Thiết kế hệ thống Background Job Queue bằng Ruby & Pos...
Grokking TechTalk #24: Thiết kế hệ thống Background Job Queue bằng Ruby & Pos...Grokking TechTalk #24: Thiết kế hệ thống Background Job Queue bằng Ruby & Pos...
Grokking TechTalk #24: Thiết kế hệ thống Background Job Queue bằng Ruby & Pos...
 
Grokking TechTalk #24: Kafka's principles and protocols
Grokking TechTalk #24: Kafka's principles and protocolsGrokking TechTalk #24: Kafka's principles and protocols
Grokking TechTalk #24: Kafka's principles and protocols
 
Grokking TechTalk #21: Deep Learning in Computer Vision
Grokking TechTalk #21: Deep Learning in Computer VisionGrokking TechTalk #21: Deep Learning in Computer Vision
Grokking TechTalk #21: Deep Learning in Computer Vision
 
Grokking TechTalk #20: PostgreSQL Internals 101
Grokking TechTalk #20: PostgreSQL Internals 101Grokking TechTalk #20: PostgreSQL Internals 101
Grokking TechTalk #20: PostgreSQL Internals 101
 
Grokking TechTalk #19: Software Development Cycle In The International Moneta...
Grokking TechTalk #19: Software Development Cycle In The International Moneta...Grokking TechTalk #19: Software Development Cycle In The International Moneta...
Grokking TechTalk #19: Software Development Cycle In The International Moneta...
 
Grokking TechTalk #18B: Giới thiệu về Viễn thông Di động
Grokking TechTalk #18B:  Giới thiệu về Viễn thông Di độngGrokking TechTalk #18B:  Giới thiệu về Viễn thông Di động
Grokking TechTalk #18B: Giới thiệu về Viễn thông Di động
 
Grokking TechTalk #18B: VoIP Architecture For Telecommunications
Grokking TechTalk #18B: VoIP Architecture For TelecommunicationsGrokking TechTalk #18B: VoIP Architecture For Telecommunications
Grokking TechTalk #18B: VoIP Architecture For Telecommunications
 

Recently uploaded

Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
chumtiyababu
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
jaanualu31
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 

Recently uploaded (20)

Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 

Grokking Techtalk #39: How to build an event driven architecture with Kafka & Kafka Connect

  • 1. How to build an event driven architecture with Kafka & Kafka Connect Nov 12, 2020 Lợi Nguyễn - Technical Architect @ VeXeRe 1
  • 2. Vietnam’s largest online bus booking systemvexere.com Name: Nguyễn Văn Lợi Company: ● Vexere - #1 Saas based bus ticket platform in Vietnam ● Chotot - #1 Classified Marketplace in Vietnam ● Blue Orchid - A start-up founded by ex-Grab CTO ● Softfoundry - VoIP product 2
  • 3. Vietnam’s largest online bus booking systemvexere.com VeXeRe.com is a Vietnamese online bus ticket booking system that operates through many transportation companies. 3
  • 4. Vietnam’s largest online bus booking systemvexere.com 4
  • 5. Vietnam’s largest online bus booking systemvexere.com 5
  • 6. Vietnam’s largest online bus booking systemvexere.com ● Why event driven architecture? ● What is “Event Driven” architecture? ○ Event-carried State Transfer ○ Event Sourcing ● Event Sourcing in real world ○ What is 2 phase write? ○ MSSQL / transaction log ○ Postgresql / WAL ● What is Kafka & Kafka Connect? ○ Connector/Task/Worker ■ MSSQL Source Connector ○ Transform ○ Kafka and Kafka Connect @ vexere ○ Pros/Cons of Kafka Connect vs Custom Producer ● Use Case/Demo ○ Customer Journey Map Notification ○ Social Proof ○ Event Sourcing + CQRS ○ Data Warehouse ● Experience / Tools / Troubleshoot ○ Tools: (kafka manager, kafka tool) ○ Troubleshoot connector ○ Monitoring ○ Domain Event vs Event Sourcing Event ● Q & A & Discussion 6
  • 7. Vietnam’s largest online bus booking systemvexere.com 7
  • 8. Vietnam’s largest online bus booking systemvexere.com 8 Phase Challenges Launch ● Business Idea Profitability ● Limit resource: ○ Time ○ Technology ○ Money Growth/Expansion ● Increasing Customers ● Increasing Feature ● Adding New Products/BU
  • 9. Vietnam’s largest online bus booking systemvexere.com ● Event-carried State Transfer ● Event Sourcing 9
  • 10. Vietnam’s largest online bus booking systemvexere.com 10
  • 11. Vietnam’s largest online bus booking systemvexere.com 11
  • 12. Vietnam’s largest online bus booking systemvexere.com 12
  • 13. Vietnam’s largest online bus booking systemvexere.com ● Two representation of the world: ○ Application State: the current representation of the world, and ○ log of all the events: that changed that world ● The test definition of Event Sourcing: ○ at any time we can blow away the application state and confidently rebuild it from the log. ● Benefit: ○ Audits ○ Debugging 13
  • 14. Vietnam’s largest online bus booking systemvexere.com ● What is “Event Driven” architecture? ○ Event-carried State Transfer ○ Event Sourcing 14
  • 15. Vietnam’s largest online bus booking systemvexere.com ● Event Sourcing in real world ○ What is 2 phase write? ○ MSSQL / transaction log ○ Postgresql / WAL 15
  • 16. Vietnam’s largest online bus booking systemvexere.com 16 Insert without WAL
  • 17. Vietnam’s largest online bus booking systemvexere.com 17 Insertion operations with WAL
  • 18. Vietnam’s largest online bus booking systemvexere.com 18
  • 19. Vietnam’s largest online bus booking systemvexere.com 19
  • 20. Vietnam’s largest online bus booking systemvexere.com ● Event Sourcing in real world ○ What is 2 phase write? ○ MSSQL / transaction log ○ Postgresql / WAL 20
  • 21. Vietnam’s largest online bus booking systemvexere.com ● What is Kafka & Kafka Connect? ○ Connector/Task/Worker ○ Transform ○ How we use Kafka and Kafka Connect @ vexere ○ Pros/Cons of Kafka Connect vs Custom Producer 21
  • 22. Vietnam’s largest online bus booking systemvexere.com ● topic ● producer ● consumer ● broker ● partition ● consumer group 22
  • 23. Vietnam’s largest online bus booking systemvexere.com 23
  • 24. Vietnam’s largest online bus booking systemvexere.com 24
  • 25. Vietnam’s largest online bus booking systemvexere.com 25
  • 26. Vietnam’s largest online bus booking systemvexere.com 26
  • 27. Vietnam’s largest online bus booking systemvexere.com 27
  • 28. Vietnam’s largest online bus booking systemvexere.com 28
  • 29. Vietnam’s largest online bus booking systemvexere.com Kafka Connect is a framework to stream data into and out of Apache Kafka ● Connectors – the high level abstraction that coordinates data streaming by managing tasks ● Tasks – the implementation of how data is copied to or from Kafka ● Workers – the running processes that execute connectors and tasks ● Converters – the code used to translate data between Connect and the system sending or receiving data ● Transforms – simple logic to alter each message produced by or sent to a connector ● Dead Letter Queue – how Connect handles connector errors 29
  • 30. Vietnam’s largest online bus booking systemvexere.com No coding required, just json config: 30
  • 31. Vietnam’s largest online bus booking systemvexere.com 31
  • 32. Vietnam’s largest online bus booking systemvexere.com 32
  • 33. Vietnam’s largest online bus booking systemvexere.com 33
  • 34. Vietnam’s largest online bus booking systemvexere.com 34
  • 35. Vietnam’s largest online bus booking systemvexere.com 35
  • 36. Vietnam’s largest online bus booking systemvexere.com 36
  • 37. Vietnam’s largest online bus booking systemvexere.com Pros Cons ● Many Connectors (source/sink) ● No coding required ● Simple transform only ● Hard to customize or write your own connector 37
  • 38. Vietnam’s largest online bus booking systemvexere.com ● What is Kafka & Kafka Connect? ○ Connector/Task/Worker ■ MSSQL Source Connector ○ Transform ○ How we use Kafka and Kafka Connect @ vexere ○ Pros/Cons of Kafka Connect vs Custom Producer 38
  • 39. Vietnam’s largest online bus booking systemvexere.com ● Monitor kafka connect job ● AlwaysOn Cluster Config ● Database schema evolution 39
  • 40. Vietnam’s largest online bus booking systemvexere.com 40
  • 41. Vietnam’s largest online bus booking systemvexere.com In Kafka Connect, task is being killed and will not recover until manually restarted Solution: ● Cronjob to monitor task status, then restart task by calling restful to task api ● Dead Letter Queue to handle error in: ○ Convert ○ Transform 41
  • 42. Vietnam’s largest online bus booking systemvexere.com 42 Reference: https://debezium.io/documentation/reference/connectors/sqlserver.html#sqlserver-schema-evolution
  • 43. Vietnam’s largest online bus booking systemvexere.com 43
  • 44. Vietnam’s largest online bus booking systemvexere.com 44 ● NVARCHAR(max) is not supported in CDC table (cannot record before value, only have after update value)
  • 45. Vietnam’s largest online bus booking systemvexere.com ● Experience / Tools / Troubleshoot ○ Tools: (kafka manager, kafka tool) ○ Troubleshoot connector ○ Monitoring 45
  • 46. Vietnam’s largest online bus booking systemvexere.com 46 Reward Thay đổi thông tin tài xế, biển số xe Đánh giá sau chuyến điThanh toán
  • 47. Vietnam’s largest online bus booking systemvexere.com Calculated from Ticket & Booking event 47
  • 48. Vietnam’s largest online bus booking systemvexere.com Separate read & write model Write model: MSSQL Read model: Elasticsearch MSSQL ⇒ Kafka ⇒ Kafka consumer ⇒ Elasticsearch 48
  • 49. Vietnam’s largest online bus booking systemvexere.com Example: Real Time sync data from MSSQL ⇒ Stagging Postgres ⇒ Bigquery Note: ● be careful when backfill data ● If we new column, we have to trigger dummy update to trigger all record event => a lot of trash in transaction log ==> need to write your own job 49
  • 50. Vietnam’s largest online bus booking systemvexere.com 50
  • 51. Vietnam’s largest online bus booking systemvexere.com 51 Reference: https://www.enterpriseintegrationpatterns.com/patterns/messaging/index.html
  • 52. Vietnam’s largest online bus booking systemvexere.com ● https://martinfowler.com/articles/201701-event-driven.html ● https://www.confluent.io/blog/announcing-kafka-connect-building-large-scale-low-latenc y-data-pipelines/ ● https://docs.microsoft.com/en-us/sql/relational-databases/track-changes/about-change- data-capture-sql-server?view=sql-server-2017 ● https://docs.confluent.io/current/connect/concepts.html ● https://www.slideshare.net/ConfluentInc/from-zero-to-hero-with-kafka-connect ● https://www.innoq.com/en/blog/domain-events-versus-event-sourcing/#eventsfromeven tsourcing%E2%89%A0domainevents 52
  • 53. Vietnam’s largest online bus booking systemvexere.com 53
  • 54. Vietnam’s largest online bus booking systemvexere.com 54