SlideShare a Scribd company logo
Apache Kafka
© 2019 IBM Corporation
Event-Driven
Microservices
Using IBM Apache Kafka
Andrew Schofield
Chief Architect, Event Streams
IBM Hursley Park
Event-Driven Architecture meetup
© 2019 IBM Corporation
What are microservices?
Microservices is a technique for structuring
an application as a collection of services
• Self-contained with clear interfaces and
a distinct purpose
• Loosely coupled – communicate over a
network
• Independently deployable, scalable,
maintainable and testable
Microservices ApplicationMonolithic Application
© 2019 IBM Corporation
Event-driven microservices
Microservices communicate primarily with
events, with APIs where required
• Microservices can produce and
consume events using publish/subscribe
messaging
• Events are handled by an event
backbone
• Data is eventually consistentMICROSERVICES APPLICATION
API
MICROSERVICE
MICROSERVICE
MICROSERVICE
EVENT BACKBONE
MICROSERVICE
MICROSERVICE
MICROSERVICE
MICROSERVICE
MICROSERVICE
API
SERVICE DISCOVERY
PUBLISH
PUBLISH
SUBSCRIBE
SUBSCRIBE
© 2019 IBM Corporation
Comparing messaging patterns
QUEUE 0 1 2 3 4 5 6 7
CONSUMER CONSUMER CONSUMER
PRODUCER PRODUCER
TOPIC 0 1 2 3 4 5 6 7
SUBSCRIPTION SUBSCRIPTION
PRODUCER PRODUCER
CONSUMER CONSUMER CONSUMER
POINT-TO-POINT PUBLISH/SUBSCRIBE
© 2019 IBM Corporation
Apache Kafka is an Open-Source Streaming Platform
PUBLISH/SUBSCRIBE
Read and write streams of events, like a
traditional messaging system
PROCESS
Support scalable stream processing
applications that react to events in real
time
STORE
Store streams of data safely in a
distributed, replicated, fault-tolerant
cluster
https://kafka.apache.org/
Kafka
Cluster
Producer ProducerProducer
Consumer ConsumerConsumer
Stream
Processor
Stream
Processor
Source
Connector
Sink Connector
© 2019 IBM Corporation
Introducing the event backbone
EVENT BACKBONE
Microservic
e
Microservic
e
© 2019 IBM Corporation
Introducing the event backbone
1
Building Blocks
1 :: Event sources
Microservic
e
Microservic
e
EVENT BACKBONE
© 2019 IBM Corporation
Introducing the event backbone
1
2
Building Blocks
1 :: Event sources
2 :: Stream processing
Microservic
e
Microservic
e
EVENT BACKBONE
© 2019 IBM Corporation
Introducing the event backbone
1
2 App
3
Building Blocks
1 :: Event sources
2 :: Stream processing
3 :: Event archive
Microservic
e
Microservic
e
EVENT BACKBONE
© 2019 IBM Corporation
Introducing the event backbone
App
1
2
3
4
Building Blocks
1 :: Event sources
2 :: Stream processing
3 :: Event archive
4 :: Notifications
Microservic
e
Microservic
e
EVENT BACKBONE
© 2019 IBM Corporation
A simple stream processing example
EVENT BACKBONE
Transactions
© 2019 IBM Corporation
A simple stream processing example
EVENT BACKBONE
Transactions
Alerts
© 2019 IBM Corporation
A simple stream processing example
EVENT BACKBONE
Transactions
Alerts
SMS alerts
Email alerts
Push alerts
© 2019 IBM Corporation
A simple stream processing example
EVENT BACKBONE
Send SMS
Transactions
Alerts
Send emails
Send push
notifications
SMS alerts
Email alerts
Push alerts
© 2019 IBM Corporation
How to get started
You could run an event storming workshop
https://www.ibm.com/cloud/garage/architectures/eventDrivenArchitecture/event-storming-
methodology
Identify:
Events
Actors
Data
Commands
© 2019 IBM Corporation
A more complex event-driven example
https://ibm-cloud-architecture.github.io/refarch-kc/design/readme/
© 2019 IBM Corporation
A more complex example – component view
Fleet
microservice
Containers
microservice
Voyages
microservice
Orders
microservice
API API
© 2019 IBM Corporation
A more complex example – component view
Fleet
microservice
Containers
microservice
Voyages
microservice
Orders
microservice
API API
© 2019 IBM Corporation
A more complex example – component view
EVENT BACKBONE
ships containers orders voyages
Fleet
microservice
Containers
microservice
Voyages
microservice
Orders
microservice
API API
© 2019 IBM Corporation
A more complex example – component view
EVENT BACKBONE
ships containers problems orders voyages
Fleet
microservice
Containers
microservice
Voyages
microservice
Orders
microservice
Streaming
analytics
API API
© 2019 IBM Corporation
Patterns for event-driven microservices
You want:
Loose coupling
Data consistency
Efficient queries
You need PATTERNS, such as:
Database per service
Saga
Event sourcing
CQRS
© 2019 IBM Corporation
Pattern – Database per service
Each microservice persists its own data
Protects independence of the microservice against external change
Introduces complexity for data consistency across microservices
EVENT BACKBONE
ships containers problems orders voyages
Fleet
microservice
Containers
microservice
Voyages
microservice
Orders
microservice
© 2019 IBM Corporation
Kafka log compaction for data replication
0
key:a
val:A1
1
key:b
val:B1
2
key:a
val:A2
3
key:c
val:C1
TOPIC
PARTITION
4
key:c
val:C2
PRODUCER
Consumer
takes latest
values and
builds own
data store
KEY VALUE
a A2
b <deleted>
c C2
SOURCE CHANGE
LOG
Read
© 2019 IBM Corporation
Kafka log compaction for data replication
0
key:a
val:A1
1
key:b
val:B1
2
key:a
val:A2
3
key:c
val:C1
TOPIC
PARTITION
4
key:c
val:C2
KEY VALUE
a A2
b <deleted>
c C2
2
key:a
val:A2
4
key:b
val:C2
TOPIC
PARTITION
(rewritten)
PERIODIC COMPACTION ELIMINATES
DUPLICATE KEYS TO MINIMIZE STORAGE
© 2019 IBM Corporation
Pattern – Sagas
Orchestration of multi-step operations across microservices
Data consistency across microservices without distributed transactions
Programming can be complex, particularly for failure compensation
EVENT BACKBONE
Fleet
microservice
Containers
microservice
Voyages
microservice
Orders
microservice
1 2 3 4 5
© 2019 IBM Corporation
EVENT BACKBONE
Pattern – Event sourcing
Every state change to an object is captured as an event stored in sequence
Replaying the events in order rebuilds the current state of the objects
By subscribing to the events, you get an evolving copy of the objects’ state
Query
handler
Command
handler
USER
Order1
Created
Order1
Updated
Order2
Created
Order1
Complete
Order3
Created
Order2
Canceled
Order3
Updated
Order3
Complete
© 2019 IBM Corporation
Pattern – Event sourcing with Kafka
Order2
Created
Order2
Updated
Order4
Created
Order2
Complete
Order4
Canceled
Order3
Created
Order3
Updated
Order6
Created
Order3
Complete
Order3
Created
Order6
Updated
Order1
Created
Order1
Updated
Order5
Created
Order1
Complete
Order7
Created
Order5
Canceled
Order7
Updated
Order7
Complete
TOPIC orders
PARTITION 0
TOPIC orders
PARTITION 1
TOPIC orders
PARTITION 2
CONSUMER GROUP A
p0, offset 7
p1, offset 3
p2, offset 5
CONSUMER
CONSUMER
CONSUMER
CONSUMER GROUP B
p0, offset 7
p1, offset 3
p2, offset 5
CONSUMER
CONSUMER
© 2019 IBM Corporation
Pattern – Command Query Responsibility Segregation (CQRS)
Atomic writes and efficient reads at the same time
API split into commands (change state) and queries (read only)
Complex in practice
EVENT BACKBONE
1 2 3 4 5
Fleet MS
WRITE
MODEL
Fleet MS
READ MODEL
Write-optimized
store
Read-optimized
store
Write API Read API
© 2019 IBM Corporation
Summary
Event-driven microservices offer an effective way to build loosely coupled applications
Techniques such as event storming can be used to derive the objects, commands and
events in an application
Patterns such as event sourcing and sagas make the complexity manageable
© 2019 IBM Corporation
Thank you
Andrew Schofield
Chief Architect, Event Streams
IBM Hursley Park
andrew_schofield@uk.ibm.com

