SlideShare a Scribd company logo
1 of 29
Download to read offline
A Core Banking System:
A Kafka Proposal
By: Diego Irismar da Costa
Brazil, São Paulo Apache Kafka® Meetup
August 22th, 2019
About Me
@diegoicosta
Current Manager of Infrastructure, sometimes also Chief Software Architect.
Worked mostly with java financial related backends since the early 2000s.
Always interested on Event Streaming, Event Oriented Systems, Distributed
Architectures, Cloud Computing, Observability, Data Bases
At Wirecard BR since 2010
• Previously Buscapé (2008-2010)
• Previously UOL (2000-2010)
Agenda
• Scope
• Kafka General Approach
• Kafka Applied to “A Core Bank System”
• Kafka Streams Topology and Strong Requirements
• Combining AKKA, Kafka and Kafka Streams
• Solution Scalability
• References
A Core Banking System ?
Let’s restrict the Scope
Apply Credit
KBank Account
Apply Debit
Balance
Credit/Debit/Read commands
KBank
An Old School Approach
The 60/70’s have gone
Get over it !
The Greater RDBMS
of the Universe
User Layer
Business Layer
Kafka in General: Basic Approach
Message Broker
Producers
Consumers
Kafka Approach: Beyond Basics
Message Broker
Producers
Consumers
Kafka Streams
Kafka Streams Possibilities
Stream Process Topologies
- Read Streams
- One Topic
- Join Topic Streams
- Process
- Map
- Sum, Count, Group, Merge
- Produce
- Branches
- Another Stream
- Change Log Stream (Ktable)
- Materialize Views
- Local State Store
?
Applying Kafka to a Core Bank System: How ?
?Apply Credit
KBank Account
Apply Debit
Balance
Credit/Debit/Read commands
The Core Topology
1. A account command stream is the topology input
2. The account have to accept the command. Does it have balance ?
3. The input stream is splitted: OK / NOK stream.
Both goes to different topics
?
4. A group by Account is applied to the OK stream
5. An aggregation summarizing the command value by account
6. The aggregation is materialized and persisted into a
changelog topic
The “Core” Requirements What is Needed to Build this ?
No Parallelism, No Multithread
ACID Transactions
Apply Credit
KBank Account
Apply Debit
Balance
Credit/Debit/Read commands
No Parallelism, No Multithread Partitions and Msg Keys
Topic
key:A1 | val:10 key:A2 | val:33 key:A3 | val:77
key:A1 | val:21
Conclusions
If AccountID is the key, each message from
that account will be processed by one
unique thread
ACID Transactions exactly-once “magic”
Kafka Streams Perspective
StreamsConfig.PROCESSING_GUARANTEE_CONFIG, "exactly_once";
It offers end-to-end exactly once guarantees for a stream processing
application that extends from the data read from Kafka, any state
materialized to Kafka by the Streams app, to the final output
written back to Kafka.
The Core Topology Implementation
1. A account command stream is the topology input
builder.stream("kbank.account”,
Consumed.with(Serdes.String(), new JsonSerde()))
consume
The Core Topology Implementation
2. The account have to accept the command. Does it have balance ?
3. The input stream is splitted: OK / NOK stream.
Both goes to different topics
?
accountStreams[] = builder.stream(
“kbank.account”,
Consumed.with(Serdes.String(), new JsonSerde()))
.branch(
(account, command) -> hasBalance(account, command.getValue()),
(account, command) -> noBalance(account, command.getValue())
);
Split based on some defined predicates
accountStreams[0] // OK can be applied
accountStreams[1].through(“kbank.account.refused”) // NOK must be refused
The Core Topology Implementation
accountStreams[0].through(“kbank.account.accepted”)
.mapValues((accountCommand) -> {
return accountCommand.value;
}).groupByKey();
4. A group by Account is applied to the OK stream
The Core Topology Implementation
5. An aggregation summarizing the command value by account
6. The aggregation is materialized and persisted into a
changelog topic
.aggregate(
() -> 0L,
(accountId, balance, oldBalance) -> oldBalance + balance,
Materialized.<String, Long, KeyValueStore<Bytes, byte[]>>
as("kbank.account.store")
.withKeySerde(Serdes.String())
.withValueSerde(Serdes.Long())
);
accountStore = streams.store("kbank.account.store".keyValueStore());
Combining AKKA, Kafka and Kafka Streams
http
COMMAND HANDLER “Sync” COMMAND STREAM PROCESSING “Async”
AKKA
Actors
Kafka
Streams
The Kafka Streams role
http
Id:12er3-34b
Id:12er3-34b
JsonResponse
Response
Streams
COMMAND HANDLER “Sync” COMMAND STREAM PROCESSING - Async
Command
Account
Stream
The AKKA role
http
Id:12er3-34b
Id:12er3-34b
JsonResponse
Command
Account
Stream
Response
Streams
COMMAND HANDLER “Sync” STREAM PROCESSING - Async
Command
Handler
actorRef
actorRef
Response
Router
Id:12er3-34b actorRef
Command
Account
Stream
HTTP
Kafka-Streams
Akka-HTTP
Kafka as …
-Stream Platform
-Event-Store
Changelog
KTable
State store
Materialized
view
Non-Blocking
Exactly-Once
ACID guarantees
Response
Streams
OK / NOK Streams
Actor
per
request
Solution Scalability: Kafka
Kafka, by design …
- A cluster is able to handle trillions of events per day
- Absurd throughput rate
- Battle-proven
Solution Scalability: Kafka Streams
Highly coupled with Kafka
- Also, must count on distribution to handle high volumes
- A Kafka Stream app must also be “partitioned”
- The Materialized views could be by partition
Solution Scalability: Kafka Streams
Command
Account
Stream
Server #3
Command
Account
Stream
Server #1
Command
Account
Stream
Server #2
HTTP
HTTP
Final Thoughts
A Bunch of Concepts Together
Where these ideas came from ?
Pat Helland
Ben Stopford
Martin Kleppmann
Jim Gray
Mato
Some References
https://www.confluent.io/blog/
https://www.confluent.io/blog/exactly-once-semantics-are-possible-heres-how-apache-kafka-does-it/
https://www.confluent.io/blog/transactions-apache-kafka/
https://www.confluent.io/blog/transactional-systems-with-apache-kafka
https://www.confluent.io/blog/data-dichotomy-rethinking-the-way-we-treat-data-and-services/ (part 1 to 7)
https://www.confluent.io/designing-event-driven-systems
https://docs.confluent.io/current/streams/developer-guide/index.html
https://doc.akka.io/docs/akka/current/actors.htm
http://adrianmarriott.net/logosroot/papers/LifeBeyondTxns.pdf
https://learning.oreilly.com/library/view/designing-data-intensive-applications/9781491903063/
The Code
github.com/diegoicosta/kbank
The end

