SlideShare ist ein Scribd-Unternehmen logo
1 von 66
© 2020 IBM Corporation
Reacting to an Event-Driven World
GraceJansen and KateStanley
The never-ending growth of data
© 2020 IBM Corporation
https://www.researchgate.net/figure/The-growth-of-structured-versus-unstructured-data-over-the-past-decade-41_fig1_335927263
The never-ending growth of data
© 2020 IBM Corporation
https://www.researchgate.net/figure/The-growth-of-structured-versus-unstructured-data-over-the-past-decade-41_fig1_335927263
Customer demand for responsive, real-time applications
© 2020 IBM Corporation
Apps must react to events in real
time, as they happen
Apps must deliver responsive
customer experiences
Apps enhanced with real-time
intelligence
Now for an example, let’s get some coffee!
© 2020 IBM Corporation
© 2020 IBM Corporation
https://github.com/cescoffier/quarkus-coffeeshop-demo
Barista Example:
© 2020 IBM Corporation
Coffee Shop
Barista
Coffee Lovers
HTTP
Barista Example:
© 2020 IBM Corporation
Coffee Shop
Coffee Shop
Barista
Barista
Board
Coffee Lovers
Coffee Lovers
HTTP
Orders,
Queue
Event
Backbone
HTTP
HTTP
© 2020 IBM Corporation
Q: Is your microservice system non-
blocking and highly responsive?
© 2020 IBM Corporation
Q: Is your microservice system non-
blocking and highly responsive?
A:Yes I’m using Kafka!
© 2020 IBM Corporation
Q: Is your microservice system non-
blocking and highly responsive?
A:Yes I’m using Kafka!
© 2020 IBM Corporation
Futures
RxJava
Reactive
Streams
Futures
RxJava
Reactive
Streams
Futures
RxJava
Reactive
Streams
Microservice 2
Microservice 3
Microservice 1
How do we make a highly responsive app?
© 2020 IBM Corporation
Futures
RxJava
Reactive
Streams
Futures
RxJava
Reactive
Streams
Futures
RxJava
Reactive
Streams
Microservice 2
Microservice 3
Microservice 1
Reactive
Programming
How do we make a highly responsive app?
© 2020 IBM Corporation
Futures
RxJava
Reactive
Streams
Futures
RxJava
Reactive
Streams
Futures
RxJava
Reactive
Streams
Microservice 2
Microservice 3
Microservice 1
Reactive
Programming
Reactive
Systems
How do we make a highly responsive app?
Reactive Programming
© 2020 IBM Corporation
A subset of asynchronous programming and a paradigm where the
availability of new information drives the logic forward rather
than having control flow driven by a thread-of-execution.
Reactive Programming Patterns
© 2020 IBM Corporation
Futures: a promise to hold the result of some operation once that operation completes
RxJava: a JavaVM implementation of ReactiveX (Reactive Extensions): a library for
composing asynchronous and event-based programs by using observable sequences.
Reactive Streams: a programming concept for handling asynchronous data streams
in a non-blocking manner while providing backpressure to stream publishers
Reactive Manifesto
© 2020 IBM Corporation
ResilientElastic
Message-
Driven
Responsive
Reactive Architecture design patterns
CQRS Event Sourcing Saga Sharding
© 2020 IBM Corporation
APP
WRITE API
APP
READ API
APP
APP
APP
APP
APP
APP
How do I configure Kafka for a reactive
system?
© 2020 IBM Corporation
Apache Kafka is an open source, distributed
streaming platform
© 2020 IBM Corporation
Publish and subscribe to streams of
records
Store records in durable way
Process streams of records as they
occur
Event-Driven vs Message-Driven
© 2020 IBM Corporation
ResilientElastic
Message-
Driven
Responsive
Reactive Systems rely
on asynchronous message-passing
© 2020 IBM Corporation
Messages
“An item of data sent to a specific location.”
A message can contain an encoded event in
its payload.
Events
“A signal emitted by a component upon
reaching a given state.”
© 2020 IBM Corporation
Resiliency in Kafka
© 2020 IBM Corporation
ResilientElastic
Message-
Driven
Responsive
Resilient
© 2020 IBM Corporation
Resilient
© 2020 IBM Corporation
Resilient
© 2020 IBM Corporation
Resilient
© 2020 IBM Corporation
KAFKA CLIENTS
Resilient
Topic A
Partition 1
Broker 1
© 2020 IBM Corporation
Resilient
Topic A
Partition 1
Broker 1
Topic A
Partition 1
Offline Leader
KAFKA CLIENTS
© 2020 IBM Corporation
Resilient producers Guarantees in Kafka:
At most once
At least once
Configuration in producers
Acks
Retries
© 2020 IBM Corporation
The producer doing a
“fire-and-forget”
isn’t good enough
Resilient consumers Consumer offsets
Commit offset:
Manually or automatically
© 2020 IBM Corporation
If a consumer dies it needs to know where
to pick up from again
0 1 2 3 4 5
Offset
Baristas with auto commit
Barista
TOPIC
Coffee Cappuccino Latte
Baristas with auto commit
Barista
TOPIC
Coffee Cappuccino Latte
Coffee
Baristas with auto commit
Barista
TOPIC
Coffee Cappuccino Latte
Coffee
Baristas with auto commit
Barista
TOPIC
Coffee Cappuccino Latte
Baristas with auto commit
Barista
TOPIC
Coffee Cappuccino Latte
Cappuccino
Baristas with auto commit
Barista
TOPIC
Coffee Cappuccino Latte
Cappuccino Latte
Baristas with auto commit
Barista
TOPIC
Coffee Cappuccino Latte
Cappuccino Latte
Baristas with manual commit
Coffee Cappuccino Latte
TOPIC
Barista
Baristas with auto commit
Barista
TOPIC
Coffee Cappuccino Latte
Cappuccino Latte
Baristas with manual commit
Coffee Cappuccino Latte
TOPIC
Barista
Coffee
Baristas with auto commit
Barista
TOPIC
Coffee Cappuccino Latte
Cappuccino Latte
Baristas with manual commit
Coffee Cappuccino Latte
TOPIC
Barista
Coffee
Baristas with auto commit
Barista
TOPIC
Coffee Cappuccino Latte
Cappuccino Latte
Baristas with manual commit
Coffee Cappuccino Latte
TOPIC
Barista
Coffee Latte Cappuccino
Scalability in Kafka
© 2020 IBM Corporation
ResilientElastic
Message-
Driven
Responsive
Partitions
© 2020 IBM Corporation
Topics and Keys
0 1 2 3
TOPIC
0 1 2 3
0 1 2 3
PARTITION 0
PARTITION 1
PARTITION 2
key:a
val:A1
© 2020 IBM Corporation
Consumer Groups
© 2020 IBM Corporation
© 2019 IBM Corporation
Consumer Groups
CONSUMER GROUP A
p0, offset 7
p1, offset 3
p2, offset 5
TOPIC
0 1 2 3
0 1 2 3 4 5
PARTITION 0
PARTITION 1
PARTITION 2
0 1 2 3 4 5 6 7
CONSUMER
CONSUMER
CONSUMER
CONSUMER GROUP B
p0, offset 7
p1, offset 3
p2, offset 5
CONSUMER
CONSUMER
© 2019 IBM Corporation
© 2019 IBM Corporation
Consumer Groups
CONSUMER GROUP A
p0, offset 7
p1, offset 3
p2, offset 5
TOPIC
0 1 2 3
0 1 2 3 4 5
PARTITION 0
PARTITION 1
PARTITION 2
0 1 2 3 4 5 6 7
CONSUMER
CONSUMER
CONSUMER
CONSUMER GROUP B
p0, offset 7
p1, offset 3
p2, offset 5
CONSUMER
CONSUMER
© 2019 IBM Corporation
© 2019 IBM Corporation
Consumer Groups
CONSUMER GROUP A
p0, offset 7
p1, offset 3
p2, offset 5
TOPIC
0 1 2 3
0 1 2 3 4 5
PARTITION 0
PARTITION 1
PARTITION 2
0 1 2 3 4 5 6 7
CONSUMER
CONSUMER
CONSUMER
CONSUMER GROUP B
p0, offset 7
p1, offset 3
p2, offset 5
CONSUMER
CONSUMER
© 2019 IBM Corporation
© 2019 IBM Corporation
Consumer Groups
CONSUMER GROUP A
p0, offset 7
p1, offset 3
p2, offset 5
TOPIC
0 1 2 3
0 1 2 3 4 5
PARTITION 0
PARTITION 1
PARTITION 2
0 1 2 3 4 5 6 7
CONSUMER
CONSUMER
CONSUMER
CONSUMER
CONSUMER GROUP B
p0, offset 7
p1, offset 3
p2, offset 5
CONSUMER
CONSUMER
© 2019 IBM Corporation
How do we get started?
© 2020 IBM Corporation https://kafka.apache.org/quickstart
© 2020 IBM Corporation
Reactive Frameworks for Kafka
Spring Reactor Kafka MicroProfile Reactive
Messaging
Alpakka Kafka
Connector
Vert.x Kafka Client
© 2020 IBM Corporation
Spring Reactor Kafka
© 2020 IBM Corporation
Reactor Kafka is a thin layer of
reactive streams over Kafka
client
Hides the complexity of Kafka
Built-in backpressure support
MicroProfile Reactive Messaging
© 2020 IBM Corporation
This specification provides asynchronous messaging support based on Reactive Streams for
MicroProfile.
Implementations include:
• SmallRye Reactive Messaging 1.0.0
• Open Liberty 19.0.0.9 (via SmallRye)
• Quarkus 1.0.0.Final (via SmallRye)
• WebSphere Liberty 19.0.0.9 (via SmallRye)
Reactive Messaging uses a model of annotated methods which are connected by named channels.
Alpakka Kafka Connector
© 2020 IBM Corporation
Enables connection between Apache Kafka and Akka Streams.
Hides complexity of Kafka
Built-in backpressure support
Akka Streams uses Akka actors as its foundation
What is Vert.x?
Polyglot Framework
Based on Reactor pattern
Runs on the JVM
Non-blocking
Event-driven
Includes distributed event-bus
Code is single-threaded
© 2020 IBM Corporation
Demo app
© 2020 IBM Corporation
https://github.com/ibm-messaging/kafka-java-vertx-starter
Vert.x app
websocket
produce
consume
org.apache.kafka.clients.producer.KafkaProducer<K, V>
© 2020 IBM Corporation
for (int i = 0; i < 100; i++) {
ProducerRecord<String, String> producerRecord =
new ProducerRecord<>(“my-topic”, Integer.toString(i));
producer.send(producerRecord);
}
Vert.x Kafka Client - Producer
© 2020 IBM Corporation
for (int i = 0; i < 100; i++) {
KafkaProducerRecord<String, String> producerRecord =
KafkaProducerRecord.create(“my-topic”, Integer.toString(i));
producer.write(producerRecord);
}
org.apache.kafka.clients.consumer.KafkaConsumer<K, V>
© 2020 IBM Corporation
while (true) {
ConsumerRecords<String, String> records = consumer.poll(100);
for (ConsumerRecord<String, String> record : records) {
processRecord(record);
consumer.commit();
}
}
Vert.x Kafka Client - Consumer
© 2020 IBM Corporation
consumer.handler(record -> {
processRecord(record, processResult -> {
consumer.commit(record.offset(), commitResult -> {
// handle outcome
});
});
});
Summary
Building reactive can help you!
Kafka is useful, but think carefully when
designing your system
You are not alone! Lots of reactive
frameworks to help you along the way
© 2020 IBM Corporation
Reactive Systems Explained
© 2020 IBM Corporation
ibm.biz/ReactiveReport
Thank you
Kate Stanley | @katestanley91
Grace Jansen | @gracejansen27
© 2019 IBM Corporation IBM Event Streams: ibm.biz/aboutEventStreams
Reactive Manifesto:
https://www.reactivemanifesto.org
Getting started with Kafka:
https://kafka.apache.org/quickstart
https://strimzi.io
Starter app
https://github.com/ibm-messaging/kafka-java-vertx-starter
Reactive Kafka libraries
https://vertx.io/docs/vertx-kafka-client/java/
https://github.com/eclipse/microprofile-reactive-
messaging
https://projectreactor.io/docs/kafka
https://github.com/akka/alpakka-kafka