More Related Content

What's hot

Microservice vs. Monolithic Architecture
Microservice vs. Monolithic ArchitectureMicroservice vs. Monolithic Architecture
Microservice vs. Monolithic Architecture
Paul Mooney
 
Event Driven Software Architecture Pattern
Event Driven Software Architecture PatternEvent Driven Software Architecture Pattern
Event Driven Software Architecture Pattern
jeetendra mandal
 
Saga about distributed business transactions in microservices world
Saga about distributed business transactions in microservices worldSaga about distributed business transactions in microservices world
Saga about distributed business transactions in microservices world
Mikalai Alimenkou
 
Introduction to Event-Driven Architecture
Introduction to Event-Driven Architecture Introduction to Event-Driven Architecture
Introduction to Event-Driven Architecture
Solace
 
Introducing Saga Pattern in Microservices with Spring Statemachine
Introducing Saga Pattern in Microservices with Spring StatemachineIntroducing Saga Pattern in Microservices with Spring Statemachine
Introducing Saga Pattern in Microservices with Spring Statemachine
VMware Tanzu
 
Microservice Architecture
Microservice ArchitectureMicroservice Architecture
Microservice Architecture
Nguyen Tung
 
Microservices with event source and CQRS
Microservices with event source and CQRSMicroservices with event source and CQRS
Microservices with event source and CQRS
Md Ayub Ali Sarker
 