More Related Content

What's hot

Introduction to Kafka Streams
Introduction to Kafka StreamsIntroduction to Kafka Streams
Introduction to Kafka StreamsGuozhang Wang
 
Bootstrapping state in Apache Flink
Bootstrapping state in Apache FlinkBootstrapping state in Apache Flink
Bootstrapping state in Apache FlinkDataWorks Summit
 
Beyond the Spotify Model - Team Topologies - Tech.rocks - 2020-12-10 - Matthe...
Beyond the Spotify Model - Team Topologies - Tech.rocks - 2020-12-10 - Matthe...Beyond the Spotify Model - Team Topologies - Tech.rocks - 2020-12-10 - Matthe...
Beyond the Spotify Model - Team Topologies - Tech.rocks - 2020-12-10 - Matthe...Matthew Skelton
 
Real-Life Use Cases & Architectures for Event Streaming with Apache Kafka
Real-Life Use Cases & Architectures for Event Streaming with Apache KafkaReal-Life Use Cases & Architectures for Event Streaming with Apache Kafka
Real-Life Use Cases & Architectures for Event Streaming with Apache KafkaKai Wähner
 
Grokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKIGrokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKIGrokking VN
 
Delivering: from Kafka to WebSockets | Adam Warski, SoftwareMill
Delivering: from Kafka to WebSockets | Adam Warski, SoftwareMillDelivering: from Kafka to WebSockets | Adam Warski, SoftwareMill
Delivering: from Kafka to WebSockets | Adam Warski, SoftwareMillHostedbyConfluent
 
