SlideShare a Scribd company logo
1 of 41
Download to read offline
Being Reactive with SpringBeing Reactive with Spring
Kris Galea
1
What's all this about?!What's all this about?!
Being Reactive .. huh ?Being Reactive .. huh ?
Nothing to do with Facebook's React Framework!
Face the challenges of popularity
Building robust applications for when it matters most
..with.. Spring?..with.. Spring?
Java framework
better than sliced bread (or ftira)
Java!Java!
What's all this Reactive-ness?!What's all this Reactive-ness?!
This fantastic thing called "The Internet"
Di culties in dealing with growing number of requests
Get to grips with the idea of Reactive Programming
2 . 2
Let's get some things straight!Let's get some things straight!
Publisher-Subscriber Messaging Pattern
Data Streams
Get technical ...Get technical ...
Java 8/9
Spring 5
Super exciting demo of Reactive Spring!Super exciting demo of Reactive Spring!
2 . 3
But rst! A little about us ...But rst! A little about us ...
Hi!Hi!
and something about yours truly...and something about yours truly...
Email: kristiang@ccbill.comEmail: kristiang@ccbill.com
Github: https://github.com/krisgaleaGithub: https://github.com/krisgalea
Slides:Slides:
https://www.slideshare.net/KrisGalea/being-https://www.slideshare.net/KrisGalea/being-
reactive-with-springreactive-with-spring
3 . 2
Where all this began ...Where all this began ...
Welcome to ...Welcome to ... The InternetThe Internet
The internet is growingThe internet is growing
4 . 2
Challenges of a Growing InternetChallenges of a Growing Internet
Number of requests increases
E-Commerce: businesses are now online
Multiple ways of scaling: hardware vs. software
Maintaining consistency come rain or shine
4 . 3
Let's talk ReactiveLet's talk Reactive
A Set of Principles/GuidelinesA Set of Principles/Guidelines
A software oriented approach to robustness
Not, strictly speaking, anything technical
A set of guidelines which motivate design decisions made from the ground
up
A way to ensure that applications are built to withstand the di culties of
modern necessities
5 . 2
One Manifesto to Rule them all ...One Manifesto to Rule them all ...
5 . 3
Technically speaking ...Technically speaking ...
Use of functional approach to allow an application to react to changes in
the environment as they happen
vs
Use of data streams to transmit changes from the source to the
destination
Use of the publisher-subscriber pattern
a:= b + c
a:= changing(b) + changing(c)
5 . 4
Let's try this out ...Let's try this out ...
5 . 5
A word about Backpressure...A word about Backpressure...
Hot vs Cold message emitting
Push vs Pull vs Hybrid-push-pull
5 . 6
Let's Get Down to Basics ...Let's Get Down to Basics ...
6
Publisher-Subscriber MessagingPublisher-Subscriber Messaging
PatternPattern
Messaging Pattern (architectural)
3 main actors: Publisher , Subscriber and Subscription
7 . 2
Subscribers subscribe to changes in the Publisher using a
Subscription
Publisher noti es of changes in its state
Publisher is not aware of the Subscriber's details
7 . 3
loose coupling
Allows for easy scalability using a common Message Bus
Message Broker can be as sophisticated or as dumb as needed
7 . 4
Data StreamsData Streams
A sequence of elements from a collection or data source
Pipes data from a source to a destination
Enforces statelessness (and immutability)
Easily parallellised
Allows chaining of Functional Operators
In Java implemented plainly as Streams
8 . 2
Functional Operator ChainingFunctional Operator Chaining
8 . 3
Functional Operator ChainingFunctional Operator Chaining
8 . 4
Functional Operator ChainingFunctional Operator Chaining
8 . 5
8 . 6
Let's Get Technical!Let's Get Technical!
9
Reactive and Java 8 & 9Reactive and Java 8 & 9
Paradigm shiftParadigm shift
10 . 2
Implementation of Streams as of Java 8Implementation of Streams as of Java 8
Use ofUse of Stream/Functional OperatorsStream/Functional Operators
Intermediate Operators
Terminal Operators
List <Integer> numbers = List.of(2,3,4,5,6);
numbers.stream().filter(number -> number > 4).forEach(num -> System.out.println(num));
10 . 3
PublisherPublisher
10 . 4
SubscriberSubscriber
10 . 5
SubscriptionSubscription
10 . 6
SpringSpring
A Java framework for enterprise quality applications
Dependency Injection and Inversion of Control
Convention over con guration
Annotation based
Provides a large tool set to quickly get up and running e.g. Spring Boot
11 . 2
Spring Reactive Data TypesSpring Reactive Data Types
11 . 3
11 . 4
Let's try all this out !Let's try all this out !
Let's pretend to process feeds from socialLet's pretend to process feeds from social
networks ...networks ...
That's it!That's it!
In this talk we've learned:In this talk we've learned:
What Reactive Programming is and why it's useful
The core concepts used to implement Reactive
Which industry tools are used to develop Reactive applications
13
Questions?Questions?
14
thx! <3thx! <3
Additional ReadingAdditional Reading
Reactive Manifesto
Reactive Spring
Josh Long - Spring Reactive
Intro to Rx
ReactiveX
Reactive Streams Spec
15

