Reacting to an Event-
Driven World
Grace Jansen
IBM Developer Advocate
@gracejansen27
© 2021 IBM Corporation
Kate Stanley
IBM Software Engineer
@katestanley91
Let’s get some coffee…
© 2020 IBM Corporation
Barista Example:
© 2020 IBM Corporation
Coffee Shop
Barista
Coffee Lovers
HTTP
HTTP
https://github.com/cescoffier/quarkus-coffeeshop-demo
Event Driven Architecture
© 2020 IBM Corporation
S1
S3
S2
S4
Event-driven messaging backbone
Microservice
publishing
events
Microservice
consuming
events
Event-driven messaging backbone
http://ibm.biz/AdvantagesOfEDA
Barista Example:
© 2020 IBM Corporation
Coffee Shop
Coffee Shop
Barista
Barista
Board
Coffee Lovers
Coffee Lovers
HTTP
Orders,
Queue
HTTP
HTTP
https://github.com/cescoffier/quarkus-coffeeshop-demo
Event
Backbone
© 2020 IBM Corporation
Apache Kafka is an open source, distributed
streaming platform
Stream history Immutable data Highly available
Scalable
Scalable
consumption
© 2020 IBM Corporation
Q: Is your coffee shop non-blocking and
highly responsive?
© 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!
Reactive systems
© 2020 IBM Corporation
Reactive Manifesto
© 2020 IBM Corporation
Message-Driven
Reactive Manifesto
© 2020 IBM Corporation
Events
“A signal emitted by a component upon
reaching a given state.”
© 2020 IBM Corporation
A message can contain an encoded
event in its payload.
Messages
“An item of data sent to a specific location.”
© 2020 IBM Corporation
Apache Kafka is an open source, distributed
streaming platform
Publish and subscribe to streams of
records
Store records in durable way
Process streams of records as they
occur
Barista Example:
© 2020 IBM Corporation
Coffee Shop
Barista
Board
Coffee Lovers
Orders,
Queue
HTTP
https://github.com/cescoffier/quarkus-coffeeshop-demo
Event
Backbone
Barista Example:
© 2020 IBM Corporation
Coffee Shop
Barista
Board
Coffee Lovers
Orders,
Queue
HTTP
https://github.com/cescoffier/quarkus-coffeeshop-demo
Event
Backbone
Barista Example:
© 2020 IBM Corporation
Coffee Shop
Barista
Board
Coffee Lovers
Orders,
Queue
HTTP
https://github.com/cescoffier/quarkus-coffeeshop-demo
Event
Backbone
Elastic
Message-Driven
Reactive Manifesto
© 2020 IBM Corporation
Barista Example:
© 2020 IBM Corporation
Coffee Shop
Barista
Board
Coffee Lovers
Orders,
Queue
HTTP
https://github.com/cescoffier/quarkus-coffeeshop-demo
Event
Backbone
Barista Example:
© 2020 IBM Corporation
Coffee Shop
Barista
Board
Coffee Lovers
Orders,
Queue
HTTP
https://github.com/cescoffier/quarkus-coffeeshop-demo
Event
Backbone
Barista Example:
© 2020 IBM Corporation
Coffee Shop
Barista
Board
Coffee Lovers
Orders,
Queue
HTTP
https://github.com/cescoffier/quarkus-coffeeshop-demo
Event
Backbone
Resilient
Elastic
Message-Driven
Reactive Manifesto
© 2020 IBM Corporation
Resilient
Elastic
Responsive
Message-Driven
Reactive Manifesto
© 2020 IBM Corporation
Resilient
Elastic
Responsive
Message-Driven
Reactive Manifesto
© 2020 IBM Corporation
Building reactive
systems
© 2020 IBM Corporation
How do we make a highly responsive app?
Microservice 1
© 2020 IBM Corporation
Microservice 2
Microservice 3
How do we make a highly responsive app?
Microservice 1
© 2020 IBM Corporation
Microservice 2
Microservice 3
Reactive
Architecture
Patterns
Reactive Architecture design patterns
CQRS Circuit breaker Saga Back pressure
© 2020 IBM Corporation
APP
WRITE API
APP
READ API
APP
APP
APP
APP
APP
APP
APP
APP
How do we make a highly responsive app?
Microservice 1
© 2020 IBM Corporation
Microservice 2
Microservice 3
Futures
Reactive Streams
Libraries
Futures
Reactive Streams
Libraries
Futures
Reactive Streams
Libraries
Reactive
Programming
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
Reactive programming libraries: for composing asynchronous and event-based
programs. (e.g. RxJava, SmallRye Mutiny)
Reactive Streams: a programming concept for handling asynchronous data streams
in a non-blocking manner while providing backpressure to stream publishers
Utilising Kafka in
reactive systems
© 2020 IBM Corporation
Resilient
Elastic
Responsive
Message-Driven
Message-Driven with Kafka
© 2020 IBM Corporation
Resilient
Elastic
Responsive
Message-Driven
Resiliency in Kafka
© 2020 IBM Corporation
Message Retention and Data
Persistence
© 2020 IBM Corporation
Stream history Immutable Data
Resilient Kafka Clusters
© 2020 IBM Corporation
© 2020 IBM Corporation
Resilient Kafka Clusters
Resilient Kafka Clusters
© 2021 IBM Corporation
Topic A
Partition 1
Broker 1
Topic A
Partition 1
Offline Leader
Resilient Kafka Clusters
© 2021 IBM Corporation
Resilient Producers
Delivery guarantees:
At most once
At least once
Configuration:
Acks
Retries
© 2021 IBM Corporation
Resilient Consumers
0 1 2 3 4 5
Offset
© 2021 IBM Corporation
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
Schemas and Schema Registries
© 2020 IBM Corporation
Resilient
Elastic
Responsive
Message-Driven
Scalability in Kafka
© 2021 IBM Corporation
Scalability in Kafka
© 2021 IBM Corporation
Elasticity in Consumers
© 2021 IBM Corporation
Consumer Groups
Consumer groupA
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
Consumer
Consumer
© 2021 IBM Corporation
Consumer Groups
Consumer groupA
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
Consumer
Consumer
© 2021 IBM Corporation
Consumer Groups
Consumer groupA
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
© 2021 IBM Corporation
Consumer Groups
Consumer groupA
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
© 2021 IBM Corporation
Writing reactive
Kafka applications
© 2021 IBM Corporation
Reactive Frameworks for
Kafka
Alpakka Kafka Connector
MicroProfile Reactive Messaging
Vert.x Kafka Client
© 2021 IBM Corporation
Alpakka Kafka Connector API
© 2021 IBM Corporation
Eclipse MicroProfile
An open-source community specification for Enterprise
Java microservices
A community of:
individuals
organizations
vendors
© 2021 IBM Corporation
MicroProfile 3.3 Stack
Reactive Streams
Operators 1.1
GraphQL
1.0
Standalone Projects
JSON-B 1.0
JSON-P 1.1
CDI 2.0
Config 1.4
Fault
Tolerance 2.1
JWT
Propagation
1.1
Health
Check 2.2
Metrics 2.3
OpenTracing
1.3
Open API 1.1
JAX-RS 2.1 Rest Client 1.4
Reactive
Messaging 1.0
Context
Propagation
1.0
Reactive
Streams
Not a MicroProfile spec
© 2021 IBM Corporation
MicroProfile Reactive Messaging
Application’s beans contain methods annotated with @Incoming and @Outgoing annotations
The annotated methods are connected by named channels
A channel is a name indicating which source or destination of messages is used. Channels are opaque Strings.
@Incoming and @Outgoing annotations are matched up by channel names
© 2021 IBM Corporation
What is Eclipse Vert.x?
Polyglot Tool-kit
Based on Reactor pattern
Runs on the JVM
Non-blocking
Event-driven
Includes distributed event-bus
Code is single-threaded
© 2021 IBM Corporation
Vert.x Demo App
© 2020 IBM Corporation
Demo app
© 2021 IBM Corporation
https://github.com/ibm-messaging/kafka-java-vertx-starter
Vert.x app
produce
consume
Demo app
© 2021 IBM Corporation
Vert.x app
websocket
produce
consume
https://github.com/ibm-messaging/kafka-java-vertx-starter
© 2021 IBM Corporation
https://github.com/ibm-messaging/kafka-java-vertx-starter
© 2021 IBM Corporation
Producing Records
© 2021 IBM Corporation
Vert.x app
websocket produce
Start
Stop
Producing Records
© 2021 IBM Corporation
Consuming and Processing Records
© 2021 IBM Corporation
Apache Kafka Java Client:
© 2021 IBM Corporation
Consuming and Processing Records
Apache Kafka Java Client:
© 2021 IBM Corporation
Consuming and Processing Records
Apache Kafka Java Client:
© 2021 IBM Corporation
Consuming and Processing Records
Vert.x Kafka Client
© 2021 IBM Corporation
Consuming and Processing Records
Vert.x Kafka Client
© 2021 IBM Corporation
Flow Control
Vert.x Kafka Client
© 2021 IBM Corporation ibm.biz/ExperiencesWritingAReactiveKafkaApp
Summary
Non-reactive + Kafka != reactive
Consider Kafka configuration for the best reactive system
The open-source reactive community is on hand to help!
Reactive toolkits and frameworks can provide additional benefits
© 2021 IBM Corporation
Reactive Systems Explained
© 2021 IBM Corporation
ibm.biz/ReactiveReport
MicroProfile Reactive labs
ibm.biz/reactive-java-labs
© 2021 IBM Corporation
Thank you
Grace Jansen | @gracejansen27
Kate Stanley | @katestanley91
© 2021 IBM Corporation
Reactive resources:
https://ibm.biz/IntroToReactive
https://ibm.biz/GettingStartedWithReactive
Getting started with Kafka:
https://kafka.apache.org/quickstart
https://strimzi.io
https://ibm.github.io/event-streams/schemas/overview/
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
Open Liberty:
https://openliberty.io