Near real-time statistical modeling and anomaly detection using Flink!
Near real-time statistical modeling and anomaly detection using Flink!Near real-time statistical modeling and anomaly detection using Flink!
Near real-time statistical modeling and anomaly detection using Flink!Flink Forward
 
Benefits of Stream Processing and Apache Kafka Use Cases
Benefits of Stream Processing and Apache Kafka Use CasesBenefits of Stream Processing and Apache Kafka Use Cases
Benefits of Stream Processing and Apache Kafka Use Casesconfluent
 
Kafka Security 101 and Real-World Tips
Kafka Security 101 and Real-World Tips Kafka Security 101 and Real-World Tips
Kafka Security 101 and Real-World Tips confluent
 
Demystifying the Distributed Database Landscape (DevOps) (1).pdf
Demystifying the Distributed Database Landscape (DevOps) (1).pdfDemystifying the Distributed Database Landscape (DevOps) (1).pdf
Demystifying the Distributed Database Landscape (DevOps) (1).pdfScyllaDB
 
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...Amazon Web Services Japan
 
Kafka’s New Control Plane: The Quorum Controller | Colin McCabe, Confluent
Kafka’s New Control Plane: The Quorum Controller | Colin McCabe, ConfluentKafka’s New Control Plane: The Quorum Controller | Colin McCabe, Confluent
Kafka’s New Control Plane: The Quorum Controller | Colin McCabe, ConfluentHostedbyConfluent
 
Event Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQEvent Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQAraf Karsh Hamid
 
Stream processing using Kafka
Stream processing using KafkaStream processing using Kafka
Stream processing using KafkaKnoldus Inc.
 
Schema-on-Read vs Schema-on-Write
Schema-on-Read vs Schema-on-WriteSchema-on-Read vs Schema-on-Write
Schema-on-Read vs Schema-on-WriteAmr Awadallah
 
Apache Kafka Streams + Machine Learning / Deep Learning
Apache Kafka Streams + Machine Learning / Deep LearningApache Kafka Streams + Machine Learning / Deep Learning
Apache Kafka Streams + Machine Learning / Deep LearningKai Wähner
 
Apache Beam: A unified model for batch and stream processing data
Apache Beam: A unified model for batch and stream processing dataApache Beam: A unified model for batch and stream processing data
Apache Beam: A unified model for batch and stream processing dataDataWorks Summit/Hadoop Summit
 
Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...
Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...
Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...GetInData
 
Developing with the Go client for Apache Kafka
Developing with the Go client for Apache KafkaDeveloping with the Go client for Apache Kafka
Developing with the Go client for Apache KafkaJoe Stein
 

What's hot (20)

Introduction to Kafka Streams
Introduction to Kafka StreamsIntroduction to Kafka Streams
Introduction to Kafka Streams
 
Kafka 101
Kafka 101Kafka 101
Kafka 101
 
Bootstrapping state in Apache Flink
Bootstrapping state in Apache FlinkBootstrapping state in Apache Flink
Bootstrapping state in Apache Flink
 
Beyond the Spotify Model - Team Topologies - Tech.rocks - 2020-12-10 - Matthe...
Beyond the Spotify Model - Team Topologies - Tech.rocks - 2020-12-10 - Matthe...Beyond the Spotify Model - Team Topologies - Tech.rocks - 2020-12-10 - Matthe...
Beyond the Spotify Model - Team Topologies - Tech.rocks - 2020-12-10 - Matthe...
 