Weitere ähnliche Inhalte

Was ist angesagt?

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
 
IBM SmartCloud and ISVs September 2013 (Softlayer)
IBM SmartCloud and ISVs September 2013 (Softlayer)IBM SmartCloud and ISVs September 2013 (Softlayer)
IBM SmartCloud and ISVs September 2013 (Softlayer)
Simon Baker
 

Was ist angesagt? (20)

Cloud K5 Services_Description
Cloud K5 Services_DescriptionCloud K5 Services_Description
Cloud K5 Services_Description
 
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
 
IBM SmartCloud and ISVs September 2013 (Softlayer)
IBM SmartCloud and ISVs September 2013 (Softlayer)IBM SmartCloud and ISVs September 2013 (Softlayer)
IBM SmartCloud and ISVs September 2013 (Softlayer)
 
VMware Cloud on AWS The Fast Path to a Hybrid Cloud for Public Sector Organis...
VMware Cloud on AWS The Fast Path to a Hybrid Cloud for Public Sector Organis...VMware Cloud on AWS The Fast Path to a Hybrid Cloud for Public Sector Organis...
VMware Cloud on AWS The Fast Path to a Hybrid Cloud for Public Sector Organis...
 
VMware Cloud on AWS - The Next-Generation Hybrid Cloud
VMware Cloud on AWS - The Next-Generation Hybrid CloudVMware Cloud on AWS - The Next-Generation Hybrid Cloud
VMware Cloud on AWS - The Next-Generation Hybrid Cloud
 