Why Microservice
Why Microservice Why Microservice
Why Microservice
Kelvin Yeung
 
Event Storming and Saga
Event Storming and SagaEvent Storming and Saga
Event Storming and Saga
Araf Karsh Hamid
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
Amazon Web Services
 
Event Driven Architecture
Event Driven ArchitectureEvent Driven Architecture
Event Driven Architecture
Chris Patterson
 
Event driven microservices
Event driven microservicesEvent driven microservices
Event driven microservices
Anthony Martin
 
Micro services vs Monolith Architecture
Micro services vs Monolith ArchitectureMicro services vs Monolith Architecture
Micro services vs Monolith Architecture
MohamedElGohary71
 
Microservice architecture
Microservice architectureMicroservice architecture
Microservice architecture
Žilvinas Kuusas
 
Event Driven Microservices architecture
Event Driven Microservices architectureEvent Driven Microservices architecture
Event Driven Microservices architecture
NikhilBarthwal4
 
Event Driven Architecture
Event Driven ArchitectureEvent Driven Architecture
Event Driven Architecture
Stefan Norberg
 
Agile, User Stories, Domain Driven Design
Agile, User Stories, Domain Driven DesignAgile, User Stories, Domain Driven Design
Agile, User Stories, Domain Driven Design
Araf Karsh Hamid
 
Microservices Architecture - Bangkok 2018
Microservices Architecture - Bangkok 2018Microservices Architecture - Bangkok 2018
Microservices Architecture - Bangkok 2018
Araf Karsh Hamid
 
CQRS + Event Sourcing
CQRS + Event SourcingCQRS + Event Sourcing
CQRS + Event Sourcing
Mike Bild
 
Event Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspectiveEvent Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspective
Jonas Bonér
 

What's hot (20)

Microservice vs. Monolithic Architecture
Microservice vs. Monolithic ArchitectureMicroservice vs. Monolithic Architecture
Microservice vs. Monolithic Architecture
 
Event Driven Software Architecture Pattern
Event Driven Software Architecture PatternEvent Driven Software Architecture Pattern
Event Driven Software Architecture Pattern
 
Saga about distributed business transactions in microservices world
Saga about distributed business transactions in microservices worldSaga about distributed business transactions in microservices world
Saga about distributed business transactions in microservices world
 
Introduction to Event-Driven Architecture
Introduction to Event-Driven Architecture Introduction to Event-Driven Architecture
Introduction to Event-Driven Architecture
 
Introducing Saga Pattern in Microservices with Spring Statemachine
Introducing Saga Pattern in Microservices with Spring StatemachineIntroducing Saga Pattern in Microservices with Spring Statemachine
Introducing Saga Pattern in Microservices with Spring Statemachine
 
Microservice Architecture
Microservice ArchitectureMicroservice Architecture
Microservice Architecture
 
Microservices with event source and CQRS
Microservices with event source and CQRSMicroservices with event source and CQRS
Microservices with event source and CQRS
 
Why Microservice
Why Microservice Why Microservice
Why Microservice
 
Event Storming and Saga
Event Storming and SagaEvent Storming and Saga
Event Storming and Saga
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Event Driven Architecture
Event Driven ArchitectureEvent Driven Architecture
Event Driven Architecture
 
Event driven microservices
Event driven microservicesEvent driven microservices
Event driven microservices
 
Micro services vs Monolith Architecture
Micro services vs Monolith ArchitectureMicro services vs Monolith Architecture
Micro services vs Monolith Architecture
 
Microservice architecture
Microservice architectureMicroservice architecture
Microservice architecture
 
Event Driven Microservices architecture
Event Driven Microservices architectureEvent Driven Microservices architecture
Event Driven Microservices architecture
 
Event Driven Architecture
Event Driven ArchitectureEvent Driven Architecture
Event Driven Architecture
 
Agile, User Stories, Domain Driven Design
Agile, User Stories, Domain Driven DesignAgile, User Stories, Domain Driven Design
Agile, User Stories, Domain Driven Design
 
Microservices Architecture - Bangkok 2018
Microservices Architecture - Bangkok 2018Microservices Architecture - Bangkok 2018
Microservices Architecture - Bangkok 2018
 
CQRS + Event Sourcing
CQRS + Event SourcingCQRS + Event Sourcing
CQRS + Event Sourcing
 
Event Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspectiveEvent Driven-Architecture from a Scalability perspective
Event Driven-Architecture from a Scalability perspective
 