Real-Life Use Cases & Architectures for Event Streaming with Apache Kafka
Real-Life Use Cases & Architectures for Event Streaming with Apache KafkaReal-Life Use Cases & Architectures for Event Streaming with Apache Kafka
Real-Life Use Cases & Architectures for Event Streaming with Apache Kafka
 
Grokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKIGrokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKI
 
Delivering: from Kafka to WebSockets | Adam Warski, SoftwareMill
Delivering: from Kafka to WebSockets | Adam Warski, SoftwareMillDelivering: from Kafka to WebSockets | Adam Warski, SoftwareMill
Delivering: from Kafka to WebSockets | Adam Warski, SoftwareMill
 
Near real-time statistical modeling and anomaly detection using Flink!
Near real-time statistical modeling and anomaly detection using Flink!Near real-time statistical modeling and anomaly detection using Flink!
Near real-time statistical modeling and anomaly detection using Flink!
 
Benefits of Stream Processing and Apache Kafka Use Cases
Benefits of Stream Processing and Apache Kafka Use CasesBenefits of Stream Processing and Apache Kafka Use Cases
Benefits of Stream Processing and Apache Kafka Use Cases
 
Kafka Security 101 and Real-World Tips
Kafka Security 101 and Real-World Tips Kafka Security 101 and Real-World Tips
Kafka Security 101 and Real-World Tips
 
Demystifying the Distributed Database Landscape (DevOps) (1).pdf
Demystifying the Distributed Database Landscape (DevOps) (1).pdfDemystifying the Distributed Database Landscape (DevOps) (1).pdf
Demystifying the Distributed Database Landscape (DevOps) (1).pdf
 
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
202201 AWS Black Belt Online Seminar Apache Spark Performnace Tuning for AWS ...
 
Kafka’s New Control Plane: The Quorum Controller | Colin McCabe, Confluent
Kafka’s New Control Plane: The Quorum Controller | Colin McCabe, ConfluentKafka’s New Control Plane: The Quorum Controller | Colin McCabe, Confluent
Kafka’s New Control Plane: The Quorum Controller | Colin McCabe, Confluent
 
Event Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQEvent Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQ
 
Stream processing using Kafka
Stream processing using KafkaStream processing using Kafka
Stream processing using Kafka
 
Schema-on-Read vs Schema-on-Write
Schema-on-Read vs Schema-on-WriteSchema-on-Read vs Schema-on-Write
Schema-on-Read vs Schema-on-Write
 
Apache Kafka Streams + Machine Learning / Deep Learning
Apache Kafka Streams + Machine Learning / Deep LearningApache Kafka Streams + Machine Learning / Deep Learning
Apache Kafka Streams + Machine Learning / Deep Learning
 
Apache Beam: A unified model for batch and stream processing data
Apache Beam: A unified model for batch and stream processing dataApache Beam: A unified model for batch and stream processing data
Apache Beam: A unified model for batch and stream processing data
 
Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...
Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...
Best Practices for ETL with Apache NiFi on Kubernetes - Albert Lewandowski, G...
 
Developing with the Go client for Apache Kafka
Developing with the Go client for Apache KafkaDeveloping with the Go client for Apache Kafka
Developing with the Go client for Apache Kafka
 

Similar to A Kafka Proposal for a Core Banking System