More Related Content

Similar to Being Reactive with Spring

Reactive Java Robotics & IoT with Spring Reactor
Reactive Java Robotics & IoT with Spring ReactorReactive Java Robotics & IoT with Spring Reactor
Reactive Java Robotics & IoT with Spring Reactor
Trayan Iliev
 
How to Migrate Applications Off a Mainframe
How to Migrate Applications Off a MainframeHow to Migrate Applications Off a Mainframe
How to Migrate Applications Off a Mainframe
VMware Tanzu
 

Similar to Being Reactive with Spring (20)

Reactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJavaReactive Programming on Android - RxAndroid - RxJava
Reactive Programming on Android - RxAndroid - RxJava
 
App Mod 03: Monoliths to microservices with java ee and spring boot
App Mod 03: Monoliths to microservices with java ee and spring bootApp Mod 03: Monoliths to microservices with java ee and spring boot
App Mod 03: Monoliths to microservices with java ee and spring boot
 
Real-World Pulsar Architectural Patterns
Real-World Pulsar Architectural PatternsReal-World Pulsar Architectural Patterns
Real-World Pulsar Architectural Patterns
 
Spring Book – Chapter 1 – Introduction
Spring Book – Chapter 1 – IntroductionSpring Book – Chapter 1 – Introduction
Spring Book – Chapter 1 – Introduction
 
Why meteor
Why meteorWhy meteor
Why meteor
 
RxJava pour Android : présentation lors du GDG Android Montréal
RxJava pour Android : présentation lors du GDG Android MontréalRxJava pour Android : présentation lors du GDG Android Montréal
RxJava pour Android : présentation lors du GDG Android Montréal
 
Enabling Lean at Enterprise Scale: Lean Engineering in Action
Enabling Lean at Enterprise Scale: Lean Engineering in ActionEnabling Lean at Enterprise Scale: Lean Engineering in Action
Enabling Lean at Enterprise Scale: Lean Engineering in Action
 
Reactive Java Robotics & IoT with Spring Reactor
Reactive Java Robotics & IoT with Spring ReactorReactive Java Robotics & IoT with Spring Reactor
Reactive Java Robotics & IoT with Spring Reactor
 
Client-side Development 2016
Client-side Development 2016Client-side Development 2016
Client-side Development 2016
 
6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
 
Virtualising Tier 1 Apps
Virtualising Tier 1 AppsVirtualising Tier 1 Apps
Virtualising Tier 1 Apps
 
Building and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowBuilding and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache Airflow
 
Project Reactor Now and Tomorrow
Project Reactor Now and TomorrowProject Reactor Now and Tomorrow
Project Reactor Now and Tomorrow
 
Building a full-stack app with Golang and Google Cloud Platform in one week
Building a full-stack app with Golang and Google Cloud Platform in one weekBuilding a full-stack app with Golang and Google Cloud Platform in one week
Building a full-stack app with Golang and Google Cloud Platform in one week
 
Lean Engineering: How to make Engineering a full Lean UX partner
Lean Engineering: How to make Engineering a full Lean UX partnerLean Engineering: How to make Engineering a full Lean UX partner
Lean Engineering: How to make Engineering a full Lean UX partner
 
Onion Architecture with S#arp
Onion Architecture with S#arpOnion Architecture with S#arp
Onion Architecture with S#arp
 
Framework Engineering 2.1
Framework Engineering 2.1Framework Engineering 2.1
Framework Engineering 2.1
 
How to Migrate Applications Off a Mainframe
How to Migrate Applications Off a MainframeHow to Migrate Applications Off a Mainframe
How to Migrate Applications Off a Mainframe
 
Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...
Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...
Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...
 
Cloud-Native Modernization or Death? A false dichotomy. | DevNation Tech Talk
Cloud-Native Modernization or Death? A false dichotomy. | DevNation Tech TalkCloud-Native Modernization or Death? A false dichotomy. | DevNation Tech Talk
Cloud-Native Modernization or Death? A false dichotomy. | DevNation Tech Talk
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Recently uploaded (20)

Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