Similar to Event-driven microservices

Kafka with IBM Event Streams - Technical Presentation
Kafka with IBM Event Streams - Technical PresentationKafka with IBM Event Streams - Technical Presentation
Kafka with IBM Event Streams - Technical Presentation
Winton Winton
 
The resurgence of event driven architecture
The resurgence of event driven architectureThe resurgence of event driven architecture
The resurgence of event driven architecture
Kim Clark
 
CICDforModernApplications-Oslo.pdf
CICDforModernApplications-Oslo.pdfCICDforModernApplications-Oslo.pdf
CICDforModernApplications-Oslo.pdf
Amazon Web Services
 
Architecture 2020 - eComputing 2019-07-01
Architecture 2020 - eComputing 2019-07-01Architecture 2020 - eComputing 2019-07-01
Architecture 2020 - eComputing 2019-07-01
Jorge Hidalgo
 
AWS Accra Meetup - Developing Modern Applications in the Cloud
AWS Accra Meetup - Developing Modern Applications in the CloudAWS Accra Meetup - Developing Modern Applications in the Cloud
AWS Accra Meetup - Developing Modern Applications in the Cloud
Cobus Bernard
 
[CPT DevOps Meetup] Developing Modern Applications in the Cloud
[CPT DevOps Meetup] Developing Modern Applications in the Cloud[CPT DevOps Meetup] Developing Modern Applications in the Cloud
[CPT DevOps Meetup] Developing Modern Applications in the Cloud
Cobus Bernard
 
AWS Jozi Meetup Developing Modern Applications in the Cloud
AWS Jozi Meetup Developing Modern Applications in the CloudAWS Jozi Meetup Developing Modern Applications in the Cloud
AWS Jozi Meetup Developing Modern Applications in the Cloud
Cobus Bernard
 
How IBM is helping developers win the race to innovate with next-gen cloud se...
How IBM is helping developers win the race to innovate with next-gen cloud se...How IBM is helping developers win the race to innovate with next-gen cloud se...
How IBM is helping developers win the race to innovate with next-gen cloud se...
Michael Elder
 
App Modernization
App ModernizationApp Modernization
App Modernization
PT Datacomm Diangraha
 
CI/CD for Modern Applications
CI/CD for Modern ApplicationsCI/CD for Modern Applications
CI/CD for Modern Applications
Amazon Web Services
 
Creating Microservices Application with IBM Cloud Private (ICP) - introductio...
Creating Microservices Application with IBM Cloud Private (ICP) - introductio...Creating Microservices Application with IBM Cloud Private (ICP) - introductio...
Creating Microservices Application with IBM Cloud Private (ICP) - introductio...
PT Datacomm Diangraha
 
IBM Hybrid Cloud Integration UCC Talk, 23rd November 2021 - Cloud Application...
IBM Hybrid Cloud Integration UCC Talk, 23rd November 2021 - Cloud Application...IBM Hybrid Cloud Integration UCC Talk, 23rd November 2021 - Cloud Application...
IBM Hybrid Cloud Integration UCC Talk, 23rd November 2021 - Cloud Application...
Michael O'Sullivan
 
Jfokus - Reacting to an event-driven world
Jfokus - Reacting to an event-driven worldJfokus - Reacting to an event-driven world
Jfokus - Reacting to an event-driven world
Grace Jansen
 
JSpring Virtual 2020 - Reacting to an event-driven world
JSpring Virtual 2020 - Reacting to an event-driven worldJSpring Virtual 2020 - Reacting to an event-driven world
JSpring Virtual 2020 - Reacting to an event-driven world
Grace Jansen
 
An architect’s guide to leveraging your incumbency
An architect’s guide to leveraging your incumbencyAn architect’s guide to leveraging your incumbency
An architect’s guide to leveraging your incumbency
Michael Elder
 
Agile integration architecture in relation to APIs and messaging
Agile integration architecture in relation to APIs and messagingAgile integration architecture in relation to APIs and messaging
Agile integration architecture in relation to APIs and messaging
Kim Clark
 
IBM Cloud UCC Talk, 8th December 2020 - Cloud Native, Microservices, and Serv...
IBM Cloud UCC Talk, 8th December 2020 - Cloud Native, Microservices, and Serv...IBM Cloud UCC Talk, 8th December 2020 - Cloud Native, Microservices, and Serv...
IBM Cloud UCC Talk, 8th December 2020 - Cloud Native, Microservices, and Serv...
Michael O'Sullivan
 
IBM Cloud Private and IBM Power Systems: Overview and Real-World Scenarios
IBM Cloud Private and IBM Power Systems: Overview and Real-World ScenariosIBM Cloud Private and IBM Power Systems: Overview and Real-World Scenarios
IBM Cloud Private and IBM Power Systems: Overview and Real-World Scenarios
Joe Cropper
 
