SlideShare a Scribd company logo
Event-driven microservices
using Apache Kafka
Andrew Schofield
Chief Architect, Event Streams
IBM Hursley Park
© 2019 IBM Corporation
What and why 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
© 2019 IBM Corporation
Microservices ApplicationMonolithic Application
Being event-driven is different
© 2019 IBM Corporation
Source: Gartner - From data-centric to event-centric IT priority
Why event-driven?
• Proper loose coupling means asynchronous communication
• Enables responsive applications
• In the real world, things often take time to complete
© 2019 IBM Corporation
Event-driven microservices
• Microservices communicate primarily
using events, with APIs where required
• Microservices can produce and consume
events using the publish/subscribe
pattern
• Events are handled by an event
backbone
• Data is eventually consistent
© 2019 IBM Corporation
Microservice
Microservice
Microservice
Microservice
Microservice
Event
backbone
Publish
Service
discoveryMicroservice
Microservice
Microservice
Subscribe
Subscribe
API
API
Publish
JSON /
HTTP
JSON / HTTP
Microservices
application
Apache Kafka is an Open-Source Streaming Platform
© 2019 IBM Corporation
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
Event-driven terminology
Event A message usually representing a fact at a particular time
Event stream A continuous, ordered, unbounded sequence of events
Stream processing Computation optimized for continuous processing, often with state
Stream history The historical sequence of the events on an event stream
© 2019 IBM Corporation
Apache Kafka as the event backbone
© 2019 IBM Corporation
Apache Kafka as the event backbone
© 2019 IBM Corporation
Microservice
Microservice
Apache Kafka as the event backbone
© 2019 IBM Corporation
1
Building Blocks
1 :: Event sources
Microservice
Microservice
Apache Kafka as the event backbone
© 2019 IBM Corporation
1
2
Building Blocks
1 :: Event sources
2 :: Stream processing
Microservice
Microservice
Apache Kafka as the event backbone
© 2019 IBM Corporation
1
2 App
3
Building Blocks
1 :: Event sources
2 :: Stream processing
3 :: Event archive
Microservice
Microservice
Apache Kafka as the event backbone
© 2019 IBM Corporation
App
1
2
3
4
Building Blocks
1 :: Event sources
2 :: Stream processing
3 :: Event archive
4 :: Notifications
Microservice
Microservice
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 simple stream processing example
© 2019 IBM Corporation
Event backbone
Transactions
A simple stream processing example
© 2019 IBM Corporation
Event backbone
Transactions
Alerts
A simple stream processing example
© 2019 IBM Corporation
Event backbone
Transactions
Alerts
SMS alerts
Email alerts
Push alerts
A simple stream processing example
© 2019 IBM Corporation
Event backbone
Send SMS
Transactions
Alerts
Send emails
Send push
notifications
SMS alerts
Email alerts
Push alerts
© 2019 IBM Corporation
A more complex event-driven example
https://ibm-cloud-architecture.github.io/refarch-kc/design/readme/
A more complex example – component view
© 2019 IBM Corporation
Fleet
microservice
Containers
microservice
Voyages
microservice
Orders
microservice
APIAPI
A more complex example – component view
© 2019 IBM Corporation
Fleet
microservice
Containers
microservice
Voyages
microservice
Orders
microservice
APIAPI
A more complex example – component view
© 2019 IBM Corporation
Event backbone
ships containers orders voyages
Fleet
microservice
Containers
microservice
Voyages
microservice
Orders
microservice
APIAPI
A more complex example – component view
© 2019 IBM Corporation
Event backbone
ships containers problems orders voyages
Fleet
microservice
Containers
microservice
Voyages
microservice
Orders
microservice
Streaming
analytics
APIAPI
Patterns for event-driven microservices
• You want:
• Loose coupling
• Data consistency
• Efficient queries
© 2019 IBM Corporation
Patterns for event-driven microservices
• You want:
• Loose coupling
• Data consistency
• Efficient queries
• You don’t want:
• Chaos
© 2019 IBM Corporation
Patterns for event-driven microservices
• You want:
• Loose coupling
• Data consistency
• Efficient queries
• You don’t want:
• Chaos
• You need PATTERNS
© 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
© 2019 IBM Corporation
0
key:a
val:A1
1
key:b
val:B1
2
key:a
val:A2
3
key:c
val:C1
Partition 0
4
key:c
val:C2
5
key:b
val:
Producer
writes
Consumer
takes latest
values and
builds own
data store
reads
Key Value
a A2
b <deleted>
c C2
Old New
Source change log Read
Kafka log compaction for data replication
© 2019 IBM Corporation
0
key:a
val:A1
1
key:b
val:B1
2
key:a
val:A2
3
key:c
val:C1
Partition 0
4
key:c
val:C2
5
key:b
val:
2
key:a
val:A2
4
key:c
val:C2
5
key:b
val:
Periodic compaction eliminates duplicate keys
to minimize storage
Partition 0
(rewritten)
Key Value
a A2
b <deleted>
c C2
Pattern – Event sourcing
• Every state change is captured as an event stored in sequence
+ Publishing events is atomic
- Event store is hard to query efficiently
© 2019 IBM Corporation
OrderCreated
OrderUpdated
OrderUpdated
OrderConfirmed
OrderShipped
OrderDelivered
OrderInTransit
Orders
microservice
Orders
DB
Command
handler
USER
Time
OrderPending
OrderBooked
OrderAssigned
Pattern – Sagas
• Orchestration of multi-step operations across microservices
+ Data consistency across microservices without distributed transactions
- Programming can be complex, particularly for failure compensation
© 2019 IBM Corporation
Event backbone
Fleet
microservice
Containers
microservice
Voyages
microservice
Orders
microservice
1 2 3 4 5
Pattern – CQRS
• Command Query Responsibility Segregation
+ Atomic writes and efficient reads at the same time
- Complex to program correctly
© 2019 IBM Corporation
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
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
Event driven microservices

