SlideShare a Scribd company logo
1 of 13
Download to read offline
Reactive Programming with Spring
Petru Flueras
Software Architect - Visma Software
@pflueras
Imperative programming
● Imperative programming is a programming paradigm that uses statements
that change a program's state
○ Statements: conditional statements, loop statements, algorithms, control flow
○ You tell the computer how to do things - low level instructions closer to hardware
○ Higher cyclomatic complexity, less cleaner code, more difficult to test
● Real world example: hey waiter, I want to order a salad, but if the cheese is
too salted then please don’t add olives. Instead you could add more corn!
Declarative programming
● Is a programming paradigm that expresses the logic of a computation without
describing its control flow
○ Less direct control, without going into implementation details!
○ Tell the computer what to do, without specifying how!
○ You create expressions instead of statements + evaluate functions
● Real world example: Hey waiter, I want to order a slightly salted salad!
Exercise 1: Imperative & Declarative
Exercise 1: Imperative
Exercise 2: Declarative
Reactive programming
● Declarative event-based
● Subset of asynchronous programming where the availability of new
information drives the logic forward rather than having control flow driven by a
thread-of-execution
● It supports decomposing the problem into multiple discrete steps where
each can be executed in an asynchronous and non-blocking fashion, and
then be composed to produce a workflow (~ data streams)
● Contention is the biggest enemy of scalability. Reactive program should
rarely, if ever, have to block
Reactive manifesto
Reactive systems are:
● Responsive
● Resilient
● Elastic
● Message Driven
https://www.reactivemanifesto.org/
Reactive Streams + Spring
● Reactive Streams Specification
○ Publisher + Subscriber
○ http://www.reactive-streams.org/
○ JDK 9!
● Project Reactor (Reactive Streams implementation)
○ Flux<T>, Mono<T>
● Spring WebFlux
○ ReactiveCrudRepository, ReactiveMongoRepository, ReactiveRedis*, RouterFunction, …
DEMO!
Spring MVC
Spring WebFlux
Thank you!

More Related Content

Similar to Reactive Programming with Spring

PLC unit 4 lab Brett Bloomberg-1
PLC unit 4 lab Brett Bloomberg-1PLC unit 4 lab Brett Bloomberg-1
PLC unit 4 lab Brett Bloomberg-1
Brett Bloomberg
 

Similar to Reactive Programming with Spring (20)

Monitoring and automation
Monitoring and automationMonitoring and automation
Monitoring and automation
 
Understanding concurrency
Understanding concurrencyUnderstanding concurrency
Understanding concurrency
 
Event sourcing and CQRS
Event sourcing and CQRSEvent sourcing and CQRS
Event sourcing and CQRS
 
control technology of bachlor of engineering technology
control technology of bachlor of engineering technologycontrol technology of bachlor of engineering technology
control technology of bachlor of engineering technology
 
Wayfair Storefront Performance Monitoring with InfluxEnterprise by Richard La...
Wayfair Storefront Performance Monitoring with InfluxEnterprise by Richard La...Wayfair Storefront Performance Monitoring with InfluxEnterprise by Richard La...
Wayfair Storefront Performance Monitoring with InfluxEnterprise by Richard La...
 
Reactive declarative UI as code - DroidCon Vietnam 2019
Reactive declarative UI as code - DroidCon Vietnam 2019Reactive declarative UI as code - DroidCon Vietnam 2019
Reactive declarative UI as code - DroidCon Vietnam 2019
 
Performance tuning Grails applications
 Performance tuning Grails applications Performance tuning Grails applications
Performance tuning Grails applications
 
Understanding Simple Program Logic
Understanding Simple Program LogicUnderstanding Simple Program Logic
Understanding Simple Program Logic
 
Pi dfor dummies
Pi dfor dummiesPi dfor dummies
Pi dfor dummies
 
PLC unit 4 lab Brett Bloomberg-1
PLC unit 4 lab Brett Bloomberg-1PLC unit 4 lab Brett Bloomberg-1
PLC unit 4 lab Brett Bloomberg-1
 