Flexible Authentication Strategies with SASL/OAUTHBEARER (Michael Kaminski, T...
Flexible Authentication Strategies with SASL/OAUTHBEARER (Michael Kaminski, T...Flexible Authentication Strategies with SASL/OAUTHBEARER (Michael Kaminski, T...
Flexible Authentication Strategies with SASL/OAUTHBEARER (Michael Kaminski, T...confluent
 
Event Streaming Architectures with Confluent and ScyllaDB
Event Streaming Architectures with Confluent and ScyllaDBEvent Streaming Architectures with Confluent and ScyllaDB
Event Streaming Architectures with Confluent and ScyllaDBScyllaDB
 
Kafka streams decoupling with stores
Kafka streams decoupling with storesKafka streams decoupling with stores
Kafka streams decoupling with storesYoni Farin
 
Knock Knock, Who’s There? With Justin Chen and Dhruv Jauhar | Current 2022
Knock Knock, Who’s There? With Justin Chen and Dhruv Jauhar | Current 2022Knock Knock, Who’s There? With Justin Chen and Dhruv Jauhar | Current 2022
Knock Knock, Who’s There? With Justin Chen and Dhruv Jauhar | Current 2022HostedbyConfluent
 
Use ksqlDB to migrate core-banking processing from batch to streaming | Mark ...
Use ksqlDB to migrate core-banking processing from batch to streaming | Mark ...Use ksqlDB to migrate core-banking processing from batch to streaming | Mark ...
Use ksqlDB to migrate core-banking processing from batch to streaming | Mark ...HostedbyConfluent
 
Harness the Power of Infrastructure as Code
Harness the Power of Infrastructure as CodeHarness the Power of Infrastructure as Code
Harness the Power of Infrastructure as CodeAmazon Web Services
 
Streaming with Spring Cloud Stream and Apache Kafka - Soby Chacko
Streaming with Spring Cloud Stream and Apache Kafka - Soby ChackoStreaming with Spring Cloud Stream and Apache Kafka - Soby Chacko
Streaming with Spring Cloud Stream and Apache Kafka - Soby ChackoVMware Tanzu
 
Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...
Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...
Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...Kai Wähner
 
BBL KAPPA Lesfurets.com
BBL KAPPA Lesfurets.comBBL KAPPA Lesfurets.com
BBL KAPPA Lesfurets.comCedric Vidal
 
APAC ksqlDB Workshop
APAC ksqlDB WorkshopAPAC ksqlDB Workshop
APAC ksqlDB Workshopconfluent
 
Event Driven Architectures with Apache Kafka
Event Driven Architectures with Apache KafkaEvent Driven Architectures with Apache Kafka
Event Driven Architectures with Apache KafkaMatt Masuda
 
Resume_Ashok-updated (1) (1)
Resume_Ashok-updated (1) (1)Resume_Ashok-updated (1) (1)
Resume_Ashok-updated (1) (1)chimmili ashok
 
Real time data pipline with kafka streams
Real time data pipline with kafka streamsReal time data pipline with kafka streams
Real time data pipline with kafka streamsYoni Farin
 
The Very Very Latest in Database Development - Oracle Open World 2012
The Very Very Latest in Database Development - Oracle Open World 2012The Very Very Latest in Database Development - Oracle Open World 2012
The Very Very Latest in Database Development - Oracle Open World 2012Lucas Jellema
 
AWS re:Invent 2016: How to Launch a 100K-User Corporate Back Office with Micr...
AWS re:Invent 2016: How to Launch a 100K-User Corporate Back Office with Micr...AWS re:Invent 2016: How to Launch a 100K-User Corporate Back Office with Micr...
AWS re:Invent 2016: How to Launch a 100K-User Corporate Back Office with Micr...Amazon Web Services
 
Chicago Kafka Meetup
Chicago Kafka MeetupChicago Kafka Meetup
Chicago Kafka MeetupCliff Gilmore
 
Elastically Scaling Kafka Using Confluent
Elastically Scaling Kafka Using ConfluentElastically Scaling Kafka Using Confluent
Elastically Scaling Kafka Using Confluentconfluent
 
Data-Streaming at DKV
Data-Streaming at DKVData-Streaming at DKV
Data-Streaming at DKVconfluent
 
Apache Kafka and Blockchain - Comparison and a Kafka-native Implementation
Apache Kafka and Blockchain - Comparison and a Kafka-native ImplementationApache Kafka and Blockchain - Comparison and a Kafka-native Implementation
Apache Kafka and Blockchain - Comparison and a Kafka-native ImplementationKai Wähner
 

Similar to A Kafka Proposal for a Core Banking System (20)

Flexible Authentication Strategies with SASL/OAUTHBEARER (Michael Kaminski, T...
Flexible Authentication Strategies with SASL/OAUTHBEARER (Michael Kaminski, T...Flexible Authentication Strategies with SASL/OAUTHBEARER (Michael Kaminski, T...
Flexible Authentication Strategies with SASL/OAUTHBEARER (Michael Kaminski, T...
 
Event Streaming Architectures with Confluent and ScyllaDB
Event Streaming Architectures with Confluent and ScyllaDBEvent Streaming Architectures with Confluent and ScyllaDB
Event Streaming Architectures with Confluent and ScyllaDB
 
Kafka streams decoupling with stores
Kafka streams decoupling with storesKafka streams decoupling with stores
Kafka streams decoupling with stores
 
Knock Knock, Who’s There? With Justin Chen and Dhruv Jauhar | Current 2022
Knock Knock, Who’s There? With Justin Chen and Dhruv Jauhar | Current 2022Knock Knock, Who’s There? With Justin Chen and Dhruv Jauhar | Current 2022
Knock Knock, Who’s There? With Justin Chen and Dhruv Jauhar | Current 2022
 
Use ksqlDB to migrate core-banking processing from batch to streaming | Mark ...
Use ksqlDB to migrate core-banking processing from batch to streaming | Mark ...Use ksqlDB to migrate core-banking processing from batch to streaming | Mark ...
Use ksqlDB to migrate core-banking processing from batch to streaming | Mark ...
 
Harness the Power of Infrastructure as Code
Harness the Power of Infrastructure as CodeHarness the Power of Infrastructure as Code
Harness the Power of Infrastructure as Code
 
Streaming with Spring Cloud Stream and Apache Kafka - Soby Chacko
Streaming with Spring Cloud Stream and Apache Kafka - Soby ChackoStreaming with Spring Cloud Stream and Apache Kafka - Soby Chacko
Streaming with Spring Cloud Stream and Apache Kafka - Soby Chacko
 
Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...
Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...
Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...
 
BBL KAPPA Lesfurets.com
BBL KAPPA Lesfurets.comBBL KAPPA Lesfurets.com
BBL KAPPA Lesfurets.com
 
APAC ksqlDB Workshop
APAC ksqlDB WorkshopAPAC ksqlDB Workshop
APAC ksqlDB Workshop
 
Event Driven Architectures with Apache Kafka
Event Driven Architectures with Apache KafkaEvent Driven Architectures with Apache Kafka
Event Driven Architectures with Apache Kafka
 
Resume_Ashok-updated (1) (1)
Resume_Ashok-updated (1) (1)Resume_Ashok-updated (1) (1)
Resume_Ashok-updated (1) (1)
 
Real time data pipline with kafka streams
Real time data pipline with kafka streamsReal time data pipline with kafka streams
Real time data pipline with kafka streams
 
The Very Very Latest in Database Development - Oracle Open World 2012
The Very Very Latest in Database Development - Oracle Open World 2012The Very Very Latest in Database Development - Oracle Open World 2012
The Very Very Latest in Database Development - Oracle Open World 2012
 
The Very Very Latest In Database Development - Lucas Jellema - Oracle OpenWor...
The Very Very Latest In Database Development - Lucas Jellema - Oracle OpenWor...The Very Very Latest In Database Development - Lucas Jellema - Oracle OpenWor...
The Very Very Latest In Database Development - Lucas Jellema - Oracle OpenWor...
 
AWS re:Invent 2016: How to Launch a 100K-User Corporate Back Office with Micr...
AWS re:Invent 2016: How to Launch a 100K-User Corporate Back Office with Micr...AWS re:Invent 2016: How to Launch a 100K-User Corporate Back Office with Micr...
AWS re:Invent 2016: How to Launch a 100K-User Corporate Back Office with Micr...
 
Chicago Kafka Meetup
Chicago Kafka MeetupChicago Kafka Meetup
Chicago Kafka Meetup
 
Elastically Scaling Kafka Using Confluent
Elastically Scaling Kafka Using ConfluentElastically Scaling Kafka Using Confluent
Elastically Scaling Kafka Using Confluent
 
Data-Streaming at DKV
Data-Streaming at DKVData-Streaming at DKV
Data-Streaming at DKV
 
Apache Kafka and Blockchain - Comparison and a Kafka-native Implementation
Apache Kafka and Blockchain - Comparison and a Kafka-native ImplementationApache Kafka and Blockchain - Comparison and a Kafka-native Implementation
Apache Kafka and Blockchain - Comparison and a Kafka-native Implementation
 

Recently uploaded

Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 

A Kafka Proposal for a Core Banking System

  • 1. A Core Banking System: A Kafka Proposal By: Diego Irismar da Costa Brazil, São Paulo Apache Kafka® Meetup August 22th, 2019
  • 2. About Me @diegoicosta Current Manager of Infrastructure, sometimes also Chief Software Architect. Worked mostly with java financial related backends since the early 2000s. Always interested on Event Streaming, Event Oriented Systems, Distributed Architectures, Cloud Computing, Observability, Data Bases At Wirecard BR since 2010 • Previously Buscapé (2008-2010) • Previously UOL (2000-2010)
  • 3. Agenda • Scope • Kafka General Approach • Kafka Applied to “A Core Bank System” • Kafka Streams Topology and Strong Requirements • Combining AKKA, Kafka and Kafka Streams • Solution Scalability • References
  • 4. A Core Banking System ? Let’s restrict the Scope Apply Credit KBank Account Apply Debit Balance Credit/Debit/Read commands KBank
  • 5. An Old School Approach The 60/70’s have gone Get over it ! The Greater RDBMS of the Universe User Layer Business Layer
  • 6. Kafka in General: Basic Approach Message Broker Producers Consumers
  • 7. Kafka Approach: Beyond Basics Message Broker Producers Consumers Kafka Streams
  • 8. Kafka Streams Possibilities Stream Process Topologies - Read Streams - One Topic - Join Topic Streams - Process - Map - Sum, Count, Group, Merge - Produce - Branches - Another Stream - Change Log Stream (Ktable) - Materialize Views - Local State Store ?
  • 9. Applying Kafka to a Core Bank System: How ? ?Apply Credit KBank Account Apply Debit Balance Credit/Debit/Read commands
  • 10. The Core Topology 1. A account command stream is the topology input 2. The account have to accept the command. Does it have balance ? 3. The input stream is splitted: OK / NOK stream. Both goes to different topics ? 4. A group by Account is applied to the OK stream 5. An aggregation summarizing the command value by account 6. The aggregation is materialized and persisted into a changelog topic
  • 11. The “Core” Requirements What is Needed to Build this ? No Parallelism, No Multithread ACID Transactions Apply Credit KBank Account Apply Debit Balance Credit/Debit/Read commands
  • 12. No Parallelism, No Multithread Partitions and Msg Keys Topic key:A1 | val:10 key:A2 | val:33 key:A3 | val:77 key:A1 | val:21 Conclusions If AccountID is the key, each message from that account will be processed by one unique thread
  • 13. ACID Transactions exactly-once “magic” Kafka Streams Perspective StreamsConfig.PROCESSING_GUARANTEE_CONFIG, "exactly_once"; It offers end-to-end exactly once guarantees for a stream processing application that extends from the data read from Kafka, any state materialized to Kafka by the Streams app, to the final output written back to Kafka.
  • 14. The Core Topology Implementation 1. A account command stream is the topology input builder.stream("kbank.account”, Consumed.with(Serdes.String(), new JsonSerde())) consume
  • 15. The Core Topology Implementation 2. The account have to accept the command. Does it have balance ? 3. The input stream is splitted: OK / NOK stream. Both goes to different topics ? accountStreams[] = builder.stream( “kbank.account”, Consumed.with(Serdes.String(), new JsonSerde())) .branch( (account, command) -> hasBalance(account, command.getValue()), (account, command) -> noBalance(account, command.getValue()) ); Split based on some defined predicates accountStreams[0] // OK can be applied accountStreams[1].through(“kbank.account.refused”) // NOK must be refused
  • 16. The Core Topology Implementation accountStreams[0].through(“kbank.account.accepted”) .mapValues((accountCommand) -> { return accountCommand.value; }).groupByKey(); 4. A group by Account is applied to the OK stream
  • 17. The Core Topology Implementation 5. An aggregation summarizing the command value by account 6. The aggregation is materialized and persisted into a changelog topic .aggregate( () -> 0L, (accountId, balance, oldBalance) -> oldBalance + balance, Materialized.<String, Long, KeyValueStore<Bytes, byte[]>> as("kbank.account.store") .withKeySerde(Serdes.String()) .withValueSerde(Serdes.Long()) ); accountStore = streams.store("kbank.account.store".keyValueStore());
  • 18. Combining AKKA, Kafka and Kafka Streams http COMMAND HANDLER “Sync” COMMAND STREAM PROCESSING “Async” AKKA Actors Kafka Streams
  • 19. The Kafka Streams role http Id:12er3-34b Id:12er3-34b JsonResponse Response Streams COMMAND HANDLER “Sync” COMMAND STREAM PROCESSING - Async Command Account Stream
  • 20. The AKKA role http Id:12er3-34b Id:12er3-34b JsonResponse Command Account Stream Response Streams COMMAND HANDLER “Sync” STREAM PROCESSING - Async Command Handler actorRef actorRef Response Router Id:12er3-34b actorRef
  • 21. Command Account Stream HTTP Kafka-Streams Akka-HTTP Kafka as … -Stream Platform -Event-Store Changelog KTable State store Materialized view Non-Blocking Exactly-Once ACID guarantees Response Streams OK / NOK Streams Actor per request
  • 22. Solution Scalability: Kafka Kafka, by design … - A cluster is able to handle trillions of events per day - Absurd throughput rate - Battle-proven
  • 23. Solution Scalability: Kafka Streams Highly coupled with Kafka - Also, must count on distribution to handle high volumes - A Kafka Stream app must also be “partitioned” - The Materialized views could be by partition
  • 24. Solution Scalability: Kafka Streams Command Account Stream Server #3 Command Account Stream Server #1 Command Account Stream Server #2 HTTP HTTP
  • 25. Final Thoughts A Bunch of Concepts Together
  • 26. Where these ideas came from ? Pat Helland Ben Stopford Martin Kleppmann Jim Gray Mato
  • 27. Some References https://www.confluent.io/blog/ https://www.confluent.io/blog/exactly-once-semantics-are-possible-heres-how-apache-kafka-does-it/ https://www.confluent.io/blog/transactions-apache-kafka/ https://www.confluent.io/blog/transactional-systems-with-apache-kafka https://www.confluent.io/blog/data-dichotomy-rethinking-the-way-we-treat-data-and-services/ (part 1 to 7) https://www.confluent.io/designing-event-driven-systems https://docs.confluent.io/current/streams/developer-guide/index.html https://doc.akka.io/docs/akka/current/actors.htm http://adrianmarriott.net/logosroot/papers/LifeBeyondTxns.pdf https://learning.oreilly.com/library/view/designing-data-intensive-applications/9781491903063/