More Related Content

What's hot

Kafka 101
Kafka 101Kafka 101
Kafka 101
Clement Demonchy
 
Event-driven architecture
Event-driven architectureEvent-driven architecture
Event-driven architecture
Andrew Easter
 
Service Mesh with Apache Kafka, Kubernetes, Envoy, Istio and Linkerd
Service Mesh with Apache Kafka, Kubernetes, Envoy, Istio and LinkerdService Mesh with Apache Kafka, Kubernetes, Envoy, Istio and Linkerd
Service Mesh with Apache Kafka, Kubernetes, Envoy, Istio and Linkerd
Kai Wähner
 
CQRS + Event Sourcing
CQRS + Event SourcingCQRS + Event Sourcing
CQRS + Event Sourcing
Mike Bild
 
Kafka 101
Kafka 101Kafka 101
Kafka 101
Aparna Pillai
 
Event Storming and Saga
Event Storming and SagaEvent Storming and Saga
Event Storming and Saga
Araf Karsh Hamid
 
RabbitMQ & Kafka
RabbitMQ & KafkaRabbitMQ & Kafka
RabbitMQ & Kafka
VMware Tanzu
 
Lessons Learned Building a Connector Using Kafka Connect (Katherine Stanley &...
Lessons Learned Building a Connector Using Kafka Connect (Katherine Stanley &...Lessons Learned Building a Connector Using Kafka Connect (Katherine Stanley &...
Lessons Learned Building a Connector Using Kafka Connect (Katherine Stanley &...
confluent
 
Introduction To RabbitMQ
Introduction To RabbitMQIntroduction To RabbitMQ
Introduction To RabbitMQ
Knoldus Inc.
 
Fundamentals and Architecture of Apache Kafka
Fundamentals and Architecture of Apache KafkaFundamentals and Architecture of Apache Kafka
Fundamentals and Architecture of Apache Kafka
Angelo Cesaro
 
Clustering, Server setup and Hybrid deployment setup using Anypoint Runtime M...
Clustering, Server setup and Hybrid deployment setup using Anypoint Runtime M...Clustering, Server setup and Hybrid deployment setup using Anypoint Runtime M...
Clustering, Server setup and Hybrid deployment setup using Anypoint Runtime M...
Manish Kumar Yadav
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
Saroj Panyasrivanit
 
Azure API Management
Azure API ManagementAzure API Management
Azure API Management
Daniel Toomey
 
Micro services vs Monolith Architecture
Micro services vs Monolith ArchitectureMicro services vs Monolith Architecture
Micro services vs Monolith Architecture
MohamedElGohary71
 
Microservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SREMicroservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SRE
Araf Karsh Hamid
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
Amazon Web Services
 
Stream Processing with Apache Kafka and .NET
Stream Processing with Apache Kafka and .NETStream Processing with Apache Kafka and .NET
Stream Processing with Apache Kafka and .NET
confluent
 
Event Driven Architecture (EDA) Reference Architecture
Event Driven Architecture (EDA) Reference ArchitectureEvent Driven Architecture (EDA) Reference Architecture
Event Driven Architecture (EDA) Reference Architecture
Bob Rhubart
 
Streaming all over the world Real life use cases with Kafka Streams
Streaming all over the world  Real life use cases with Kafka StreamsStreaming all over the world  Real life use cases with Kafka Streams
Streaming all over the world Real life use cases with Kafka Streams
confluent
 
Apache Kafka vs. Integration Middleware (MQ, ETL, ESB) - Friends, Enemies or ...
Apache Kafka vs. Integration Middleware (MQ, ETL, ESB) - Friends, Enemies or ...Apache Kafka vs. Integration Middleware (MQ, ETL, ESB) - Friends, Enemies or ...
Apache Kafka vs. Integration Middleware (MQ, ETL, ESB) - Friends, Enemies or ...
confluent
 

What's hot (20)

Kafka 101
Kafka 101Kafka 101
Kafka 101
 
Event-driven architecture
Event-driven architectureEvent-driven architecture
Event-driven architecture
 
Service Mesh with Apache Kafka, Kubernetes, Envoy, Istio and Linkerd
Service Mesh with Apache Kafka, Kubernetes, Envoy, Istio and LinkerdService Mesh with Apache Kafka, Kubernetes, Envoy, Istio and Linkerd
Service Mesh with Apache Kafka, Kubernetes, Envoy, Istio and Linkerd
 
CQRS + Event Sourcing
CQRS + Event SourcingCQRS + Event Sourcing
CQRS + Event Sourcing
 
Kafka 101
Kafka 101Kafka 101
Kafka 101
 
Event Storming and Saga
Event Storming and SagaEvent Storming and Saga
Event Storming and Saga
 
RabbitMQ & Kafka
RabbitMQ & KafkaRabbitMQ & Kafka
RabbitMQ & Kafka
 
Lessons Learned Building a Connector Using Kafka Connect (Katherine Stanley &...
Lessons Learned Building a Connector Using Kafka Connect (Katherine Stanley &...Lessons Learned Building a Connector Using Kafka Connect (Katherine Stanley &...
Lessons Learned Building a Connector Using Kafka Connect (Katherine Stanley &...
 
Introduction To RabbitMQ
Introduction To RabbitMQIntroduction To RabbitMQ
Introduction To RabbitMQ
 
Fundamentals and Architecture of Apache Kafka
Fundamentals and Architecture of Apache KafkaFundamentals and Architecture of Apache Kafka
Fundamentals and Architecture of Apache Kafka
 
Clustering, Server setup and Hybrid deployment setup using Anypoint Runtime M...
Clustering, Server setup and Hybrid deployment setup using Anypoint Runtime M...Clustering, Server setup and Hybrid deployment setup using Anypoint Runtime M...
Clustering, Server setup and Hybrid deployment setup using Anypoint Runtime M...
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 
Azure API Management
Azure API ManagementAzure API Management
Azure API Management
 
Micro services vs Monolith Architecture
Micro services vs Monolith ArchitectureMicro services vs Monolith Architecture
Micro services vs Monolith Architecture
 
Microservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SREMicroservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SRE
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Stream Processing with Apache Kafka and .NET
Stream Processing with Apache Kafka and .NETStream Processing with Apache Kafka and .NET
Stream Processing with Apache Kafka and .NET
 
Event Driven Architecture (EDA) Reference Architecture
Event Driven Architecture (EDA) Reference ArchitectureEvent Driven Architecture (EDA) Reference Architecture
Event Driven Architecture (EDA) Reference Architecture
 
Streaming all over the world Real life use cases with Kafka Streams
Streaming all over the world  Real life use cases with Kafka StreamsStreaming all over the world  Real life use cases with Kafka Streams
Streaming all over the world Real life use cases with Kafka Streams
 
Apache Kafka vs. Integration Middleware (MQ, ETL, ESB) - Friends, Enemies or ...
Apache Kafka vs. Integration Middleware (MQ, ETL, ESB) - Friends, Enemies or ...Apache Kafka vs. Integration Middleware (MQ, ETL, ESB) - Friends, Enemies or ...
Apache Kafka vs. Integration Middleware (MQ, ETL, ESB) - Friends, Enemies or ...
 

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
 
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
 
CICDforModernApplications-Oslo.pdf
CICDforModernApplications-Oslo.pdfCICDforModernApplications-Oslo.pdf
CICDforModernApplications-Oslo.pdf
Amazon Web Services
 
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
 
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
 
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
 
Streaming Sensor Data Slides_Virender
Streaming Sensor Data Slides_VirenderStreaming Sensor Data Slides_Virender
Streaming Sensor Data Slides_Virendervithakur
 
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
 
Developing for Hybrid Cloud with Bluemix
Developing for Hybrid Cloud with BluemixDeveloping for Hybrid Cloud with Bluemix
Developing for Hybrid Cloud with Bluemix
Roberto Pozzi
 
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
 
IBM Cloud Integration Platform Introduction - Integration Tech Conference
IBM Cloud Integration Platform Introduction - Integration Tech ConferenceIBM Cloud Integration Platform Introduction - Integration Tech Conference
IBM Cloud Integration Platform Introduction - Integration Tech Conference
Robert Nicholson
 
Introduction to Serverless Computing - OOP Munich
 Introduction to Serverless Computing - OOP Munich Introduction to Serverless Computing - OOP Munich
Introduction to Serverless Computing - OOP Munich
Boaz Ziniman
 
Modern Applications Development on AWS
Modern Applications Development on AWSModern Applications Development on AWS
Modern Applications Development on AWS
Boaz Ziniman
 
App Modernization
App ModernizationApp Modernization
App Modernization
PT Datacomm Diangraha
 
IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014
IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014
IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014
IBM France Lab
 
Open Standards Enabling Digital Transformation
Open Standards Enabling Digital TransformationOpen Standards Enabling Digital Transformation
Open Standards Enabling Digital Transformation
Solace
 
CI/CD for Modern Applications
CI/CD for Modern ApplicationsCI/CD for Modern Applications
CI/CD for Modern Applications
Amazon Web Services
 
Mythical Mysfits - Build & collaborate on a modern web application on AWS - M...
Mythical Mysfits - Build & collaborate on a modern web application on AWS - M...Mythical Mysfits - Build & collaborate on a modern web application on AWS - M...
Mythical Mysfits - Build & collaborate on a modern web application on AWS - M...
Amazon Web Services
 
Sharing and Deploying Data Science with KNIME Server
Sharing and Deploying Data Science with KNIME ServerSharing and Deploying Data Science with KNIME Server
Sharing and Deploying Data Science with KNIME Server
KNIMESlides
 
IBM Relay 2015: Opening Keynote
IBM Relay 2015: Opening Keynote IBM Relay 2015: Opening Keynote
IBM Relay 2015: Opening Keynote
IBM
 

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
 
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...
 
CICDforModernApplications-Oslo.pdf
CICDforModernApplications-Oslo.pdfCICDforModernApplications-Oslo.pdf
CICDforModernApplications-Oslo.pdf
 
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...
 
The resurgence of event driven architecture
The resurgence of event driven architectureThe resurgence of event driven architecture
The resurgence of event driven architecture
 
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...
 
Streaming Sensor Data Slides_Virender
Streaming Sensor Data Slides_VirenderStreaming Sensor Data Slides_Virender
Streaming Sensor Data Slides_Virender
 
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
 
Developing for Hybrid Cloud with Bluemix
Developing for Hybrid Cloud with BluemixDeveloping for Hybrid Cloud with Bluemix
Developing for Hybrid Cloud with Bluemix
 
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
 
IBM Cloud Integration Platform Introduction - Integration Tech Conference
IBM Cloud Integration Platform Introduction - Integration Tech ConferenceIBM Cloud Integration Platform Introduction - Integration Tech Conference
IBM Cloud Integration Platform Introduction - Integration Tech Conference
 
Introduction to Serverless Computing - OOP Munich
 Introduction to Serverless Computing - OOP Munich Introduction to Serverless Computing - OOP Munich
Introduction to Serverless Computing - OOP Munich
 
Modern Applications Development on AWS
Modern Applications Development on AWSModern Applications Development on AWS
Modern Applications Development on AWS
 
App Modernization
App ModernizationApp Modernization
App Modernization
 
IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014
IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014
IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014
 
Open Standards Enabling Digital Transformation
Open Standards Enabling Digital TransformationOpen Standards Enabling Digital Transformation
Open Standards Enabling Digital Transformation
 
CI/CD for Modern Applications
CI/CD for Modern ApplicationsCI/CD for Modern Applications
CI/CD for Modern Applications
 
Mythical Mysfits - Build & collaborate on a modern web application on AWS - M...
Mythical Mysfits - Build & collaborate on a modern web application on AWS - M...Mythical Mysfits - Build & collaborate on a modern web application on AWS - M...
Mythical Mysfits - Build & collaborate on a modern web application on AWS - M...
 
Sharing and Deploying Data Science with KNIME Server
Sharing and Deploying Data Science with KNIME ServerSharing and Deploying Data Science with KNIME Server
Sharing and Deploying Data Science with KNIME Server
 
IBM Relay 2015: Opening Keynote
IBM Relay 2015: Opening Keynote IBM Relay 2015: Opening Keynote
IBM Relay 2015: Opening Keynote
 

Recently uploaded

GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
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
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
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
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
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
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
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
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 

Recently uploaded (20)

GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
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
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
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
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
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)
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 

Event driven microservices

  • 1. Event-driven microservices using Apache Kafka Andrew Schofield Chief Architect, Event Streams IBM Hursley Park © 2019 IBM Corporation
  • 2. What and why 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 © 2019 IBM Corporation Microservices ApplicationMonolithic Application
  • 3. Being event-driven is different © 2019 IBM Corporation Source: Gartner - From data-centric to event-centric IT priority
  • 4. Why event-driven? • Proper loose coupling means asynchronous communication • Enables responsive applications • In the real world, things often take time to complete © 2019 IBM Corporation
  • 5. Event-driven microservices • Microservices communicate primarily using events, with APIs where required • Microservices can produce and consume events using the publish/subscribe pattern • Events are handled by an event backbone • Data is eventually consistent © 2019 IBM Corporation Microservice Microservice Microservice Microservice Microservice Event backbone Publish Service discoveryMicroservice Microservice Microservice Subscribe Subscribe API API Publish JSON / HTTP JSON / HTTP Microservices application
  • 6. Apache Kafka is an Open-Source Streaming Platform © 2019 IBM Corporation 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
  • 7. Event-driven terminology Event A message usually representing a fact at a particular time Event stream A continuous, ordered, unbounded sequence of events Stream processing Computation optimized for continuous processing, often with state Stream history The historical sequence of the events on an event stream © 2019 IBM Corporation
  • 8. Apache Kafka as the event backbone © 2019 IBM Corporation
  • 9. Apache Kafka as the event backbone © 2019 IBM Corporation Microservice Microservice
  • 10. Apache Kafka as the event backbone © 2019 IBM Corporation 1 Building Blocks 1 :: Event sources Microservice Microservice
  • 11. Apache Kafka as the event backbone © 2019 IBM Corporation 1 2 Building Blocks 1 :: Event sources 2 :: Stream processing Microservice Microservice
  • 12. Apache Kafka as the event backbone © 2019 IBM Corporation 1 2 App 3 Building Blocks 1 :: Event sources 2 :: Stream processing 3 :: Event archive Microservice Microservice
  • 13. Apache Kafka as the event backbone © 2019 IBM Corporation App 1 2 3 4 Building Blocks 1 :: Event sources 2 :: Stream processing 3 :: Event archive 4 :: Notifications Microservice Microservice
  • 14. 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
  • 15. A simple stream processing example © 2019 IBM Corporation Event backbone Transactions
  • 16. A simple stream processing example © 2019 IBM Corporation Event backbone Transactions Alerts
  • 17. A simple stream processing example © 2019 IBM Corporation Event backbone Transactions Alerts SMS alerts Email alerts Push alerts
  • 18. A simple stream processing example © 2019 IBM Corporation Event backbone Send SMS Transactions Alerts Send emails Send push notifications SMS alerts Email alerts Push alerts
  • 19. © 2019 IBM Corporation A more complex event-driven example https://ibm-cloud-architecture.github.io/refarch-kc/design/readme/
  • 20. A more complex example – component view © 2019 IBM Corporation Fleet microservice Containers microservice Voyages microservice Orders microservice APIAPI
  • 21. A more complex example – component view © 2019 IBM Corporation Fleet microservice Containers microservice Voyages microservice Orders microservice APIAPI
  • 22. A more complex example – component view © 2019 IBM Corporation Event backbone ships containers orders voyages Fleet microservice Containers microservice Voyages microservice Orders microservice APIAPI
  • 23. A more complex example – component view © 2019 IBM Corporation Event backbone ships containers problems orders voyages Fleet microservice Containers microservice Voyages microservice Orders microservice Streaming analytics APIAPI
  • 24. Patterns for event-driven microservices • You want: • Loose coupling • Data consistency • Efficient queries © 2019 IBM Corporation
  • 25. Patterns for event-driven microservices • You want: • Loose coupling • Data consistency • Efficient queries • You don’t want: • Chaos © 2019 IBM Corporation
  • 26. Patterns for event-driven microservices • You want: • Loose coupling • Data consistency • Efficient queries • You don’t want: • Chaos • You need PATTERNS © 2019 IBM Corporation
  • 27. 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
  • 28. Kafka log compaction for data replication © 2019 IBM Corporation 0 key:a val:A1 1 key:b val:B1 2 key:a val:A2 3 key:c val:C1 Partition 0 4 key:c val:C2 5 key:b val: Producer writes Consumer takes latest values and builds own data store reads Key Value a A2 b <deleted> c C2 Old New Source change log Read
  • 29. Kafka log compaction for data replication © 2019 IBM Corporation 0 key:a val:A1 1 key:b val:B1 2 key:a val:A2 3 key:c val:C1 Partition 0 4 key:c val:C2 5 key:b val: 2 key:a val:A2 4 key:c val:C2 5 key:b val: Periodic compaction eliminates duplicate keys to minimize storage Partition 0 (rewritten) Key Value a A2 b <deleted> c C2
  • 30. Pattern – Event sourcing • Every state change is captured as an event stored in sequence + Publishing events is atomic - Event store is hard to query efficiently © 2019 IBM Corporation OrderCreated OrderUpdated OrderUpdated OrderConfirmed OrderShipped OrderDelivered OrderInTransit Orders microservice Orders DB Command handler USER Time OrderPending OrderBooked OrderAssigned
  • 31. Pattern – Sagas • Orchestration of multi-step operations across microservices + Data consistency across microservices without distributed transactions - Programming can be complex, particularly for failure compensation © 2019 IBM Corporation Event backbone Fleet microservice Containers microservice Voyages microservice Orders microservice 1 2 3 4 5
  • 32. Pattern – CQRS • Command Query Responsibility Segregation + Atomic writes and efficient reads at the same time - Complex to program correctly © 2019 IBM Corporation 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
  • 33. 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