#8311: Transform the Enterprise with IBM Cloud Private
#8311: Transform the Enterprise with IBM Cloud Private#8311: Transform the Enterprise with IBM Cloud Private
#8311: Transform the Enterprise with IBM Cloud Private
 
Lessons learned: Use of Modern JVM Languages besides Java - JavaOne 2012
Lessons learned: Use of Modern JVM Languages besides Java - JavaOne 2012Lessons learned: Use of Modern JVM Languages besides Java - JavaOne 2012
Lessons learned: Use of Modern JVM Languages besides Java - JavaOne 2012
 
Enabling Mainframe Assets for API Economy with z?OS Connect EE
Enabling Mainframe Assets for API Economy with z?OS Connect EEEnabling Mainframe Assets for API Economy with z?OS Connect EE
Enabling Mainframe Assets for API Economy with z?OS Connect EE
 
Fault tolerant and scalable ibm mq
Fault tolerant and scalable ibm mqFault tolerant and scalable ibm mq
Fault tolerant and scalable ibm mq
 
Multi-Cloud Load Balancing 101 and Hands-On Lab
Multi-Cloud Load Balancing 101 and Hands-On LabMulti-Cloud Load Balancing 101 and Hands-On Lab
Multi-Cloud Load Balancing 101 and Hands-On Lab
 
Learn how to Leverage Kubernetes to Support 12 Factor for Enterprise Apps
 Learn how to Leverage Kubernetes to Support 12 Factor for Enterprise Apps Learn how to Leverage Kubernetes to Support 12 Factor for Enterprise Apps
Learn how to Leverage Kubernetes to Support 12 Factor for Enterprise Apps
 
Razorfish Technology Summit 2012 - Introduction
Razorfish Technology Summit 2012 - IntroductionRazorfish Technology Summit 2012 - Introduction
Razorfish Technology Summit 2012 - Introduction
 
Avi v20.1 — What’s New in Scalable, Multi-Cloud Load Balancing
Avi v20.1 — What’s New in Scalable, Multi-Cloud Load BalancingAvi v20.1 — What’s New in Scalable, Multi-Cloud Load Balancing
Avi v20.1 — What’s New in Scalable, Multi-Cloud Load Balancing
 
Multi-Cloud Load Balancing – Separating Fact from Fiction
Multi-Cloud Load Balancing – Separating Fact from FictionMulti-Cloud Load Balancing – Separating Fact from Fiction
Multi-Cloud Load Balancing – Separating Fact from Fiction
 
SuperConnectivity: One company’s heroic mission to deliver on the promises of...
SuperConnectivity: One company’s heroic mission to deliver on the promises of...SuperConnectivity: One company’s heroic mission to deliver on the promises of...
SuperConnectivity: One company’s heroic mission to deliver on the promises of...
 
IBM Think 2020 Openshift on IBM Z and LinuxONE
IBM Think 2020 Openshift on IBM Z and LinuxONEIBM Think 2020 Openshift on IBM Z and LinuxONE
IBM Think 2020 Openshift on IBM Z and LinuxONE
 
State of Load Balancing 2020
State of Load Balancing 2020State of Load Balancing 2020
State of Load Balancing 2020
 
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
 
Powering the digital economy with CICS and z/OS connect - at the "z Systems...
Powering the digital economy with CICS and z/OS connect  -  at the "z Systems...Powering the digital economy with CICS and z/OS connect  -  at the "z Systems...
Powering the digital economy with CICS and z/OS connect - at the "z Systems...
 
Enabling Remote Employees with Horizon VDI and Avi Networks
Enabling Remote Employees with Horizon VDI and Avi NetworksEnabling Remote Employees with Horizon VDI and Avi Networks
Enabling Remote Employees with Horizon VDI and Avi Networks
 

Ähnlich wie Jfokus - Reacting to an event-driven world

Ähnlich wie Jfokus - Reacting to an event-driven world (20)

Reacting to an Event-Driven World (Kate Stanley & Grace Jansen, IBM) Kafka Su...
Reacting to an Event-Driven World (Kate Stanley & Grace Jansen, IBM) Kafka Su...Reacting to an Event-Driven World (Kate Stanley & Grace Jansen, IBM) Kafka Su...
Reacting to an Event-Driven World (Kate Stanley & Grace Jansen, IBM) Kafka Su...
 
Developer Week - Reacting to an event-driven world
Developer Week - Reacting to an event-driven worldDeveloper Week - Reacting to an event-driven world
Developer Week - Reacting to an event-driven world
 
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
 
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
 
App modernization on AWS with Apache Kafka and Confluent Cloud
App modernization on AWS with Apache Kafka and Confluent CloudApp modernization on AWS with Apache Kafka and Confluent Cloud
App modernization on AWS with Apache Kafka and Confluent Cloud
 