Trends at JavaOne 2016: Microservices, Docker and Cloud-Native Middleware
Trends at JavaOne 2016: Microservices, Docker and Cloud-Native MiddlewareTrends at JavaOne 2016: Microservices, Docker and Cloud-Native Middleware
Trends at JavaOne 2016: Microservices, Docker and Cloud-Native Middleware
Kai Wähner
 
VJUG - Reacting to an event driven world
VJUG - Reacting to an event driven worldVJUG - Reacting to an event driven world
VJUG - Reacting to an event driven world
Grace Jansen
 

Similar to Event-driven microservices (20)

Kafka with IBM Event Streams - Technical Presentation
Kafka with IBM Event Streams - Technical PresentationKafka with IBM Event Streams - Technical Presentation
Kafka with IBM Event Streams - Technical Presentation
 
The resurgence of event driven architecture
The resurgence of event driven architectureThe resurgence of event driven architecture
The resurgence of event driven architecture
 
CICDforModernApplications-Oslo.pdf
CICDforModernApplications-Oslo.pdfCICDforModernApplications-Oslo.pdf
CICDforModernApplications-Oslo.pdf
 
Architecture 2020 - eComputing 2019-07-01
Architecture 2020 - eComputing 2019-07-01Architecture 2020 - eComputing 2019-07-01
Architecture 2020 - eComputing 2019-07-01
 
AWS Accra Meetup - Developing Modern Applications in the Cloud
AWS Accra Meetup - Developing Modern Applications in the CloudAWS Accra Meetup - Developing Modern Applications in the Cloud
AWS Accra Meetup - Developing Modern Applications in the Cloud
 
[CPT DevOps Meetup] Developing Modern Applications in the Cloud
[CPT DevOps Meetup] Developing Modern Applications in the Cloud[CPT DevOps Meetup] Developing Modern Applications in the Cloud
[CPT DevOps Meetup] Developing Modern Applications in the Cloud
 
AWS Jozi Meetup Developing Modern Applications in the Cloud
AWS Jozi Meetup Developing Modern Applications in the CloudAWS Jozi Meetup Developing Modern Applications in the Cloud
AWS Jozi Meetup Developing Modern Applications in the Cloud
 
How IBM is helping developers win the race to innovate with next-gen cloud se...
How IBM is helping developers win the race to innovate with next-gen cloud se...How IBM is helping developers win the race to innovate with next-gen cloud se...
How IBM is helping developers win the race to innovate with next-gen cloud se...
 
App Modernization
App ModernizationApp Modernization
App Modernization
 
CI/CD for Modern Applications
CI/CD for Modern ApplicationsCI/CD for Modern Applications
CI/CD for Modern Applications
 
Creating Microservices Application with IBM Cloud Private (ICP) - introductio...
Creating Microservices Application with IBM Cloud Private (ICP) - introductio...Creating Microservices Application with IBM Cloud Private (ICP) - introductio...
Creating Microservices Application with IBM Cloud Private (ICP) - introductio...
 
IBM Hybrid Cloud Integration UCC Talk, 23rd November 2021 - Cloud Application...
IBM Hybrid Cloud Integration UCC Talk, 23rd November 2021 - Cloud Application...IBM Hybrid Cloud Integration UCC Talk, 23rd November 2021 - Cloud Application...
IBM Hybrid Cloud Integration UCC Talk, 23rd November 2021 - Cloud Application...
 
Jfokus - Reacting to an event-driven world
Jfokus - Reacting to an event-driven worldJfokus - Reacting to an event-driven world
Jfokus - Reacting to an event-driven world
 
JSpring Virtual 2020 - Reacting to an event-driven world
JSpring Virtual 2020 - Reacting to an event-driven worldJSpring Virtual 2020 - Reacting to an event-driven world
JSpring Virtual 2020 - Reacting to an event-driven world
 
An architect’s guide to leveraging your incumbency
An architect’s guide to leveraging your incumbencyAn architect’s guide to leveraging your incumbency
An architect’s guide to leveraging your incumbency
 
Agile integration architecture in relation to APIs and messaging
Agile integration architecture in relation to APIs and messagingAgile integration architecture in relation to APIs and messaging
Agile integration architecture in relation to APIs and messaging
 
IBM Cloud UCC Talk, 8th December 2020 - Cloud Native, Microservices, and Serv...
IBM Cloud UCC Talk, 8th December 2020 - Cloud Native, Microservices, and Serv...IBM Cloud UCC Talk, 8th December 2020 - Cloud Native, Microservices, and Serv...
IBM Cloud UCC Talk, 8th December 2020 - Cloud Native, Microservices, and Serv...
 