More Related Content

PPTX
VJUG - Reacting to an event driven world
PPTX
Jfokus - Reacting to an event-driven world
PPTX
DevNexus - Reacting to an event driven world
PPTX
GIDS Architecture Live: Reacting to an event-driven world
PPTX
JSpring Virtual 2020 - Reacting to an event-driven world
PPTX
Virtual Meetup Sweden - Reacting to an event driven world
PDF
DevOps for Mobile - DevOpsDays, NY, 2013
PDF
Powering the digital economy with CICS and z/OS connect - at the "z Systems...
VJUG - Reacting to an event driven world
Jfokus - Reacting to an event-driven world
DevNexus - Reacting to an event driven world
GIDS Architecture Live: Reacting to an event-driven world
JSpring Virtual 2020 - Reacting to an event-driven world
Virtual Meetup Sweden - Reacting to an event driven world
DevOps for Mobile - DevOpsDays, NY, 2013
Powering the digital economy with CICS and z/OS connect - at the "z Systems...

What's hot (18)

PDF
High Scalability Network Monitoring for Communications Service Providers
PDF
Re Inventing Enterprise IT around APIs and Apps
PDF
Systems Resource Management with NetIQ AppManager
PPT
SuperConnectivity: One company’s heroic mission to deliver on the promises of...
PDF
Path to Network Functions Virtualization (NFV) Nirvana 2013
PPTX
#8311: Transform the Enterprise with IBM Cloud Private
PDF
Cloud K5 Services_Description
PDF
Virtualization case study
PDF
Domenico Maracci, Stefano Sali - Secure Continuous Delivery - Sicurezza e Dev...
PDF
An architect’s guide to leveraging your incumbency
PPTX
The App Evolution Continues
PPT
SHARE 2014 Pittsburgh, Managing multi version applications in cics
PDF
Test Centre case studies - Cathal McGloin (FeedHenry)
PDF
IBM Think 2020 Openshift on IBM Z and LinuxONE
PDF
What Mobile Developers Should Know
PDF
Demo to Prepare for “Hands-On Lab: Take a Deep Dive with Experts Who Have Int...
PPTX
Twelve factor-app
PDF
EDI WS API ECGridOS Web Services
High Scalability Network Monitoring for Communications Service Providers
Re Inventing Enterprise IT around APIs and Apps
Systems Resource Management with NetIQ AppManager
SuperConnectivity: One company’s heroic mission to deliver on the promises of...
Path to Network Functions Virtualization (NFV) Nirvana 2013
#8311: Transform the Enterprise with IBM Cloud Private
Cloud K5 Services_Description
Virtualization case study
Domenico Maracci, Stefano Sali - Secure Continuous Delivery - Sicurezza e Dev...
An architect’s guide to leveraging your incumbency
The App Evolution Continues
SHARE 2014 Pittsburgh, Managing multi version applications in cics
Test Centre case studies - Cathal McGloin (FeedHenry)
IBM Think 2020 Openshift on IBM Z and LinuxONE
What Mobile Developers Should Know
Demo to Prepare for “Hands-On Lab: Take a Deep Dive with Experts Who Have Int...
Twelve factor-app
EDI WS API ECGridOS Web Services
Ad