Simplified Troubleshooting through API Scripting
Simplified Troubleshooting through API Scripting Simplified Troubleshooting through API Scripting
Simplified Troubleshooting through API Scripting
 
The Power of Refactoring
The Power of RefactoringThe Power of Refactoring
The Power of Refactoring
 
KSCOPE 2015 - Improving Reliability, Rollouts, Upgrades/Migrations
KSCOPE 2015 - Improving Reliability, Rollouts, Upgrades/MigrationsKSCOPE 2015 - Improving Reliability, Rollouts, Upgrades/Migrations
KSCOPE 2015 - Improving Reliability, Rollouts, Upgrades/Migrations
 
My first year with event sourcing-nijmegen
My first year with event sourcing-nijmegenMy first year with event sourcing-nijmegen
My first year with event sourcing-nijmegen
 
The Power Of Refactoring (PHPNW)
The Power Of Refactoring (PHPNW)The Power Of Refactoring (PHPNW)
The Power Of Refactoring (PHPNW)
 
My first year with event sourcing amersfoort 12-06-2018
My first year with event sourcing amersfoort 12-06-2018My first year with event sourcing amersfoort 12-06-2018
My first year with event sourcing amersfoort 12-06-2018
 
Retrofitting a legacy SPA to use a functional architecture
Retrofitting a legacy SPA to use a functional architectureRetrofitting a legacy SPA to use a functional architecture
Retrofitting a legacy SPA to use a functional architecture
 
My first year with event sourcing-symfonycon
My first year with event sourcing-symfonyconMy first year with event sourcing-symfonycon
My first year with event sourcing-symfonycon
 
Performance tuning Grails applications
Performance tuning Grails applicationsPerformance tuning Grails applications
Performance tuning Grails applications
 
Getting big without getting fat, in perl
Getting big without getting fat, in perlGetting big without getting fat, in perl
Getting big without getting fat, in perl
 

Recently uploaded

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Recently uploaded (20)

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 🔝✔️✔️
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
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...
 
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...
 
%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
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
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
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
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
 
%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
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
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
 
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
 

Reactive Programming with Spring

  • 1. Reactive Programming with Spring Petru Flueras Software Architect - Visma Software @pflueras
  • 2. Imperative programming ● Imperative programming is a programming paradigm that uses statements that change a program's state ○ Statements: conditional statements, loop statements, algorithms, control flow ○ You tell the computer how to do things - low level instructions closer to hardware ○ Higher cyclomatic complexity, less cleaner code, more difficult to test ● Real world example: hey waiter, I want to order a salad, but if the cheese is too salted then please don’t add olives. Instead you could add more corn!
  • 3. Declarative programming ● Is a programming paradigm that expresses the logic of a computation without describing its control flow ○ Less direct control, without going into implementation details! ○ Tell the computer what to do, without specifying how! ○ You create expressions instead of statements + evaluate functions ● Real world example: Hey waiter, I want to order a slightly salted salad!
  • 4. Exercise 1: Imperative & Declarative
  • 7. Reactive programming ● Declarative event-based ● Subset of asynchronous programming where the availability of new information drives the logic forward rather than having control flow driven by a thread-of-execution ● It supports decomposing the problem into multiple discrete steps where each can be executed in an asynchronous and non-blocking fashion, and then be composed to produce a workflow (~ data streams) ● Contention is the biggest enemy of scalability. Reactive program should rarely, if ever, have to block
  • 8. Reactive manifesto Reactive systems are: ● Responsive ● Resilient ● Elastic ● Message Driven https://www.reactivemanifesto.org/
  • 9. Reactive Streams + Spring ● Reactive Streams Specification ○ Publisher + Subscriber ○ http://www.reactive-streams.org/ ○ JDK 9! ● Project Reactor (Reactive Streams implementation) ○ Flux<T>, Mono<T> ● Spring WebFlux ○ ReactiveCrudRepository, ReactiveMongoRepository, ReactiveRedis*, RouterFunction, …
  • 10. DEMO!