IBM Cloud Private and IBM Power Systems: Overview and Real-World Scenarios
IBM Cloud Private and IBM Power Systems: Overview and Real-World ScenariosIBM Cloud Private and IBM Power Systems: Overview and Real-World Scenarios
IBM Cloud Private and IBM Power Systems: Overview and Real-World Scenarios
 
Trends at JavaOne 2016: Microservices, Docker and Cloud-Native Middleware
Trends at JavaOne 2016: Microservices, Docker and Cloud-Native MiddlewareTrends at JavaOne 2016: Microservices, Docker and Cloud-Native Middleware
Trends at JavaOne 2016: Microservices, Docker and Cloud-Native Middleware
 
VJUG - Reacting to an event driven world
VJUG - Reacting to an event driven worldVJUG - Reacting to an event driven world
VJUG - Reacting to an event driven world
 

More from Andrew Schofield

Technology choices for Apache Kafka and Change Data Capture
Technology choices for Apache Kafka and Change Data CaptureTechnology choices for Apache Kafka and Change Data Capture
Technology choices for Apache Kafka and Change Data Capture
Andrew Schofield
 
IBM Message Hub: Cloud-Native Messaging
IBM Message Hub: Cloud-Native MessagingIBM Message Hub: Cloud-Native Messaging
IBM Message Hub: Cloud-Native Messaging
Andrew Schofield
 
Effectively Managing a Hybrid Messaging Environment
Effectively Managing a Hybrid Messaging EnvironmentEffectively Managing a Hybrid Messaging Environment
Effectively Managing a Hybrid Messaging Environment
Andrew Schofield
 
Introducing IBM Message Hub: Cloud-scale messaging based on Apache Kafka
Introducing IBM Message Hub: Cloud-scale messaging based on Apache KafkaIntroducing IBM Message Hub: Cloud-scale messaging based on Apache Kafka
Introducing IBM Message Hub: Cloud-scale messaging based on Apache Kafka
Andrew Schofield
 
IBM Message Hub service in Bluemix - Apache Kafka in a public cloud
IBM Message Hub service in Bluemix - Apache Kafka in a public cloudIBM Message Hub service in Bluemix - Apache Kafka in a public cloud
IBM Message Hub service in Bluemix - Apache Kafka in a public cloud
Andrew Schofield
 
Ame 2269 ibm mq high availability
Ame 2269 ibm mq high availabilityAme 2269 ibm mq high availability
Ame 2269 ibm mq high availability
Andrew Schofield
 
Ame 4166 ibm mq appliance
Ame 4166 ibm mq applianceAme 4166 ibm mq appliance
Ame 4166 ibm mq appliance
Andrew Schofield
 
Connecting IBM MessageSight to the Enterprise
Connecting IBM MessageSight to the EnterpriseConnecting IBM MessageSight to the Enterprise
Connecting IBM MessageSight to the Enterprise
Andrew Schofield
 
Introduction to IBM MessageSight
Introduction to IBM MessageSightIntroduction to IBM MessageSight
Introduction to IBM MessageSight
Andrew Schofield
 

More from Andrew Schofield (9)

Technology choices for Apache Kafka and Change Data Capture
Technology choices for Apache Kafka and Change Data CaptureTechnology choices for Apache Kafka and Change Data Capture
Technology choices for Apache Kafka and Change Data Capture
 
IBM Message Hub: Cloud-Native Messaging
IBM Message Hub: Cloud-Native MessagingIBM Message Hub: Cloud-Native Messaging
IBM Message Hub: Cloud-Native Messaging
 
Effectively Managing a Hybrid Messaging Environment
Effectively Managing a Hybrid Messaging EnvironmentEffectively Managing a Hybrid Messaging Environment
Effectively Managing a Hybrid Messaging Environment
 
Introducing IBM Message Hub: Cloud-scale messaging based on Apache Kafka
Introducing IBM Message Hub: Cloud-scale messaging based on Apache KafkaIntroducing IBM Message Hub: Cloud-scale messaging based on Apache Kafka
Introducing IBM Message Hub: Cloud-scale messaging based on Apache Kafka
 
IBM Message Hub service in Bluemix - Apache Kafka in a public cloud
IBM Message Hub service in Bluemix - Apache Kafka in a public cloudIBM Message Hub service in Bluemix - Apache Kafka in a public cloud
IBM Message Hub service in Bluemix - Apache Kafka in a public cloud
 
Ame 2269 ibm mq high availability
Ame 2269 ibm mq high availabilityAme 2269 ibm mq high availability
Ame 2269 ibm mq high availability
 
Ame 4166 ibm mq appliance
Ame 4166 ibm mq applianceAme 4166 ibm mq appliance
Ame 4166 ibm mq appliance
 
Connecting IBM MessageSight to the Enterprise
Connecting IBM MessageSight to the EnterpriseConnecting IBM MessageSight to the Enterprise
Connecting IBM MessageSight to the Enterprise
 