Similar to JavaBin: Reacting to an event driven world (20)

PPTX
JLove conference 2020 - Reacting to an Event-Driven World
PPTX
Developer Week - Reacting to an event-driven world
PDF
Reacting to an Event-Driven World (Kate Stanley & Grace Jansen, IBM) Kafka Su...
PDF
Reactive Microservices with Quarkus
PDF
Reactive Integrations - Caveats and bumps in the road explained
PDF
Building Serverless Apps with Kafka (Dale Lane, IBM) Kafka Summit London 2019
PDF
An intro to serverless and OpenWhisk for Kafka users
PPTX
High-speed, Reactive Microservices 2017
PDF
Revitalizing Aging Architectures with Microservices
PPT
Reactive java programming for the impatient
PPTX
Event-driven microservices
PDF
Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Gald...
PPTX
Reactive for the Impatient - Mary Grygleski
PDF
Openbar 12 - Leuven - From reactive programming to reactive architecture
PPTX
Reactive applications tools of the trade huff po
PDF
Typesafe & William Hill: Cassandra, Spark, and Kafka - The New Streaming Data...
PDF
Activity feeds (and more) at mate1
PDF
A Kafka journey and why migrate to Confluent Cloud?
PDF
Apache Kafka for Real-time Supply Chain in the Food and Retail Industry
PDF
Revitalizing Walmart's Aging Architecture for Web Scale
JLove conference 2020 - Reacting to an Event-Driven World
Developer Week - Reacting to an event-driven world
Reacting to an Event-Driven World (Kate Stanley & Grace Jansen, IBM) Kafka Su...
Reactive Microservices with Quarkus
Reactive Integrations - Caveats and bumps in the road explained
Building Serverless Apps with Kafka (Dale Lane, IBM) Kafka Summit London 2019
An intro to serverless and OpenWhisk for Kafka users
High-speed, Reactive Microservices 2017
Revitalizing Aging Architectures with Microservices
Reactive java programming for the impatient
Event-driven microservices
Building Reactive Applications With Node.Js And Red Hat JBoss Data Grid (Gald...
Reactive for the Impatient - Mary Grygleski
Openbar 12 - Leuven - From reactive programming to reactive architecture
Reactive applications tools of the trade huff po
Typesafe & William Hill: Cassandra, Spark, and Kafka - The New Streaming Data...
Activity feeds (and more) at mate1
A Kafka journey and why migrate to Confluent Cloud?
Apache Kafka for Real-time Supply Chain in the Food and Retail Industry
Revitalizing Walmart's Aging Architecture for Web Scale
Ad

More from Grace Jansen (20)

PPTX
JPrime_JITServer.pptx
PPTX
SwissJUG_15_factor_app.pptx
PPTX
SwissJUG_Bringing the cloud back down to earth.pptx
PPTX
ThroughTheLookingGlass_EffectiveObservability.pptx
PPTX
PittsburgJUG_Cloud-Native Dev Tools: Bringing the cloud back to earth
PPTX
Javaland_JITServerTalk.pptx
PPTX
JavaLand_To InstantOn and Beyond.pptx
PPTX
Jfokus_Bringing the cloud back down to earth.pptx
PPTX
FooConf23_Bringing the cloud back down to earth.pptx
PPTX
DevoxxBelgium_StatefulCloud.pptx
PPTX
UtrechtJUG_Exploring statefulmicroservices in a cloud-native world.pptx
PPTX
JCON_15FactorWorkshop.pptx
PPTX
JCON_Adressing the transaction challenge in a cloud-native world.pptx
PPTX
JavaZone_Addressing the transaction challenge in a cloud-native world.pptx
PPTX
JavaZone_Mother Nature vs Java – the security face off.pptx
PPTX
Boost developer productivity with EE, MP and OL (Devoxx Ukraine 22).pptx
PPTX
Addressing the transaction challenge in a cloud-native world Devoxx Ukraine 2022
PPTX
JBCNConf_Addressing_The_Transaction_Challenge_LRA.pptx
PDF
2022-Devnexus-StatefulMicroservices.pptx.pdf
PPTX
How to become a superhero without even leaving your desk!
JPrime_JITServer.pptx
SwissJUG_15_factor_app.pptx
SwissJUG_Bringing the cloud back down to earth.pptx
ThroughTheLookingGlass_EffectiveObservability.pptx
PittsburgJUG_Cloud-Native Dev Tools: Bringing the cloud back to earth
Javaland_JITServerTalk.pptx
JavaLand_To InstantOn and Beyond.pptx
Jfokus_Bringing the cloud back down to earth.pptx
FooConf23_Bringing the cloud back down to earth.pptx
DevoxxBelgium_StatefulCloud.pptx
UtrechtJUG_Exploring statefulmicroservices in a cloud-native world.pptx
JCON_15FactorWorkshop.pptx
JCON_Adressing 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
Boost developer productivity with EE, MP and OL (Devoxx Ukraine 22).pptx
Addressing the transaction challenge in a cloud-native world Devoxx Ukraine 2022
JBCNConf_Addressing_The_Transaction_Challenge_LRA.pptx
2022-Devnexus-StatefulMicroservices.pptx.pdf
How to become a superhero without even leaving your desk!

Recently uploaded (20)

PPTX
hospital managemt ,san.dckldnklcdnkdnkdnjadnjdjn
PPTX
4Seller: The All-in-One Multi-Channel E-Commerce Management Platform for Glob...
PDF
Sun and Bloombase Spitfire StoreSafe End-to-end Storage Security Solution
PPTX
CNN LeNet5 Architecture: Neural Networks
PPTX
Presentation by Samna Perveen And Subhan Afzal.pptx
PDF
Workplace Software and Skills - OpenStax
PDF
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
DOC
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业
PPTX
Lecture 5 Software Requirement Engineering
PPTX
DevOpsDays Halifax 2025 - Building 10x Organizations Using Modern Productivit...
PPTX
Computer Software - Technology and Livelihood Education
PPTX
Python is a high-level, interpreted programming language
PPTX
Chapter 1 - Transaction Processing and Mgt.pptx
PPTX
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
PDF
Visual explanation of Dijkstra's Algorithm using Python
PPTX
HackYourBrain__UtrechtJUG__11092025.pptx
PDF
Guide to Food Delivery App Development.pdf
PDF
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
PPTX
Matchmaking for JVMs: How to Pick the Perfect GC Partner
PPTX
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
hospital managemt ,san.dckldnklcdnkdnkdnjadnjdjn
4Seller: The All-in-One Multi-Channel E-Commerce Management Platform for Glob...
Sun and Bloombase Spitfire StoreSafe End-to-end Storage Security Solution
CNN LeNet5 Architecture: Neural Networks
Presentation by Samna Perveen And Subhan Afzal.pptx
Workplace Software and Skills - OpenStax
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业
Lecture 5 Software Requirement Engineering
DevOpsDays Halifax 2025 - Building 10x Organizations Using Modern Productivit...
Computer Software - Technology and Livelihood Education
Python is a high-level, interpreted programming language
Chapter 1 - Transaction Processing and Mgt.pptx
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
Visual explanation of Dijkstra's Algorithm using Python
HackYourBrain__UtrechtJUG__11092025.pptx
Guide to Food Delivery App Development.pdf
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
Matchmaking for JVMs: How to Pick the Perfect GC Partner
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx

JavaBin: Reacting to an event driven world

  • 1. Reacting to an Event- Driven World Grace Jansen IBM Developer Advocate @gracejansen27 © 2021 IBM Corporation Kate Stanley IBM Software Engineer @katestanley91
  • 2. Let’s get some coffee… © 2020 IBM Corporation
  • 3. Barista Example: © 2020 IBM Corporation Coffee Shop Barista Coffee Lovers HTTP HTTP https://github.com/cescoffier/quarkus-coffeeshop-demo
  • 4. Event Driven Architecture © 2020 IBM Corporation S1 S3 S2 S4 Event-driven messaging backbone Microservice publishing events Microservice consuming events Event-driven messaging backbone http://ibm.biz/AdvantagesOfEDA
  • 5. Barista Example: © 2020 IBM Corporation Coffee Shop Coffee Shop Barista Barista Board Coffee Lovers Coffee Lovers HTTP Orders, Queue HTTP HTTP https://github.com/cescoffier/quarkus-coffeeshop-demo Event Backbone
  • 6. © 2020 IBM Corporation Apache Kafka is an open source, distributed streaming platform Stream history Immutable data Highly available Scalable Scalable consumption
  • 7. © 2020 IBM Corporation Q: Is your coffee shop non-blocking and highly responsive?
  • 8. © 2020 IBM Corporation Q: Is your microservice system non- blocking and highly responsive?
  • 9. © 2020 IBM Corporation Q: Is your microservice system non- blocking and highly responsive? A:Yes I’m using Kafka!
  • 10. © 2020 IBM Corporation Q: Is your microservice system non- blocking and highly responsive? A:Yes I’m using Kafka!
  • 11. Reactive systems © 2020 IBM Corporation
  • 12. Reactive Manifesto © 2020 IBM Corporation
  • 14. Events “A signal emitted by a component upon reaching a given state.” © 2020 IBM Corporation A message can contain an encoded event in its payload. Messages “An item of data sent to a specific location.”
  • 15. © 2020 IBM Corporation Apache Kafka is an open source, distributed streaming platform Publish and subscribe to streams of records Store records in durable way Process streams of records as they occur
  • 16. Barista Example: © 2020 IBM Corporation Coffee Shop Barista Board Coffee Lovers Orders, Queue HTTP https://github.com/cescoffier/quarkus-coffeeshop-demo Event Backbone
  • 17. Barista Example: © 2020 IBM Corporation Coffee Shop Barista Board Coffee Lovers Orders, Queue HTTP https://github.com/cescoffier/quarkus-coffeeshop-demo Event Backbone
  • 18. Barista Example: © 2020 IBM Corporation Coffee Shop Barista Board Coffee Lovers Orders, Queue HTTP https://github.com/cescoffier/quarkus-coffeeshop-demo Event Backbone
  • 20. Barista Example: © 2020 IBM Corporation Coffee Shop Barista Board Coffee Lovers Orders, Queue HTTP https://github.com/cescoffier/quarkus-coffeeshop-demo Event Backbone
  • 21. Barista Example: © 2020 IBM Corporation Coffee Shop Barista Board Coffee Lovers Orders, Queue HTTP https://github.com/cescoffier/quarkus-coffeeshop-demo Event Backbone
  • 22. Barista Example: © 2020 IBM Corporation Coffee Shop Barista Board Coffee Lovers Orders, Queue HTTP https://github.com/cescoffier/quarkus-coffeeshop-demo Event Backbone
  • 27. How do we make a highly responsive app? Microservice 1 © 2020 IBM Corporation Microservice 2 Microservice 3
  • 28. How do we make a highly responsive app? Microservice 1 © 2020 IBM Corporation Microservice 2 Microservice 3 Reactive Architecture Patterns
  • 29. Reactive Architecture design patterns CQRS Circuit breaker Saga Back pressure © 2020 IBM Corporation APP WRITE API APP READ API APP APP APP APP APP APP APP APP
  • 30. How do we make a highly responsive app? Microservice 1 © 2020 IBM Corporation Microservice 2 Microservice 3 Futures Reactive Streams Libraries Futures Reactive Streams Libraries Futures Reactive Streams Libraries Reactive Programming
  • 31. 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.
  • 32. Reactive Programming Patterns © 2020 IBM Corporation Futures: a promise to hold the result of some operation once that operation completes Reactive programming libraries: for composing asynchronous and event-based programs. (e.g. RxJava, SmallRye Mutiny) Reactive Streams: a programming concept for handling asynchronous data streams in a non-blocking manner while providing backpressure to stream publishers
  • 33. Utilising Kafka in reactive systems © 2020 IBM Corporation
  • 36. Message Retention and Data Persistence © 2020 IBM Corporation Stream history Immutable Data
  • 37. Resilient Kafka Clusters © 2020 IBM Corporation
  • 38. © 2020 IBM Corporation Resilient Kafka Clusters
  • 39. Resilient Kafka Clusters © 2021 IBM Corporation
  • 40. Topic A Partition 1 Broker 1 Topic A Partition 1 Offline Leader Resilient Kafka Clusters © 2021 IBM Corporation
  • 41. Resilient Producers Delivery guarantees: At most once At least once Configuration: Acks Retries © 2021 IBM Corporation
  • 42. Resilient Consumers 0 1 2 3 4 5 Offset © 2021 IBM Corporation
  • 43. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte
  • 44. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte Coffee
  • 45. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte Coffee
  • 46. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte
  • 47. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte Cappuccino
  • 48. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte Cappuccino Latte
  • 49. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte Cappuccino Latte Baristas with manual commit Coffee Cappuccino Latte TOPIC Barista
  • 50. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte Cappuccino Latte Baristas with manual commit Coffee Cappuccino Latte TOPIC Barista Coffee
  • 51. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte Cappuccino Latte Baristas with manual commit Coffee Cappuccino Latte TOPIC Barista Coffee
  • 52. Baristas with auto commit Barista TOPIC Coffee Cappuccino Latte Cappuccino Latte Baristas with manual commit Coffee Cappuccino Latte TOPIC Barista Coffee Latte Cappuccino
  • 53. Schemas and Schema Registries © 2020 IBM Corporation
  • 55. Scalability in Kafka © 2021 IBM Corporation
  • 56. Elasticity in Consumers © 2021 IBM Corporation
  • 57. Consumer Groups Consumer groupA 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 Consumer Consumer © 2021 IBM Corporation
  • 58. Consumer Groups Consumer groupA 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 Consumer Consumer © 2021 IBM Corporation
  • 59. Consumer Groups Consumer groupA 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 © 2021 IBM Corporation
  • 60. Consumer Groups Consumer groupA 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 © 2021 IBM Corporation
  • 62. © 2021 IBM Corporation
  • 63. Reactive Frameworks for Kafka Alpakka Kafka Connector MicroProfile Reactive Messaging Vert.x Kafka Client © 2021 IBM Corporation
  • 64. Alpakka Kafka Connector API © 2021 IBM Corporation
  • 65. Eclipse MicroProfile An open-source community specification for Enterprise Java microservices A community of: individuals organizations vendors © 2021 IBM Corporation
  • 66. MicroProfile 3.3 Stack Reactive Streams Operators 1.1 GraphQL 1.0 Standalone Projects JSON-B 1.0 JSON-P 1.1 CDI 2.0 Config 1.4 Fault Tolerance 2.1 JWT Propagation 1.1 Health Check 2.2 Metrics 2.3 OpenTracing 1.3 Open API 1.1 JAX-RS 2.1 Rest Client 1.4 Reactive Messaging 1.0 Context Propagation 1.0 Reactive Streams Not a MicroProfile spec © 2021 IBM Corporation
  • 67. MicroProfile Reactive Messaging Application’s beans contain methods annotated with @Incoming and @Outgoing annotations The annotated methods are connected by named channels A channel is a name indicating which source or destination of messages is used. Channels are opaque Strings. @Incoming and @Outgoing annotations are matched up by channel names © 2021 IBM Corporation
  • 68. What is Eclipse Vert.x? Polyglot Tool-kit Based on Reactor pattern Runs on the JVM Non-blocking Event-driven Includes distributed event-bus Code is single-threaded © 2021 IBM Corporation
  • 69. Vert.x Demo App © 2020 IBM Corporation
  • 70. Demo app © 2021 IBM Corporation https://github.com/ibm-messaging/kafka-java-vertx-starter Vert.x app produce consume
  • 71. Demo app © 2021 IBM Corporation Vert.x app websocket produce consume https://github.com/ibm-messaging/kafka-java-vertx-starter
  • 72. © 2021 IBM Corporation https://github.com/ibm-messaging/kafka-java-vertx-starter
  • 73. © 2021 IBM Corporation
  • 74. Producing Records © 2021 IBM Corporation Vert.x app websocket produce Start Stop
  • 75. Producing Records © 2021 IBM Corporation
  • 76. Consuming and Processing Records © 2021 IBM Corporation Apache Kafka Java Client:
  • 77. © 2021 IBM Corporation Consuming and Processing Records Apache Kafka Java Client:
  • 78. © 2021 IBM Corporation Consuming and Processing Records Apache Kafka Java Client:
  • 79. © 2021 IBM Corporation Consuming and Processing Records Vert.x Kafka Client
  • 80. © 2021 IBM Corporation Consuming and Processing Records Vert.x Kafka Client
  • 81. © 2021 IBM Corporation Flow Control Vert.x Kafka Client
  • 82. © 2021 IBM Corporation ibm.biz/ExperiencesWritingAReactiveKafkaApp
  • 83. Summary Non-reactive + Kafka != reactive Consider Kafka configuration for the best reactive system The open-source reactive community is on hand to help! Reactive toolkits and frameworks can provide additional benefits © 2021 IBM Corporation
  • 84. Reactive Systems Explained © 2021 IBM Corporation ibm.biz/ReactiveReport
  • 86. Thank you Grace Jansen | @gracejansen27 Kate Stanley | @katestanley91 © 2021 IBM Corporation Reactive resources: https://ibm.biz/IntroToReactive https://ibm.biz/GettingStartedWithReactive Getting started with Kafka: https://kafka.apache.org/quickstart https://strimzi.io https://ibm.github.io/event-streams/schemas/overview/ 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 Open Liberty: https://openliberty.io