Being Reactive with Spring

  • 1. Being Reactive with SpringBeing Reactive with Spring Kris Galea 1
  • 2. What's all this about?!What's all this about?! Being Reactive .. huh ?Being Reactive .. huh ? Nothing to do with Facebook's React Framework! Face the challenges of popularity Building robust applications for when it matters most ..with.. Spring?..with.. Spring? Java framework better than sliced bread (or ftira) Java!Java!
  • 3. What's all this Reactive-ness?!What's all this Reactive-ness?! This fantastic thing called "The Internet" Di culties in dealing with growing number of requests Get to grips with the idea of Reactive Programming 2 . 2
  • 4. Let's get some things straight!Let's get some things straight! Publisher-Subscriber Messaging Pattern Data Streams Get technical ...Get technical ... Java 8/9 Spring 5 Super exciting demo of Reactive Spring!Super exciting demo of Reactive Spring! 2 . 3
  • 5. But rst! A little about us ...But rst! A little about us ... Hi!Hi!
  • 6. and something about yours truly...and something about yours truly... Email: kristiang@ccbill.comEmail: kristiang@ccbill.com Github: https://github.com/krisgaleaGithub: https://github.com/krisgalea Slides:Slides: https://www.slideshare.net/KrisGalea/being-https://www.slideshare.net/KrisGalea/being- reactive-with-springreactive-with-spring 3 . 2
  • 7. Where all this began ...Where all this began ... Welcome to ...Welcome to ... The InternetThe Internet
  • 8. The internet is growingThe internet is growing 4 . 2
  • 9. Challenges of a Growing InternetChallenges of a Growing Internet Number of requests increases E-Commerce: businesses are now online Multiple ways of scaling: hardware vs. software Maintaining consistency come rain or shine 4 . 3
  • 10. Let's talk ReactiveLet's talk Reactive
  • 11. A Set of Principles/GuidelinesA Set of Principles/Guidelines A software oriented approach to robustness Not, strictly speaking, anything technical A set of guidelines which motivate design decisions made from the ground up A way to ensure that applications are built to withstand the di culties of modern necessities 5 . 2
  • 12. One Manifesto to Rule them all ...One Manifesto to Rule them all ... 5 . 3
  • 13. Technically speaking ...Technically speaking ... Use of functional approach to allow an application to react to changes in the environment as they happen vs Use of data streams to transmit changes from the source to the destination Use of the publisher-subscriber pattern a:= b + c a:= changing(b) + changing(c) 5 . 4
  • 14. Let's try this out ...Let's try this out ... 5 . 5
  • 15. A word about Backpressure...A word about Backpressure... Hot vs Cold message emitting Push vs Pull vs Hybrid-push-pull 5 . 6
  • 16. Let's Get Down to Basics ...Let's Get Down to Basics ... 6
  • 18. Messaging Pattern (architectural) 3 main actors: Publisher , Subscriber and Subscription 7 . 2
  • 19. Subscribers subscribe to changes in the Publisher using a Subscription Publisher noti es of changes in its state Publisher is not aware of the Subscriber's details 7 . 3
  • 20. loose coupling Allows for easy scalability using a common Message Bus Message Broker can be as sophisticated or as dumb as needed 7 . 4
  • 22. A sequence of elements from a collection or data source Pipes data from a source to a destination Enforces statelessness (and immutability) Easily parallellised Allows chaining of Functional Operators In Java implemented plainly as Streams 8 . 2
  • 23. Functional Operator ChainingFunctional Operator Chaining 8 . 3
  • 24. Functional Operator ChainingFunctional Operator Chaining 8 . 4
  • 25. Functional Operator ChainingFunctional Operator Chaining 8 . 5
  • 26. 8 . 6
  • 27. Let's Get Technical!Let's Get Technical! 9
  • 28. Reactive and Java 8 & 9Reactive and Java 8 & 9
  • 30. Implementation of Streams as of Java 8Implementation of Streams as of Java 8 Use ofUse of Stream/Functional OperatorsStream/Functional Operators Intermediate Operators Terminal Operators List <Integer> numbers = List.of(2,3,4,5,6); numbers.stream().filter(number -> number > 4).forEach(num -> System.out.println(num)); 10 . 3
  • 35. A Java framework for enterprise quality applications Dependency Injection and Inversion of Control Convention over con guration Annotation based Provides a large tool set to quickly get up and running e.g. Spring Boot 11 . 2
  • 36. Spring Reactive Data TypesSpring Reactive Data Types 11 . 3
  • 38. Let's try all this out !Let's try all this out ! Let's pretend to process feeds from socialLet's pretend to process feeds from social networks ...networks ...
  • 39. That's it!That's it! In this talk we've learned:In this talk we've learned: What Reactive Programming is and why it's useful The core concepts used to implement Reactive Which industry tools are used to develop Reactive applications 13
  • 41. thx! <3thx! <3 Additional ReadingAdditional Reading Reactive Manifesto Reactive Spring Josh Long - Spring Reactive Intro to Rx ReactiveX Reactive Streams Spec 15