Introduction to IBM MessageSight
Introduction to IBM MessageSightIntroduction to IBM MessageSight
Introduction to IBM MessageSight
 

Recently uploaded

Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
abdulrafaychaudhry
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
abdulrafaychaudhry
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
vrstrong314
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 

Recently uploaded (20)

Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 

Event-driven microservices

  • 1. Apache Kafka © 2019 IBM Corporation Event-Driven Microservices Using IBM Apache Kafka Andrew Schofield Chief Architect, Event Streams IBM Hursley Park Event-Driven Architecture meetup
  • 2. © 2019 IBM Corporation What are microservices? Microservices is a technique for structuring an application as a collection of services • Self-contained with clear interfaces and a distinct purpose • Loosely coupled – communicate over a network • Independently deployable, scalable, maintainable and testable Microservices ApplicationMonolithic Application
  • 3. © 2019 IBM Corporation Event-driven microservices Microservices communicate primarily with events, with APIs where required • Microservices can produce and consume events using publish/subscribe messaging • Events are handled by an event backbone • Data is eventually consistentMICROSERVICES APPLICATION API MICROSERVICE MICROSERVICE MICROSERVICE EVENT BACKBONE MICROSERVICE MICROSERVICE MICROSERVICE MICROSERVICE MICROSERVICE API SERVICE DISCOVERY PUBLISH PUBLISH SUBSCRIBE SUBSCRIBE
  • 4. © 2019 IBM Corporation Comparing messaging patterns QUEUE 0 1 2 3 4 5 6 7 CONSUMER CONSUMER CONSUMER PRODUCER PRODUCER TOPIC 0 1 2 3 4 5 6 7 SUBSCRIPTION SUBSCRIPTION PRODUCER PRODUCER CONSUMER CONSUMER CONSUMER POINT-TO-POINT PUBLISH/SUBSCRIBE
  • 5. © 2019 IBM Corporation Apache Kafka is an Open-Source Streaming Platform PUBLISH/SUBSCRIBE Read and write streams of events, like a traditional messaging system PROCESS Support scalable stream processing applications that react to events in real time STORE Store streams of data safely in a distributed, replicated, fault-tolerant cluster https://kafka.apache.org/ Kafka Cluster Producer ProducerProducer Consumer ConsumerConsumer Stream Processor Stream Processor Source Connector Sink Connector
  • 6. © 2019 IBM Corporation Introducing the event backbone EVENT BACKBONE Microservic e Microservic e
  • 7. © 2019 IBM Corporation Introducing the event backbone 1 Building Blocks 1 :: Event sources Microservic e Microservic e EVENT BACKBONE
  • 8. © 2019 IBM Corporation Introducing the event backbone 1 2 Building Blocks 1 :: Event sources 2 :: Stream processing Microservic e Microservic e EVENT BACKBONE
  • 9. © 2019 IBM Corporation Introducing the event backbone 1 2 App 3 Building Blocks 1 :: Event sources 2 :: Stream processing 3 :: Event archive Microservic e Microservic e EVENT BACKBONE
  • 10. © 2019 IBM Corporation Introducing the event backbone App 1 2 3 4 Building Blocks 1 :: Event sources 2 :: Stream processing 3 :: Event archive 4 :: Notifications Microservic e Microservic e EVENT BACKBONE
  • 11. © 2019 IBM Corporation A simple stream processing example EVENT BACKBONE Transactions
  • 12. © 2019 IBM Corporation A simple stream processing example EVENT BACKBONE Transactions Alerts
  • 13. © 2019 IBM Corporation A simple stream processing example EVENT BACKBONE Transactions Alerts SMS alerts Email alerts Push alerts
  • 14. © 2019 IBM Corporation A simple stream processing example EVENT BACKBONE Send SMS Transactions Alerts Send emails Send push notifications SMS alerts Email alerts Push alerts
  • 15. © 2019 IBM Corporation How to get started You could run an event storming workshop https://www.ibm.com/cloud/garage/architectures/eventDrivenArchitecture/event-storming- methodology Identify: Events Actors Data Commands
  • 16. © 2019 IBM Corporation A more complex event-driven example https://ibm-cloud-architecture.github.io/refarch-kc/design/readme/
  • 17. © 2019 IBM Corporation A more complex example – component view Fleet microservice Containers microservice Voyages microservice Orders microservice API API
  • 18. © 2019 IBM Corporation A more complex example – component view Fleet microservice Containers microservice Voyages microservice Orders microservice API API
  • 19. © 2019 IBM Corporation A more complex example – component view EVENT BACKBONE ships containers orders voyages Fleet microservice Containers microservice Voyages microservice Orders microservice API API
  • 20. © 2019 IBM Corporation A more complex example – component view EVENT BACKBONE ships containers problems orders voyages Fleet microservice Containers microservice Voyages microservice Orders microservice Streaming analytics API API
  • 21. © 2019 IBM Corporation Patterns for event-driven microservices You want: Loose coupling Data consistency Efficient queries You need PATTERNS, such as: Database per service Saga Event sourcing CQRS
  • 22. © 2019 IBM Corporation Pattern – Database per service Each microservice persists its own data Protects independence of the microservice against external change Introduces complexity for data consistency across microservices EVENT BACKBONE ships containers problems orders voyages Fleet microservice Containers microservice Voyages microservice Orders microservice
  • 23. © 2019 IBM Corporation Kafka log compaction for data replication 0 key:a val:A1 1 key:b val:B1 2 key:a val:A2 3 key:c val:C1 TOPIC PARTITION 4 key:c val:C2 PRODUCER Consumer takes latest values and builds own data store KEY VALUE a A2 b <deleted> c C2 SOURCE CHANGE LOG Read
  • 24. © 2019 IBM Corporation Kafka log compaction for data replication 0 key:a val:A1 1 key:b val:B1 2 key:a val:A2 3 key:c val:C1 TOPIC PARTITION 4 key:c val:C2 KEY VALUE a A2 b <deleted> c C2 2 key:a val:A2 4 key:b val:C2 TOPIC PARTITION (rewritten) PERIODIC COMPACTION ELIMINATES DUPLICATE KEYS TO MINIMIZE STORAGE
  • 25. © 2019 IBM Corporation Pattern – Sagas Orchestration of multi-step operations across microservices Data consistency across microservices without distributed transactions Programming can be complex, particularly for failure compensation EVENT BACKBONE Fleet microservice Containers microservice Voyages microservice Orders microservice 1 2 3 4 5
  • 26. © 2019 IBM Corporation EVENT BACKBONE Pattern – Event sourcing Every state change to an object is captured as an event stored in sequence Replaying the events in order rebuilds the current state of the objects By subscribing to the events, you get an evolving copy of the objects’ state Query handler Command handler USER Order1 Created Order1 Updated Order2 Created Order1 Complete Order3 Created Order2 Canceled Order3 Updated Order3 Complete
  • 27. © 2019 IBM Corporation Pattern – Event sourcing with Kafka Order2 Created Order2 Updated Order4 Created Order2 Complete Order4 Canceled Order3 Created Order3 Updated Order6 Created Order3 Complete Order3 Created Order6 Updated Order1 Created Order1 Updated Order5 Created Order1 Complete Order7 Created Order5 Canceled Order7 Updated Order7 Complete TOPIC orders PARTITION 0 TOPIC orders PARTITION 1 TOPIC orders PARTITION 2 CONSUMER GROUP A p0, offset 7 p1, offset 3 p2, offset 5 CONSUMER CONSUMER CONSUMER CONSUMER GROUP B p0, offset 7 p1, offset 3 p2, offset 5 CONSUMER CONSUMER
  • 28. © 2019 IBM Corporation Pattern – Command Query Responsibility Segregation (CQRS) Atomic writes and efficient reads at the same time API split into commands (change state) and queries (read only) Complex in practice EVENT BACKBONE 1 2 3 4 5 Fleet MS WRITE MODEL Fleet MS READ MODEL Write-optimized store Read-optimized store Write API Read API
  • 29. © 2019 IBM Corporation Summary Event-driven microservices offer an effective way to build loosely coupled applications Techniques such as event storming can be used to derive the objects, commands and events in an application Patterns such as event sourcing and sagas make the complexity manageable
  • 30. © 2019 IBM Corporation Thank you Andrew Schofield Chief Architect, Event Streams IBM Hursley Park andrew_schofield@uk.ibm.com

Editor's Notes

  1. Why event-driven? Proper loose-coupling means asynchronous communication Enables responsive applications In the real world, things often take time to complete
  2. Kafka is a great choice for the event backbone Publish/subscribe Stream history Partitioning – workload distribution and ordering
  3. Stream processing takes a sequence of data (the stream) and applies a sequence of processing to each element in the stream. Optimised for this continuous, event-at-a-time processing Techniques such as pipelining, or batching of transactions.
  4. Outcome is a design built from loosely coupled microservices linked through an event-driven architecture using one or more event backbones 6-8 people including domain experts and stakeholders – sticky notes, stand up, collaborate Domain event – past tense ”order completed” Actor – users Command – action/decision Data - needed for the commands Phases Domain events, placed on a timeline Commands Data Aggregates – group together related events and commands and data – potential boundary of microservices
  5. Could use Kafka’s stream-table duality which layers a database on topic of a key-value-based stream
  6. https://simplesource.io/simple_sagas_key_concepts.html
  7. write subsystem to publish changes to an event log, and the query subsystem to materialize the views it requires by applying these changes