Running Kafka in Kubernetes: A Practical Guide (Katherine Stanley, IBM United...
Running Kafka in Kubernetes: A Practical Guide (Katherine Stanley, IBM United...Running Kafka in Kubernetes: A Practical Guide (Katherine Stanley, IBM United...
Running Kafka in Kubernetes: A Practical Guide (Katherine Stanley, IBM United...
 
AWS networking fundamentals - SVC303 - Santa Clara AWS Summit
AWS networking fundamentals - SVC303 - Santa Clara AWS SummitAWS networking fundamentals - SVC303 - Santa Clara AWS Summit
AWS networking fundamentals - SVC303 - Santa Clara AWS Summit
 
CICDforModernApplications-Oslo.pdf
CICDforModernApplications-Oslo.pdfCICDforModernApplications-Oslo.pdf
CICDforModernApplications-Oslo.pdf
 
Breaking the Monolith using AWS Container Services
Breaking the Monolith using AWS Container ServicesBreaking the Monolith using AWS Container Services
Breaking the Monolith using AWS Container Services
 
Crafting a New Enterprise App Platform with Cloud Foundry, Kubernetes, Istio,...
Crafting a New Enterprise App Platform with Cloud Foundry, Kubernetes, Istio,...Crafting a New Enterprise App Platform with Cloud Foundry, Kubernetes, Istio,...
Crafting a New Enterprise App Platform with Cloud Foundry, Kubernetes, Istio,...
 
Event driven microservices
Event driven microservicesEvent driven microservices
Event driven microservices
 
Building Event-Driven Workflows with Knative and Tekton
Building Event-Driven Workflows with Knative and TektonBuilding Event-Driven Workflows with Knative and Tekton
Building Event-Driven Workflows with Knative and Tekton
 
Event-driven microservices
Event-driven microservicesEvent-driven microservices
Event-driven microservices
 
TechTalk: Accelerate Mobile Development using SDKs and Open APIs With CA API ...
TechTalk: Accelerate Mobile Development using SDKs and Open APIs With CA API ...TechTalk: Accelerate Mobile Development using SDKs and Open APIs With CA API ...
TechTalk: Accelerate Mobile Development using SDKs and Open APIs With CA API ...
 
Containers on AWS
Containers on AWSContainers on AWS
Containers on AWS
 
Revolutionize the API Economy with IBM WebSphere Connect
Revolutionize the API Economy with IBM WebSphere ConnectRevolutionize the API Economy with IBM WebSphere Connect
Revolutionize the API Economy with IBM WebSphere Connect
 
Multi Cloud Load Balancing 101 and Hands On Lab
Multi Cloud Load Balancing 101 and Hands On LabMulti Cloud Load Balancing 101 and Hands On Lab
Multi Cloud Load Balancing 101 and Hands On Lab
 
Modern Application Development for Startups
Modern Application Development for StartupsModern Application Development for Startups
Modern Application Development for Startups
 

Mehr von Grace Jansen

Mehr von Grace Jansen (20)

JPrime_JITServer.pptx
JPrime_JITServer.pptxJPrime_JITServer.pptx
JPrime_JITServer.pptx
 
SwissJUG_15_factor_app.pptx
SwissJUG_15_factor_app.pptxSwissJUG_15_factor_app.pptx
SwissJUG_15_factor_app.pptx
 
SwissJUG_Bringing the cloud back down to earth.pptx
SwissJUG_Bringing the cloud back down to earth.pptxSwissJUG_Bringing the cloud back down to earth.pptx
SwissJUG_Bringing the cloud back down to earth.pptx
 
ThroughTheLookingGlass_EffectiveObservability.pptx
ThroughTheLookingGlass_EffectiveObservability.pptxThroughTheLookingGlass_EffectiveObservability.pptx
ThroughTheLookingGlass_EffectiveObservability.pptx
 
PittsburgJUG_Cloud-Native Dev Tools: Bringing the cloud back to earth
PittsburgJUG_Cloud-Native Dev Tools: Bringing the cloud back to earthPittsburgJUG_Cloud-Native Dev Tools: Bringing the cloud back to earth
PittsburgJUG_Cloud-Native Dev Tools: Bringing the cloud back to earth
 
Javaland_JITServerTalk.pptx
Javaland_JITServerTalk.pptxJavaland_JITServerTalk.pptx
Javaland_JITServerTalk.pptx
 
JavaLand_To InstantOn and Beyond.pptx
JavaLand_To InstantOn and Beyond.pptxJavaLand_To InstantOn and Beyond.pptx
JavaLand_To InstantOn and Beyond.pptx
 
Jfokus_Bringing the cloud back down to earth.pptx
Jfokus_Bringing the cloud back down to earth.pptxJfokus_Bringing the cloud back down to earth.pptx
Jfokus_Bringing the cloud back down to earth.pptx
 
FooConf23_Bringing the cloud back down to earth.pptx
FooConf23_Bringing the cloud back down to earth.pptxFooConf23_Bringing the cloud back down to earth.pptx
FooConf23_Bringing the cloud back down to earth.pptx
 
DevoxxBelgium_StatefulCloud.pptx
DevoxxBelgium_StatefulCloud.pptxDevoxxBelgium_StatefulCloud.pptx
DevoxxBelgium_StatefulCloud.pptx
 
UtrechtJUG_Exploring statefulmicroservices in a cloud-native world.pptx
UtrechtJUG_Exploring statefulmicroservices in a cloud-native world.pptxUtrechtJUG_Exploring statefulmicroservices in a cloud-native world.pptx
UtrechtJUG_Exploring statefulmicroservices in a cloud-native world.pptx
 
JCON_15FactorWorkshop.pptx
JCON_15FactorWorkshop.pptxJCON_15FactorWorkshop.pptx
JCON_15FactorWorkshop.pptx
 
JCON_Adressing the transaction challenge in a cloud-native world.pptx
JCON_Adressing the transaction challenge in a cloud-native world.pptxJCON_Adressing the transaction challenge in a cloud-native world.pptx
JCON_Adressing the transaction challenge in a cloud-native world.pptx
 
JavaZone_Addressing the transaction challenge in a cloud-native world.pptx
JavaZone_Addressing the transaction challenge in a cloud-native world.pptxJavaZone_Addressing the transaction challenge in a cloud-native world.pptx
JavaZone_Addressing the transaction challenge in a cloud-native world.pptx
 
JavaZone_Mother Nature vs Java – the security face off.pptx
JavaZone_Mother Nature vs Java – the security face off.pptxJavaZone_Mother Nature vs Java – the security face off.pptx
JavaZone_Mother Nature vs Java – the security face off.pptx
 
Boost developer productivity with EE, MP and OL (Devoxx Ukraine 22).pptx
Boost developer productivity with EE, MP and OL (Devoxx Ukraine 22).pptxBoost developer productivity with EE, MP and OL (Devoxx Ukraine 22).pptx
Boost developer productivity with EE, MP and OL (Devoxx Ukraine 22).pptx
 
Addressing the transaction challenge in a cloud-native world Devoxx Ukraine 2022
Addressing the transaction challenge in a cloud-native world Devoxx Ukraine 2022Addressing the transaction challenge in a cloud-native world Devoxx Ukraine 2022
Addressing the transaction challenge in a cloud-native world Devoxx Ukraine 2022
 
JBCNConf_Addressing_The_Transaction_Challenge_LRA.pptx
JBCNConf_Addressing_The_Transaction_Challenge_LRA.pptxJBCNConf_Addressing_The_Transaction_Challenge_LRA.pptx
JBCNConf_Addressing_The_Transaction_Challenge_LRA.pptx
 
2022-Devnexus-StatefulMicroservices.pptx.pdf
2022-Devnexus-StatefulMicroservices.pptx.pdf2022-Devnexus-StatefulMicroservices.pptx.pdf
2022-Devnexus-StatefulMicroservices.pptx.pdf
 
How to become a superhero without even leaving your desk!
How to become a superhero without even leaving your desk!How to become a superhero without even leaving your desk!
How to become a superhero without even leaving your desk!
 

Kürzlich hochgeladen

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Kürzlich hochgeladen (20)

Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 

Jfokus - Reacting to an event-driven world

  • 1. © 2020 IBM Corporation Reacting to an Event-Driven World GraceJansen and KateStanley
  • 2. The never-ending growth of data © 2020 IBM Corporation https://www.researchgate.net/figure/The-growth-of-structured-versus-unstructured-data-over-the-past-decade-41_fig1_335927263
  • 3. The never-ending growth of data © 2020 IBM Corporation https://www.researchgate.net/figure/The-growth-of-structured-versus-unstructured-data-over-the-past-decade-41_fig1_335927263
  • 4. Customer demand for responsive, real-time applications © 2020 IBM Corporation Apps must react to events in real time, as they happen Apps must deliver responsive customer experiences Apps enhanced with real-time intelligence
  • 5. Now for an example, let’s get some coffee! © 2020 IBM Corporation
  • 6. © 2020 IBM Corporation https://github.com/cescoffier/quarkus-coffeeshop-demo
  • 7. Barista Example: © 2020 IBM Corporation Coffee Shop Barista Coffee Lovers HTTP
  • 8. Barista Example: © 2020 IBM Corporation Coffee Shop Coffee Shop Barista Barista Board Coffee Lovers Coffee Lovers HTTP Orders, Queue Event Backbone HTTP HTTP
  • 9. © 2020 IBM Corporation Q: Is your microservice system non- blocking and highly responsive?
  • 10. © 2020 IBM Corporation Q: Is your microservice system non- blocking and highly responsive? A:Yes I’m using Kafka!
  • 11. © 2020 IBM Corporation Q: Is your microservice system non- blocking and highly responsive? A:Yes I’m using Kafka!
  • 12. © 2020 IBM Corporation Futures RxJava Reactive Streams Futures RxJava Reactive Streams Futures RxJava Reactive Streams Microservice 2 Microservice 3 Microservice 1 How do we make a highly responsive app?
  • 13. © 2020 IBM Corporation Futures RxJava Reactive Streams Futures RxJava Reactive Streams Futures RxJava Reactive Streams Microservice 2 Microservice 3 Microservice 1 Reactive Programming How do we make a highly responsive app?
  • 14. © 2020 IBM Corporation Futures RxJava Reactive Streams Futures RxJava Reactive Streams Futures RxJava Reactive Streams Microservice 2 Microservice 3 Microservice 1 Reactive Programming Reactive Systems How do we make a highly responsive app?
  • 15. Reactive Programming © 2020 IBM Corporation A subset of asynchronous programming and a paradigm where the availability of new information drives the logic forward rather than having control flow driven by a thread-of-execution.
  • 16. Reactive Programming Patterns © 2020 IBM Corporation Futures: a promise to hold the result of some operation once that operation completes RxJava: a JavaVM implementation of ReactiveX (Reactive Extensions): a library for composing asynchronous and event-based programs by using observable sequences. Reactive Streams: a programming concept for handling asynchronous data streams in a non-blocking manner while providing backpressure to stream publishers
  • 17. Reactive Manifesto © 2020 IBM Corporation ResilientElastic Message- Driven Responsive
  • 18. Reactive Architecture design patterns CQRS Event Sourcing Saga Sharding © 2020 IBM Corporation APP WRITE API APP READ API APP APP APP APP APP APP
  • 19. How do I configure Kafka for a reactive system? © 2020 IBM Corporation
  • 20. Apache Kafka is an open source, distributed streaming platform © 2020 IBM Corporation Publish and subscribe to streams of records Store records in durable way Process streams of records as they occur
  • 21. Event-Driven vs Message-Driven © 2020 IBM Corporation ResilientElastic Message- Driven Responsive
  • 22. Reactive Systems rely on asynchronous message-passing © 2020 IBM Corporation
  • 23. Messages “An item of data sent to a specific location.” A message can contain an encoded event in its payload. Events “A signal emitted by a component upon reaching a given state.” © 2020 IBM Corporation
  • 24. Resiliency in Kafka © 2020 IBM Corporation ResilientElastic Message- Driven Responsive
  • 25. Resilient © 2020 IBM Corporation
  • 26. Resilient © 2020 IBM Corporation
  • 27. Resilient © 2020 IBM Corporation
  • 28. Resilient © 2020 IBM Corporation KAFKA CLIENTS
  • 29. Resilient Topic A Partition 1 Broker 1 © 2020 IBM Corporation
  • 30. Resilient Topic A Partition 1 Broker 1 Topic A Partition 1 Offline Leader KAFKA CLIENTS © 2020 IBM Corporation
  • 31. Resilient producers Guarantees in Kafka: At most once At least once Configuration in producers Acks Retries © 2020 IBM Corporation The producer doing a “fire-and-forget” isn’t good enough
  • 32. Resilient consumers Consumer offsets Commit offset: Manually or automatically © 2020 IBM Corporation If a consumer dies it needs to know where to pick up from again 0 1 2 3 4 5 Offset
  • 33. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte
  • 34. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte Coffee
  • 35. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte Coffee
  • 36. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte
  • 37. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte Cappuccino
  • 38. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte Cappuccino Latte
  • 39. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte Cappuccino Latte Baristas with manual commit Coffee Cappuccino Latte TOPIC Barista
  • 40. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte Cappuccino Latte Baristas with manual commit Coffee Cappuccino Latte TOPIC Barista Coffee
  • 41. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte Cappuccino Latte Baristas with manual commit Coffee Cappuccino Latte TOPIC Barista Coffee
  • 42. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte Cappuccino Latte Baristas with manual commit Coffee Cappuccino Latte TOPIC Barista Coffee Latte Cappuccino
  • 43. Scalability in Kafka © 2020 IBM Corporation ResilientElastic Message- Driven Responsive
  • 44. Partitions © 2020 IBM Corporation
  • 45. Topics and Keys 0 1 2 3 TOPIC 0 1 2 3 0 1 2 3 PARTITION 0 PARTITION 1 PARTITION 2 key:a val:A1 © 2020 IBM Corporation
  • 46. Consumer Groups © 2020 IBM Corporation
  • 47. © 2019 IBM Corporation Consumer Groups CONSUMER GROUP A p0, offset 7 p1, offset 3 p2, offset 5 TOPIC 0 1 2 3 0 1 2 3 4 5 PARTITION 0 PARTITION 1 PARTITION 2 0 1 2 3 4 5 6 7 CONSUMER CONSUMER CONSUMER CONSUMER GROUP B p0, offset 7 p1, offset 3 p2, offset 5 CONSUMER CONSUMER © 2019 IBM Corporation
  • 48. © 2019 IBM Corporation Consumer Groups CONSUMER GROUP A p0, offset 7 p1, offset 3 p2, offset 5 TOPIC 0 1 2 3 0 1 2 3 4 5 PARTITION 0 PARTITION 1 PARTITION 2 0 1 2 3 4 5 6 7 CONSUMER CONSUMER CONSUMER CONSUMER GROUP B p0, offset 7 p1, offset 3 p2, offset 5 CONSUMER CONSUMER © 2019 IBM Corporation
  • 49. © 2019 IBM Corporation Consumer Groups CONSUMER GROUP A p0, offset 7 p1, offset 3 p2, offset 5 TOPIC 0 1 2 3 0 1 2 3 4 5 PARTITION 0 PARTITION 1 PARTITION 2 0 1 2 3 4 5 6 7 CONSUMER CONSUMER CONSUMER CONSUMER GROUP B p0, offset 7 p1, offset 3 p2, offset 5 CONSUMER CONSUMER © 2019 IBM Corporation
  • 50. © 2019 IBM Corporation Consumer Groups CONSUMER GROUP A p0, offset 7 p1, offset 3 p2, offset 5 TOPIC 0 1 2 3 0 1 2 3 4 5 PARTITION 0 PARTITION 1 PARTITION 2 0 1 2 3 4 5 6 7 CONSUMER CONSUMER CONSUMER CONSUMER CONSUMER GROUP B p0, offset 7 p1, offset 3 p2, offset 5 CONSUMER CONSUMER © 2019 IBM Corporation
  • 51. How do we get started?
  • 52. © 2020 IBM Corporation https://kafka.apache.org/quickstart
  • 53. © 2020 IBM Corporation
  • 54. Reactive Frameworks for Kafka Spring Reactor Kafka MicroProfile Reactive Messaging Alpakka Kafka Connector Vert.x Kafka Client © 2020 IBM Corporation
  • 55. Spring Reactor Kafka © 2020 IBM Corporation Reactor Kafka is a thin layer of reactive streams over Kafka client Hides the complexity of Kafka Built-in backpressure support
  • 56. MicroProfile Reactive Messaging © 2020 IBM Corporation This specification provides asynchronous messaging support based on Reactive Streams for MicroProfile. Implementations include: • SmallRye Reactive Messaging 1.0.0 • Open Liberty 19.0.0.9 (via SmallRye) • Quarkus 1.0.0.Final (via SmallRye) • WebSphere Liberty 19.0.0.9 (via SmallRye) Reactive Messaging uses a model of annotated methods which are connected by named channels.
  • 57. Alpakka Kafka Connector © 2020 IBM Corporation Enables connection between Apache Kafka and Akka Streams. Hides complexity of Kafka Built-in backpressure support Akka Streams uses Akka actors as its foundation
  • 58. What is Vert.x? Polyglot Framework Based on Reactor pattern Runs on the JVM Non-blocking Event-driven Includes distributed event-bus Code is single-threaded © 2020 IBM Corporation
  • 59. Demo app © 2020 IBM Corporation https://github.com/ibm-messaging/kafka-java-vertx-starter Vert.x app websocket produce consume
  • 60. org.apache.kafka.clients.producer.KafkaProducer<K, V> © 2020 IBM Corporation for (int i = 0; i < 100; i++) { ProducerRecord<String, String> producerRecord = new ProducerRecord<>(“my-topic”, Integer.toString(i)); producer.send(producerRecord); }
  • 61. Vert.x Kafka Client - Producer © 2020 IBM Corporation for (int i = 0; i < 100; i++) { KafkaProducerRecord<String, String> producerRecord = KafkaProducerRecord.create(“my-topic”, Integer.toString(i)); producer.write(producerRecord); }
  • 62. org.apache.kafka.clients.consumer.KafkaConsumer<K, V> © 2020 IBM Corporation while (true) { ConsumerRecords<String, String> records = consumer.poll(100); for (ConsumerRecord<String, String> record : records) { processRecord(record); consumer.commit(); } }
  • 63. Vert.x Kafka Client - Consumer © 2020 IBM Corporation consumer.handler(record -> { processRecord(record, processResult -> { consumer.commit(record.offset(), commitResult -> { // handle outcome }); }); });
  • 64. Summary Building reactive can help you! Kafka is useful, but think carefully when designing your system You are not alone! Lots of reactive frameworks to help you along the way © 2020 IBM Corporation
  • 65. Reactive Systems Explained © 2020 IBM Corporation ibm.biz/ReactiveReport
  • 66. Thank you Kate Stanley | @katestanley91 Grace Jansen | @gracejansen27 © 2019 IBM Corporation IBM Event Streams: ibm.biz/aboutEventStreams Reactive Manifesto: https://www.reactivemanifesto.org Getting started with Kafka: https://kafka.apache.org/quickstart https://strimzi.io Starter app https://github.com/ibm-messaging/kafka-java-vertx-starter Reactive Kafka libraries https://vertx.io/docs/vertx-kafka-client/java/ https://github.com/eclipse/microprofile-reactive- messaging https://projectreactor.io/docs/kafka https://github.com/akka/alpakka-kafka

Hinweis der Redaktion

  1. Start with our “journey” to microservices How do you architect your microservices so that your clients get a nice experience Talk about response time, data-driven level first, but we live in an event-driven world! Start with demo showing http vs Kafka (video) Show that Kafka is much quicker Why? – delve into code? Show that we are being event-driven, what does that mean, why is it quicker (timeout diagrams) Talk about data centric vs event-centric But this is only looking at the architecture, what is happening inside your microservices Leads into reactive intro Why reactive architecture exists, how it fits into Kafka, what are the cornerstones What happens if we set up Kafka in a non-reactive way? Ok let’s fix it so it is reactive, and now switch to a reactive app. At the end, running Kafka in reactive way and implementing with vertx, includes showing the vertx Kafka client etc. Run app in a container? Options for Kafka on Kube End resources Non-resilient, or non-elastic we could have failure at some point Non-resilient – only replicating on one broker Non-elastic – how does vertx do elasticity? First app is a basic Kafka client app, then later introduce vertx
  2. Every second, ~ 6,000 tweets are tweeted >40,000 Google queries are searched >2 million emails are sent Photo uploads total 300 million per day. Emphasizing how much data applications are expected to handle Also impact in terms of fluctuation e.g. black Friday Also people wanting to have split second responsiveness Banking apps -> needing up to date information (Internet Live Stats, a website of the international Real Time Statistics Project)
  3. Use this as an example -> there are plenty of existing demos showing that using event driven vs e.g. http is much better
  4. Use this as an example -> there are plenty of existing demos showing that using event driven vs e.g. http is much better Clement’s session C3 – 4pm
  5. Use this as an example -> there are plenty of existing demos showing that using event driven vs e.g. http is much better
  6. No! This isn’t reasonable! Kafka is a good tool, but it isn’t enough to have a good tool, you need to use it in the right way You also need to think about your applications and other services, Kafka isn’t your whole architecture – integration between components is key! Can we just use Kafka to create a Reactive application? Short answer: NO While Kafka look after the messaging part, we still need a Reactive Microservice implementation, for instance, using the actor model to replace thread synchronization with queued message processing or the supervisor model to handle failures and self-healing. We definitely need both Akka and Kafka to build Reactive Microservices based responsive, resilient and elastic systems.
  7. No! This isn’t reasonable! Kafka is a good tool, but it isn’t enough to have a good tool, you need to use it in the right way You also need to think about your applications and other services, Kafka isn’t your whole architecture – integration between components is key! Can we just use Kafka to create a Reactive application? Short answer: NO While Kafka look after the messaging part, we still need a Reactive Microservice implementation, for instance, using the actor model to replace thread synchronization with queued message processing or the supervisor model to handle failures and self-healing. We definitely need both Akka and Kafka to build Reactive Microservices based responsive, resilient and elastic systems.
  8. No! This isn’t reasonable! Kafka is a good tool, but it isn’t enough to have a good tool, you need to use it in the right way You also need to think about your applications and other services, Kafka isn’t your whole architecture – integration between components is key! Can we just use Kafka to create a Reactive application? Short answer: NO While Kafka look after the messaging part, we still need a Reactive Microservice implementation, for instance, using the actor model to replace thread synchronization with queued message processing or the supervisor model to handle failures and self-healing. We definitely need both Akka and Kafka to build Reactive Microservices based responsive, resilient and elastic systems.
  9. Kafka = gives us reactive data layer G Reactive architecture patterns = give us reactivity in the architecture of the system Reactive programming = gives us reactivity within the microservices (Designed well together)
  10. Kafka = gives us reactive data layer G Reactive architecture patterns = give us reactivity in the architecture of the system Reactive programming = gives us reactivity within the microservices (Designed well together)
  11. Kafka = gives us reactive data layer G Reactive architecture patterns = give us reactivity in the architecture of the system Reactive programming = gives us reactivity within the microservices A reactive system is an architectural style that allows multiple individual applications to coalesce as a single unit, reacting to its surroundings, while remaining aware of each other—this could manifest as being able to scale up/down, load balancing, and even taking some of these steps proactively. It’s possible to write a single application in a reactive style (i.e. using reactive programming); however, that’s merely one piece of the puzzle. Though each of the above aspects may seem to qualify as “reactive,” in and of themselves they do not make a system reactive. (Designed well together)
  12. Asynchronous code allows independent IO operations to run concurrently, resulting in efficient code. However, this improved efficiency comes at a cost — straightforward synchronous code may become a mess of nested callbacks. Futures - Enables us to combine the simplicity of synchronous code with the efficiency of the asynchronous approach. Future represents the result of an asynchronous computation. Methods are provided to check if the computation is complete, to wait for its completion, and to retrieve the result of the computation. A Publisher is the source of events T in the stream, and a Subscriber is a consumer for those events. A Subscriber subscribes to a Publisher by invoking a “factory method” in the Publisher that will push the stream items <T> starting a new Subscription. This is also called Reactor Pattern.
  13. Asynchronous code allows independent IO operations to run concurrently, resulting in efficient code. However, this improved efficiency comes at a cost — straightforward synchronous code may become a mess of nested callbacks. Futures - Enables us to combine the simplicity of synchronous code with the efficiency of the asynchronous approach. Future represents the result of an asynchronous computation. Methods are provided to check if the computation is complete, to wait for its completion, and to retrieve the result of the computation. A Publisher is the source of events T in the stream, and a Subscriber is a consumer for those events. A Subscriber subscribes to a Publisher by invoking a “factory method” in the Publisher that will push the stream items <T> starting a new Subscription. This is also called Reactor Pattern.
  14. Reactive architecture is an architecture approach aims to use asynchronous messaging or event driven architecture to build Responsive, Resilient and Elastic systems. Reactive Microservices is capitalizing on the Reactive approach while supporting faster time to market using Microservices. Reactive Microservices is using asynchronous messaging to minimize or isolate the negative effects of resource contention, coherency delays and inter-service communication network latency. By using an event driven architecture we can have both agile development and build responsive systems.
  15. Reactive adopts a set of design patterns such as: - CQRS – separates the reads and writes - Event Sourcing - persists the state of a business entity such an Order or a Customer as a sequence of state-changing events. Whenever the state of a business entity changes, a new event is appended to the list of events. - SAGA - a mechanism to take traditional transactions that we would have done in a monolithic architecture and do it in a distributed way. We create multi “micro” transactions that have fallback behaviour to account for things going wrong part way through. It’s a sequence of local transactions where each transaction updates data within a single service - Sharding - distributes and replicates the data across a pool of databases that do not share hardware or software. Each individual database is known as a shard. Java applications can linearly scale up or scale down by adding databases (shard) to the pool or by removing databases (shards) from the pool. These patterns trade off eventual consistency, availability and scalability for strong consistency (CAP Theorem). Kafka is a perfect fit for those design patterns.
  16. So Kafka claims to have scalable consumption and resiliency, do I just get that for free when I start Kafka? How does it work?
  17. Open sourced distributed streaming platform, often being adopted as the “de-facto” event streaming technology
  18. Talking about message driven vs event driven
  19. Reactive architecture is an architecture approach aims to use asynchronous messaging or event driven architecture to build Responsive, Resilient and Elastic systems. Reactive Microservices is capitalizing on the Reactive approach while supporting faster time to market using Microservices. Reactive Microservices is using asynchronous messaging to minimize or isolate the negative effects of resource contention, coherency delays and inter-service communication network latency. By using an event driven architecture we can have both agile development and build responsive systems.
  20. A Kafka cluster consists of a set of brokers. A cluster has a minimum of 3 brokers.
  21. Brokers hold topics (more on that later) A topic is made up of one or more partitions. By having multiple partitions distributed across the brokers, a topic can handle a large scale of traffic without overloading one broker.
  22. In order to improve availability, each topic can be replicated onto multiple brokers. For each partition, one of the brokers is the leader, and the other brokers are the followers. Replication works by the followers repeatedly fetching messages from the leader. This is done automatically by Kafka. For production we recommend at least 3 replicas: you’ll see why in a minute.
  23. In order to improve availability, each topic can be replicated onto multiple brokers. For each partition, one of the brokers is the leader, and the other brokers are the followers. Replication works by the followers repeatedly fetching messages from the leader. This is done automatically by Kafka. For production we recommend at least 3 replicas: you’ll see why in a minute.
  24. Imagine a broker goes down, this means the leader of Topic A, partition 1 is offline
  25. Imagine a broker goes down, this means the leader of Topic A, partition 1 is offline
  26. Reactive architecture is an architecture approach aims to use asynchronous messaging or event driven architecture to build Responsive, Resilient and Elastic systems. Reactive Microservices is capitalizing on the Reactive approach while supporting faster time to market using Microservices. Reactive Microservices is using asynchronous messaging to minimize or isolate the negative effects of resource contention, coherency delays and inter-service communication network latency. By using an event driven architecture we can have both agile development and build responsive systems.
  27. Brokers hold topics (more on that later) A topic is made up of one or more partitions. By having multiple partitions distributed across the brokers, a topic can handle a large scale of traffic without overloading one broker.
  28. An individual record is made up of a key and a value. Kafka guarantee that all messages with the same non-empty key will be sent to the same partition
  29. To allow scalability of consumers, consumers are grouped into consumer groups. Consumer declare what group they are in using a group id
  30. If you added an extra consumer to consumer group A it would sit idle, since there aren’t any spare partitions – this isn’t ideal but could be useful if you want it to quickly pick up the slack if one of the other consumers went down
  31. If you added an extra consumer to consumer group A it would sit idle, since there aren’t any spare partitions – this isn’t ideal but could be useful if you want it to quickly pick up the slack if one of the other consumers went down
  32. If you added an extra consumer to consumer group A it would sit idle, since there aren’t any spare partitions – this isn’t ideal but could be useful if you want it to quickly pick up the slack if one of the other consumers went down
  33. If you added an extra consumer to consumer group A it would sit idle, since there aren’t any spare partitions – this isn’t ideal but could be useful if you want it to quickly pick up the slack if one of the other consumers went down
  34. At the moment Kafka uses Zookeeper for storing metadata, in the future the metadata will be stored in topics in Kafka, so Zookeeper won’t be required any more.
  35. Reactive adopts a set of design patterns such as: - CQRS - event sourcing - command sourcing - sharding These patterns trade off eventual consistency, availability and scalability for strong consistency (CAP Theorem). Kafka is a perfect fit for those design patterns.
  36. Applications using Kafka as a message bus using this API may consider switching to Reactor Kafka if the application is implemented in a functional style. Based on top of Project Reactor Uses Kafka Java client (Kafka Producer/Consumer API) under the hood
  37. The actor model is a conceptual model to deal with concurrent computation. An actor is the primitive unit of computation. It’s the thing that receives a message and do some kind of computation based on it. Messages are sent asynchronously to an actor, that needs to store them somewhere while it’s processing another message. The mailbox is the place where these messages are stored. Actors communicate with each other by sending asynchronous messages. Those messages are stored in other actors' mailboxes until they're processed. It allows consuming/producing from Kafka with Akka Streams, leveraging the reactive interface of this streaming library, its backpressure, and resource safety. It hides a lot of complexity, especially when your streaming logic is non-trivial like sub-streaming per partition and handling commits in custom ways.
  38. Polyglot Java, Javascript, Groovy, Ruby, Ceylon, Scala and Kotlin The reactor pattern is one implementation technique of event-driven architecture. In simple terms, it uses a single threaded event loop blocking on resource-emitting events and dispatches them to corresponding handlers and callbacks. It receives messages, requests, and connections coming from multiple concurrent clients and processes these posts sequentially using event handlers. The purpose of the Reactor design pattern is to avoid the common problem of creating a thread for each message, request, and connection. Then it receives events from a set of handlers and distributes them sequentially to the corresponding event handlers.
  39. Demo the starter app working Key takeaways: Choosing a reactive framework makes it easier to work with Kafka
  40. Show/talk about the normal way to use the Kafka clients
  41. Show/talk about the normal way to use the Kafka clients