SlideShare a Scribd company logo
1 of 40
Download to read offline
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
(Rx + Reactive Streams + Spring) % Java 8 =
Reactor 2.5
Stéphane Maldini
@smaldlini
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Stéphane Maldini
• Survive in London
• Reactive Engineering @
• Project Reactor lead
• Reactive Streams & 

Reactive Streams Commons contributor
• Works on Spring Framework 5

upcoming Reactive support
• @smaldini on Twitter
2
+
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Do you need to be “reactive” ?
If you ask then you probably don’t.
3
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
How much faster is it ?
It’s slower than your usual imperative system.
4
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 5
Is it good at anything beyond pretending ?
Yes. It scales with the request volume.
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 6
But remember it changes the way you think code. 

It’s definitely a michelin star lunch.
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Swipe Right - it’s a match
• Mobile/IoT backend API
• Server-to-Server communications (HTTP…)
• Unreliable clients
• Big Data
• Mutualized Resources (Cloud…)
• User Interfaces
7
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Reactive, what the sh*t?
8
More details on http://fr.slideshare.net/StphaneMaldini/intro-to-reactive-programming-52821416
• Reactive is used to broadly define event-driven systems
• Reactive Manifesto defines qualities of reactive systems
• Reactive programming: moving imperative logic to async, non-
blocking, functional-style code, in particular when interacting
with “time consuming” resources
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
For reactive programming, we need tools :
☐ Reactive Streams
☐ Reactive APIs
9
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Reactive Streams
• Reactive Streams is a protocol for asynchronous stream
processing with non-blocking backpressure
• De facto standard for interop between reactive libraries
• To be included in Java 9 as java.util.concurrent.Flow
10
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Reactive Streams principle
11
Publisher SubscriberData
Demand
• Max(InflightData) <= demand
• No data sent without demand
• Demand can be unbounded
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Reactive Streams is 3+1 interfaces (+ a TCK)
1215
onSubscribe
onNext*
(onError|onComplete)?
Publisher
Subscriber
Subscription
request(n)
cancel()
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Reactive Streams offers Quality of Service for the JVM
Bounded hardware use and flow prioritization
13
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Imperative vs Reactive Streams ?
14
User rickSanchez =
userRepository.findUser(“rick”);
Blocking, not
returning until done !
Might throw
exceptions
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
If this blocks, and runs on a serving HTTP request ?
If the calling HTTP requests come from another “Microservice” ?
If that Microservice is also calling in a blocking way ?
If you solve scalability issues by scaling out ?
If you agreed to pay the scalability tax, how far can it help you ?
Thinking about the big picture
15
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Imperative vs Reactive Streams ?
16
Publisher<User> rickSanchez =
userRepository.findUser(“rick”);
rickSanchez.subscribe(new Subscriber<User>(){ … });
Might send 0, 1 or N Users ! Non Blocking - on demand data emission
Callback for start, result, error or complete
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
How practical is Publisher ?
17
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Do you want to implement Publisher yourself ?
Probably not, usually.
18
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
For reactive programming, we need tools :
☑ Reactive Streams
☐ Reactive APIs
19
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
• Transform, Combine, Timebox, Aggregate, Consume…
• On the JVM:
• Reactor 2.5 is 4th generation* and based on Reactive Streams
• RxJava 1.x: 2nd generation* and most used implementation
• Akka Stream 2.x: Lightbend 3rd generation* Reactive API
• Also for other languages, for example RxJS, MostJS
Reactive APIs
20
* Based on http://akarnokd.blogspot.fr/2016/03/operator-fusion-part-1.html
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Reactor 2.5 ecosystem
21
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Reactor Core 2.5
• Cross collaboration with Dávid Karnok (RxJava) and some
Spring Framework committers
• Natively based on Reactive Streams, RSC* and Java 8+
• 2 new rich Publisher types : Flux & Mono
• Strong focus on efficiency
• Ever-improving debugging, logging, testing capabilities
* ReactiveStreamsCommons is a research effort about reactive flows
22
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Flux (0..N elements) with ReactiveX compliant API
23
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Mono (0..1 element)
24
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Imperative vs Reactor ?
25
Mono<User> rickSanchez =
userRepository.findUser(“rick”);
rickSanchez.consume(this::userHandler,
this::errorHandler)
Single Typed Publisher !
Start the Mono and consume
its result or error.
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Mono, a single-data-at-most API
26
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Flux, classic Rx patterns for 0..N events
27
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Visual (Marble) doc for Flux & Mono
28
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Reactor Web Console (preview)
29
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Concurrency Types Cheat Sheet
30
No value Single value Multiple values
Blocking void T

Future<T>
Iterable<T>
Collection<T>
Stream<T>
Non-
blocking
CompletableFuture<Void> CompletableFuture<T> CompletableFuture<List<T>>
Reactive

Streams
Publisher<Void> Publisher<T> Publisher<T>
RxJava Observable<Void>
Completable (1.1.1)
Observable<T>
Single<T> (1.0.13)
Observable<T>
Reactor Mono<Void> Mono<T> Flux<T>
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
https://spring.io/blog/2016/04/19/understanding-reactive-types
31
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Reactive Spring
32
• Spring projects are going reactive
• Reactor Core is the reactive foundation
• RxJava support provided out of the box
• You will be able to choose your web engine:

Tomcat, Jetty, Undertow or Netty
• Most impact on Web and Data support (IO intensive)
• Spring Reactive experiment
• Spring Reactive Playground sample application
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Well known Controller example
33
@RestController	
public	class	UserController	{	
	 private	BlockingRepository<User>	repository;	
	 @RequestMapping(path	=	"/save-capitalized",	method	=	RequestMethod.POST)	
	 public	void	saveCapitalized(@RequestBody	List<User>	users)	{	
	 	 users.forEach(u	->	u.setName(u.getName().toUpperCase()));	
	 	 repository.save(users);	
	 }	
}
public	interface	BlockingRepository<T>	{	
	 void	save(List<T>	elements);	
	 Iterable<T>	findAll();	
}
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Controller with Reactive types
34
@RestController	
public	class	UserController	{	
	 private	ReactiveRepository<User>	repository;	
	 @RequestMapping(path	=	"/save-capitalized",	method	=	RequestMethod.POST)	
	 public	Mono<Void>	saveCapitalized(@RequestBody	Flux<User>	users)	{	
	 	 return	repository.save(users.map(u	->	new	User(u.getName().toUpperCase()));	
	 }	
}	
public	interface	ReactiveRepository<T>	{	
	 Mono<Void>	save(Publisher<T>	elements);	
Flux<T>	findAll();	
}
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Blocking vs Reactive: memory consumption
35
Memoryconsumption
Time
Blocking Reactive
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Blocking vs Reactive: streaming updates
36
Numberofuserssaved
inthedatabase
Time
Blocking Reactive
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Controller with Reactive return values
37
@RestController	
public	class	UserController	{	
	 private	ReactiveRepository<User>	repository;	
	 @RequestMapping(path	=	"/",	method	=	RequestMethod.GET)	
	 public	Flux<User>	findAll()	{	
	 	 return	repository.findAll();	
	 }	
}	
• Optimized serialization when using Flux instead of List
• Also perfectly suitable for Server-Sent Events
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Reactive HTTP client with Mono
38
import	static	org.springframework.web.client.reactive.HttpRequestBuilders.*;	
import	static	org.springframework.web.client.reactive.WebResponseExtractors.*;	
Mono<Person>	result	=	webClient	
		.perform(get("http://localhost:8080/person")	
		.header("X-Test-Header",	"testvalue")	
		.accept(MediaType.APPLICATION_JSON))	
		.extract(body(Person.class));
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Reactive HTTP client with Flux
39
import	static	org.springframework.web.client.reactive.HttpRequestBuilders.*;	
import	static	org.springframework.web.client.reactive.WebResponseExtractors.*;	
Flux<Person>	response	=	webClient	
		.perform(get("http://localhost:8080/persons")	
		.accept(MediaType.APPLICATION_JSON))	
		.extract(bodyStream(Person.class));
Works for:
• JSON array [{"foo":"bar"},{"foo":"baz"}]
• JSON Streaming {"foo":"bar"}{"foo":"baz"}
• SSE with something like .extract(sseStream(Person.class))
Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Do you want to learn and play at the same time ?
Get Factorio on Steam for a few coins
40

More Related Content

What's hot

To Microservices and Beyond
To Microservices and BeyondTo Microservices and Beyond
To Microservices and BeyondMatt Stine
 
Core Spring + Reactive 김민석
Core Spring + Reactive  김민석Core Spring + Reactive  김민석
Core Spring + Reactive 김민석VMware Tanzu Korea
 
High Performance Cloud Native APIs Using Apache Geode
High Performance Cloud Native APIs Using Apache Geode High Performance Cloud Native APIs Using Apache Geode
High Performance Cloud Native APIs Using Apache Geode VMware Tanzu
 
You Want to Kubernetes? You MUST Know Containers!
You Want to Kubernetes? You MUST Know Containers!You Want to Kubernetes? You MUST Know Containers!
You Want to Kubernetes? You MUST Know Containers!VMware Tanzu
 
Simplifying Apache Geode with Spring Data
Simplifying Apache Geode with Spring DataSimplifying Apache Geode with Spring Data
Simplifying Apache Geode with Spring DataVMware Tanzu
 
Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...
Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...
Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...VMware Tanzu
 
Microservices + Oracle: A Bright Future
Microservices + Oracle: A Bright FutureMicroservices + Oracle: A Bright Future
Microservices + Oracle: A Bright FutureKelly Goetsch
 
Running your Spring Apps in the Cloud Javaone 2014
Running your Spring Apps in the Cloud Javaone 2014Running your Spring Apps in the Cloud Javaone 2014
Running your Spring Apps in the Cloud Javaone 2014cornelia davis
 
Getting Groovy with JHipster and Micronaut
Getting Groovy with JHipster and MicronautGetting Groovy with JHipster and Micronaut
Getting Groovy with JHipster and MicronautZachary Klein
 
Under the Hood of Reactive Data Access (2/2)
Under the Hood of Reactive Data Access (2/2)Under the Hood of Reactive Data Access (2/2)
Under the Hood of Reactive Data Access (2/2)VMware Tanzu
 
Micronaut: Changing the Micro Future
Micronaut: Changing the Micro FutureMicronaut: Changing the Micro Future
Micronaut: Changing the Micro FutureZachary Klein
 
Kubernetes and lastminute.com: our course towards better scalability and proc...
Kubernetes and lastminute.com: our course towards better scalability and proc...Kubernetes and lastminute.com: our course towards better scalability and proc...
Kubernetes and lastminute.com: our course towards better scalability and proc...Michele Orsi
 
Welcome to the Metrics
Welcome to the MetricsWelcome to the Metrics
Welcome to the MetricsVMware Tanzu
 
Improving Your Company’s Health with Middleware Takeout
Improving Your Company’s Health with Middleware TakeoutImproving Your Company’s Health with Middleware Takeout
Improving Your Company’s Health with Middleware TakeoutVMware Tanzu
 
Declarative Infrastructure with Cloud Foundry BOSH
Declarative Infrastructure with Cloud Foundry BOSHDeclarative Infrastructure with Cloud Foundry BOSH
Declarative Infrastructure with Cloud Foundry BOSHcornelia davis
 
Grails 4: Upgrade your Game!
Grails 4: Upgrade your Game!Grails 4: Upgrade your Game!
Grails 4: Upgrade your Game!Zachary Klein
 
DevOps and Continuous Delivery Reference Architectures - Volume 2
DevOps and Continuous Delivery Reference Architectures - Volume 2DevOps and Continuous Delivery Reference Architectures - Volume 2
DevOps and Continuous Delivery Reference Architectures - Volume 2Sonatype
 
Under the Hood of Reactive Data Access (1/2)
Under the Hood of Reactive Data Access (1/2)Under the Hood of Reactive Data Access (1/2)
Under the Hood of Reactive Data Access (1/2)VMware Tanzu
 
Implementing Microservices with Jakarta EE and MicroProfile
Implementing Microservices with Jakarta EE and MicroProfileImplementing Microservices with Jakarta EE and MicroProfile
Implementing Microservices with Jakarta EE and MicroProfileKevin Sutter
 

What's hot (20)

To Microservices and Beyond
To Microservices and BeyondTo Microservices and Beyond
To Microservices and Beyond
 
Core Spring + Reactive 김민석
Core Spring + Reactive  김민석Core Spring + Reactive  김민석
Core Spring + Reactive 김민석
 
High Performance Cloud Native APIs Using Apache Geode
High Performance Cloud Native APIs Using Apache Geode High Performance Cloud Native APIs Using Apache Geode
High Performance Cloud Native APIs Using Apache Geode
 
You Want to Kubernetes? You MUST Know Containers!
You Want to Kubernetes? You MUST Know Containers!You Want to Kubernetes? You MUST Know Containers!
You Want to Kubernetes? You MUST Know Containers!
 
Simplifying Apache Geode with Spring Data
Simplifying Apache Geode with Spring DataSimplifying Apache Geode with Spring Data
Simplifying Apache Geode with Spring Data
 
Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...
Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...
Automated Virtualized Testing (AVT) with Docker, Kubernetes, WireMock and Gat...
 
Microservices + Oracle: A Bright Future
Microservices + Oracle: A Bright FutureMicroservices + Oracle: A Bright Future
Microservices + Oracle: A Bright Future
 
Running your Spring Apps in the Cloud Javaone 2014
Running your Spring Apps in the Cloud Javaone 2014Running your Spring Apps in the Cloud Javaone 2014
Running your Spring Apps in the Cloud Javaone 2014
 
From Monolith to K8s - Spring One 2020
From Monolith to K8s - Spring One 2020From Monolith to K8s - Spring One 2020
From Monolith to K8s - Spring One 2020
 
Getting Groovy with JHipster and Micronaut
Getting Groovy with JHipster and MicronautGetting Groovy with JHipster and Micronaut
Getting Groovy with JHipster and Micronaut
 
Under the Hood of Reactive Data Access (2/2)
Under the Hood of Reactive Data Access (2/2)Under the Hood of Reactive Data Access (2/2)
Under the Hood of Reactive Data Access (2/2)
 
Micronaut: Changing the Micro Future
Micronaut: Changing the Micro FutureMicronaut: Changing the Micro Future
Micronaut: Changing the Micro Future
 
Kubernetes and lastminute.com: our course towards better scalability and proc...
Kubernetes and lastminute.com: our course towards better scalability and proc...Kubernetes and lastminute.com: our course towards better scalability and proc...
Kubernetes and lastminute.com: our course towards better scalability and proc...
 
Welcome to the Metrics
Welcome to the MetricsWelcome to the Metrics
Welcome to the Metrics
 
Improving Your Company’s Health with Middleware Takeout
Improving Your Company’s Health with Middleware TakeoutImproving Your Company’s Health with Middleware Takeout
Improving Your Company’s Health with Middleware Takeout
 
Declarative Infrastructure with Cloud Foundry BOSH
Declarative Infrastructure with Cloud Foundry BOSHDeclarative Infrastructure with Cloud Foundry BOSH
Declarative Infrastructure with Cloud Foundry BOSH
 
Grails 4: Upgrade your Game!
Grails 4: Upgrade your Game!Grails 4: Upgrade your Game!
Grails 4: Upgrade your Game!
 
DevOps and Continuous Delivery Reference Architectures - Volume 2
DevOps and Continuous Delivery Reference Architectures - Volume 2DevOps and Continuous Delivery Reference Architectures - Volume 2
DevOps and Continuous Delivery Reference Architectures - Volume 2
 
Under the Hood of Reactive Data Access (1/2)
Under the Hood of Reactive Data Access (1/2)Under the Hood of Reactive Data Access (1/2)
Under the Hood of Reactive Data Access (1/2)
 
Implementing Microservices with Jakarta EE and MicroProfile
Implementing Microservices with Jakarta EE and MicroProfileImplementing Microservices with Jakarta EE and MicroProfile
Implementing Microservices with Jakarta EE and MicroProfile
 

Viewers also liked

Reactor 3.0, a reactive foundation for java 8 and Spring
Reactor 3.0, a reactive foundation for java 8 and SpringReactor 3.0, a reactive foundation for java 8 and Spring
Reactor 3.0, a reactive foundation for java 8 and SpringStéphane Maldini
 
Designing for Distributed Systems with Reactor and Reactive Streams
Designing for Distributed Systems with Reactor and Reactive StreamsDesigning for Distributed Systems with Reactor and Reactive Streams
Designing for Distributed Systems with Reactor and Reactive StreamsStéphane Maldini
 
An introduction to Reactive applications, Reactive Streams, and options for t...
An introduction to Reactive applications, Reactive Streams, and options for t...An introduction to Reactive applications, Reactive Streams, and options for t...
An introduction to Reactive applications, Reactive Streams, and options for t...Steve Pember
 
Going Reactive
Going ReactiveGoing Reactive
Going ReactiveRob Harrop
 
Reactive Streams: Handling Data-Flow the Reactive Way
Reactive Streams: Handling Data-Flow the Reactive WayReactive Streams: Handling Data-Flow the Reactive Way
Reactive Streams: Handling Data-Flow the Reactive WayRoland Kuhn
 
The Java Microservice Library
The Java Microservice LibraryThe Java Microservice Library
The Java Microservice LibraryRick Hightower
 
Clouds & Containers: Hit the High Points and Give it to Me Straight, What's t...
Clouds & Containers: Hit the High Points and Give it to Me Straight, What's t...Clouds & Containers: Hit the High Points and Give it to Me Straight, What's t...
Clouds & Containers: Hit the High Points and Give it to Me Straight, What's t...Mark Heckler
 
Going Reactive with Spring 5 & Project Reactor
Going Reactive with Spring 5 & Project ReactorGoing Reactive with Spring 5 & Project Reactor
Going Reactive with Spring 5 & Project ReactorMark Heckler
 

Viewers also liked (8)

Reactor 3.0, a reactive foundation for java 8 and Spring
Reactor 3.0, a reactive foundation for java 8 and SpringReactor 3.0, a reactive foundation for java 8 and Spring
Reactor 3.0, a reactive foundation for java 8 and Spring
 
Designing for Distributed Systems with Reactor and Reactive Streams
Designing for Distributed Systems with Reactor and Reactive StreamsDesigning for Distributed Systems with Reactor and Reactive Streams
Designing for Distributed Systems with Reactor and Reactive Streams
 
An introduction to Reactive applications, Reactive Streams, and options for t...
An introduction to Reactive applications, Reactive Streams, and options for t...An introduction to Reactive applications, Reactive Streams, and options for t...
An introduction to Reactive applications, Reactive Streams, and options for t...
 
Going Reactive
Going ReactiveGoing Reactive
Going Reactive
 
Reactive Streams: Handling Data-Flow the Reactive Way
Reactive Streams: Handling Data-Flow the Reactive WayReactive Streams: Handling Data-Flow the Reactive Way
Reactive Streams: Handling Data-Flow the Reactive Way
 
The Java Microservice Library
The Java Microservice LibraryThe Java Microservice Library
The Java Microservice Library
 
Clouds & Containers: Hit the High Points and Give it to Me Straight, What's t...
Clouds & Containers: Hit the High Points and Give it to Me Straight, What's t...Clouds & Containers: Hit the High Points and Give it to Me Straight, What's t...
Clouds & Containers: Hit the High Points and Give it to Me Straight, What's t...
 
Going Reactive with Spring 5 & Project Reactor
Going Reactive with Spring 5 & Project ReactorGoing Reactive with Spring 5 & Project Reactor
Going Reactive with Spring 5 & Project Reactor
 

Similar to Introduction to Reactive Streams and Reactor 2.5

Intro to Reactive Programming
Intro to Reactive ProgrammingIntro to Reactive Programming
Intro to Reactive ProgrammingStéphane Maldini
 
Ratpack - SpringOne2GX 2015
Ratpack - SpringOne2GX 2015Ratpack - SpringOne2GX 2015
Ratpack - SpringOne2GX 2015Daniel Woods
 
12 Factor, or Cloud Native Apps – What EXACTLY Does that Mean for Spring Deve...
12 Factor, or Cloud Native Apps – What EXACTLY Does that Mean for Spring Deve...12 Factor, or Cloud Native Apps – What EXACTLY Does that Mean for Spring Deve...
12 Factor, or Cloud Native Apps – What EXACTLY Does that Mean for Spring Deve...cornelia davis
 
SpringOnePlatform2017 recap
SpringOnePlatform2017 recapSpringOnePlatform2017 recap
SpringOnePlatform2017 recapminseok kim
 
IO State In Distributed API Architecture
IO State In Distributed API ArchitectureIO State In Distributed API Architecture
IO State In Distributed API ArchitectureOwen Rubel
 
Developing Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache KafkaDeveloping Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache KafkaJoe Stein
 
Designing, Implementing, and Using Reactive APIs
Designing, Implementing, and Using Reactive APIsDesigning, Implementing, and Using Reactive APIs
Designing, Implementing, and Using Reactive APIsVMware Tanzu
 
YugaByte DB—A Planet-Scale Database for Low Latency Transactional Apps
YugaByte DB—A Planet-Scale Database for Low Latency Transactional AppsYugaByte DB—A Planet-Scale Database for Low Latency Transactional Apps
YugaByte DB—A Planet-Scale Database for Low Latency Transactional AppsVMware Tanzu
 
P to V to C: The Value of Bringing “Everything” to Containers
P to V to C: The Value of Bringing “Everything” to ContainersP to V to C: The Value of Bringing “Everything” to Containers
P to V to C: The Value of Bringing “Everything” to ContainersVMware Tanzu
 
Migrating to Angular 5 for Spring Developers
Migrating to Angular 5 for Spring DevelopersMigrating to Angular 5 for Spring Developers
Migrating to Angular 5 for Spring DevelopersGunnar Hillert
 
Spring Cloud Gateway - Ryan Baxter
Spring Cloud Gateway - Ryan BaxterSpring Cloud Gateway - Ryan Baxter
Spring Cloud Gateway - Ryan BaxterVMware Tanzu
 
Marcin Grzejszczak - Contract Tests in the Enterprise
Marcin Grzejszczak - Contract Tests in the EnterpriseMarcin Grzejszczak - Contract Tests in the Enterprise
Marcin Grzejszczak - Contract Tests in the EnterpriseSegFaultConf
 
Spring Cloud Gateway - Ryan Baxter
Spring Cloud Gateway - Ryan BaxterSpring Cloud Gateway - Ryan Baxter
Spring Cloud Gateway - Ryan BaxterVMware Tanzu
 
Extending the Platform with Spring Boot and Cloud Foundry
Extending the Platform with Spring Boot and Cloud FoundryExtending the Platform with Spring Boot and Cloud Foundry
Extending the Platform with Spring Boot and Cloud FoundryKenny Bastani
 
Migrating to Angular 4 for Spring Developers
Migrating to Angular 4 for Spring Developers Migrating to Angular 4 for Spring Developers
Migrating to Angular 4 for Spring Developers VMware Tanzu
 
Cloud Native Java with Spring Cloud Services
Cloud Native Java with Spring Cloud ServicesCloud Native Java with Spring Cloud Services
Cloud Native Java with Spring Cloud ServicesVMware Tanzu
 
State of Securing Restful APIs s12gx2015
State of Securing Restful APIs s12gx2015State of Securing Restful APIs s12gx2015
State of Securing Restful APIs s12gx2015robwinch
 
Extending the Platform
Extending the PlatformExtending the Platform
Extending the PlatformVMware Tanzu
 
riffing on Knative - Scott Andrews
riffing on Knative - Scott Andrewsriffing on Knative - Scott Andrews
riffing on Knative - Scott AndrewsVMware Tanzu
 
Living on the Edge With Spring Cloud Gateway - Cora Iberkleid
Living on the Edge With Spring Cloud Gateway - Cora IberkleidLiving on the Edge With Spring Cloud Gateway - Cora Iberkleid
Living on the Edge With Spring Cloud Gateway - Cora IberkleidVMware Tanzu
 

Similar to Introduction to Reactive Streams and Reactor 2.5 (20)

Intro to Reactive Programming
Intro to Reactive ProgrammingIntro to Reactive Programming
Intro to Reactive Programming
 
Ratpack - SpringOne2GX 2015
Ratpack - SpringOne2GX 2015Ratpack - SpringOne2GX 2015
Ratpack - SpringOne2GX 2015
 
12 Factor, or Cloud Native Apps – What EXACTLY Does that Mean for Spring Deve...
12 Factor, or Cloud Native Apps – What EXACTLY Does that Mean for Spring Deve...12 Factor, or Cloud Native Apps – What EXACTLY Does that Mean for Spring Deve...
12 Factor, or Cloud Native Apps – What EXACTLY Does that Mean for Spring Deve...
 
SpringOnePlatform2017 recap
SpringOnePlatform2017 recapSpringOnePlatform2017 recap
SpringOnePlatform2017 recap
 
IO State In Distributed API Architecture
IO State In Distributed API ArchitectureIO State In Distributed API Architecture
IO State In Distributed API Architecture
 
Developing Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache KafkaDeveloping Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache Kafka
 
Designing, Implementing, and Using Reactive APIs
Designing, Implementing, and Using Reactive APIsDesigning, Implementing, and Using Reactive APIs
Designing, Implementing, and Using Reactive APIs
 
YugaByte DB—A Planet-Scale Database for Low Latency Transactional Apps
YugaByte DB—A Planet-Scale Database for Low Latency Transactional AppsYugaByte DB—A Planet-Scale Database for Low Latency Transactional Apps
YugaByte DB—A Planet-Scale Database for Low Latency Transactional Apps
 
P to V to C: The Value of Bringing “Everything” to Containers
P to V to C: The Value of Bringing “Everything” to ContainersP to V to C: The Value of Bringing “Everything” to Containers
P to V to C: The Value of Bringing “Everything” to Containers
 
Migrating to Angular 5 for Spring Developers
Migrating to Angular 5 for Spring DevelopersMigrating to Angular 5 for Spring Developers
Migrating to Angular 5 for Spring Developers
 
Spring Cloud Gateway - Ryan Baxter
Spring Cloud Gateway - Ryan BaxterSpring Cloud Gateway - Ryan Baxter
Spring Cloud Gateway - Ryan Baxter
 
Marcin Grzejszczak - Contract Tests in the Enterprise
Marcin Grzejszczak - Contract Tests in the EnterpriseMarcin Grzejszczak - Contract Tests in the Enterprise
Marcin Grzejszczak - Contract Tests in the Enterprise
 
Spring Cloud Gateway - Ryan Baxter
Spring Cloud Gateway - Ryan BaxterSpring Cloud Gateway - Ryan Baxter
Spring Cloud Gateway - Ryan Baxter
 
Extending the Platform with Spring Boot and Cloud Foundry
Extending the Platform with Spring Boot and Cloud FoundryExtending the Platform with Spring Boot and Cloud Foundry
Extending the Platform with Spring Boot and Cloud Foundry
 
Migrating to Angular 4 for Spring Developers
Migrating to Angular 4 for Spring Developers Migrating to Angular 4 for Spring Developers
Migrating to Angular 4 for Spring Developers
 
Cloud Native Java with Spring Cloud Services
Cloud Native Java with Spring Cloud ServicesCloud Native Java with Spring Cloud Services
Cloud Native Java with Spring Cloud Services
 
State of Securing Restful APIs s12gx2015
State of Securing Restful APIs s12gx2015State of Securing Restful APIs s12gx2015
State of Securing Restful APIs s12gx2015
 
Extending the Platform
Extending the PlatformExtending the Platform
Extending the Platform
 
riffing on Knative - Scott Andrews
riffing on Knative - Scott Andrewsriffing on Knative - Scott Andrews
riffing on Knative - Scott Andrews
 
Living on the Edge With Spring Cloud Gateway - Cora Iberkleid
Living on the Edge With Spring Cloud Gateway - Cora IberkleidLiving on the Edge With Spring Cloud Gateway - Cora Iberkleid
Living on the Edge With Spring Cloud Gateway - Cora Iberkleid
 

More from Stéphane Maldini

Multi-service reactive streams using Spring, Reactor, RSocket
Multi-service reactive streams using Spring, Reactor, RSocketMulti-service reactive streams using Spring, Reactor, RSocket
Multi-service reactive streams using Spring, Reactor, RSocketStéphane Maldini
 
The Future of Reactive Architectures
The Future of Reactive ArchitecturesThe Future of Reactive Architectures
The Future of Reactive ArchitecturesStéphane Maldini
 
What's new in Reactor Californium
What's new in Reactor CaliforniumWhat's new in Reactor Californium
What's new in Reactor CaliforniumStéphane Maldini
 
Spring boot 2.0 reactive bits (June 2018)
Spring boot 2.0 reactive bits (June 2018)Spring boot 2.0 reactive bits (June 2018)
Spring boot 2.0 reactive bits (June 2018)Stéphane Maldini
 
Reactor, Reactive streams and MicroServices
Reactor, Reactive streams and MicroServicesReactor, Reactive streams and MicroServices
Reactor, Reactive streams and MicroServicesStéphane Maldini
 
Springone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and ReactorSpringone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and ReactorStéphane Maldini
 
Reactor grails realtime web devoxx 2013
Reactor grails realtime web   devoxx 2013Reactor grails realtime web   devoxx 2013
Reactor grails realtime web devoxx 2013Stéphane Maldini
 
Groovy reactor grails realtime web devoxx 2013
Groovy reactor grails realtime web   devoxx 2013Groovy reactor grails realtime web   devoxx 2013
Groovy reactor grails realtime web devoxx 2013Stéphane Maldini
 
Reactor spring one2gx_2013_0902-final
Reactor spring one2gx_2013_0902-finalReactor spring one2gx_2013_0902-final
Reactor spring one2gx_2013_0902-finalStéphane Maldini
 

More from Stéphane Maldini (13)

The value of reactive
The value of reactiveThe value of reactive
The value of reactive
 
Multi-service reactive streams using Spring, Reactor, RSocket
Multi-service reactive streams using Spring, Reactor, RSocketMulti-service reactive streams using Spring, Reactor, RSocket
Multi-service reactive streams using Spring, Reactor, RSocket
 
The Future of Reactive Architectures
The Future of Reactive ArchitecturesThe Future of Reactive Architectures
The Future of Reactive Architectures
 
Spring Cloud Gateway
Spring Cloud GatewaySpring Cloud Gateway
Spring Cloud Gateway
 
What's new in Reactor Californium
What's new in Reactor CaliforniumWhat's new in Reactor Californium
What's new in Reactor Californium
 
Spring boot 2.0 reactive bits (June 2018)
Spring boot 2.0 reactive bits (June 2018)Spring boot 2.0 reactive bits (June 2018)
Spring boot 2.0 reactive bits (June 2018)
 
Reactor, Reactive streams and MicroServices
Reactor, Reactive streams and MicroServicesReactor, Reactive streams and MicroServices
Reactor, Reactive streams and MicroServices
 
Springone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and ReactorSpringone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and Reactor
 
Reactor grails realtime web devoxx 2013
Reactor grails realtime web   devoxx 2013Reactor grails realtime web   devoxx 2013
Reactor grails realtime web devoxx 2013
 
Groovy reactor grails realtime web devoxx 2013
Groovy reactor grails realtime web   devoxx 2013Groovy reactor grails realtime web   devoxx 2013
Groovy reactor grails realtime web devoxx 2013
 
Ss2gx
Ss2gxSs2gx
Ss2gx
 
Reactor spring one2gx_2013_0902-final
Reactor spring one2gx_2013_0902-finalReactor spring one2gx_2013_0902-final
Reactor spring one2gx_2013_0902-final
 
Eventsggx
EventsggxEventsggx
Eventsggx
 

Recently uploaded

The_Chronological_Life_of_Christ_Part_93_Fear God
The_Chronological_Life_of_Christ_Part_93_Fear GodThe_Chronological_Life_of_Christ_Part_93_Fear God
The_Chronological_Life_of_Christ_Part_93_Fear GodNetwork Bible Fellowship
 
God needs Worshipers and people who will serve him in spirit and truth.pdf
God needs Worshipers and people who will serve him in spirit and truth.pdfGod needs Worshipers and people who will serve him in spirit and truth.pdf
God needs Worshipers and people who will serve him in spirit and truth.pdfRodolphAmani
 
Free eBook ~Short Inspirational Stories - The Benefits.pdf
Free eBook ~Short Inspirational Stories - The Benefits.pdfFree eBook ~Short Inspirational Stories - The Benefits.pdf
Free eBook ~Short Inspirational Stories - The Benefits.pdfOH TEIK BIN
 
All About Zakah for Muslim Americans - Dr. Main Alqudah [https://www.guidance...
All About Zakah for Muslim Americans - Dr. Main Alqudah [https://www.guidance...All About Zakah for Muslim Americans - Dr. Main Alqudah [https://www.guidance...
All About Zakah for Muslim Americans - Dr. Main Alqudah [https://www.guidance...iqra tube
 
Old Age but fruitful and meaningful.pptx
Old Age but fruitful and meaningful.pptxOld Age but fruitful and meaningful.pptx
Old Age but fruitful and meaningful.pptxInnovator Marbun
 
Islamic Finance 101 - Dr. Main Alqudah [https://www.guidancecollege.org/]
Islamic Finance 101 - Dr. Main Alqudah [https://www.guidancecollege.org/]Islamic Finance 101 - Dr. Main Alqudah [https://www.guidancecollege.org/]
Islamic Finance 101 - Dr. Main Alqudah [https://www.guidancecollege.org/]iqra tube
 
Easter Apocalypse_Palm Sunday_Rev. 7.pptx
Easter Apocalypse_Palm Sunday_Rev. 7.pptxEaster Apocalypse_Palm Sunday_Rev. 7.pptx
Easter Apocalypse_Palm Sunday_Rev. 7.pptxStephen Palm
 
The Mormon & Quaker Moons of Lancashire: Stories of Religious Conversion & Mi...
The Mormon & Quaker Moons of Lancashire: Stories of Religious Conversion & Mi...The Mormon & Quaker Moons of Lancashire: Stories of Religious Conversion & Mi...
The Mormon & Quaker Moons of Lancashire: Stories of Religious Conversion & Mi...Cometan
 
Deerfoot Church of Christ Bulletin 3 24 24
Deerfoot Church of Christ Bulletin 3 24 24Deerfoot Church of Christ Bulletin 3 24 24
Deerfoot Church of Christ Bulletin 3 24 24deerfootcoc
 
DP & Jesus Marriage - 2 potential candidates
DP & Jesus Marriage - 2 potential candidatesDP & Jesus Marriage - 2 potential candidates
DP & Jesus Marriage - 2 potential candidatesBengt & Maarit de Paulis
 
DP & Nostradamus-Fatima-Bailey-Branham-Ford - Short vers
DP & Nostradamus-Fatima-Bailey-Branham-Ford - Short versDP & Nostradamus-Fatima-Bailey-Branham-Ford - Short vers
DP & Nostradamus-Fatima-Bailey-Branham-Ford - Short versBengt & Maarit de Paulis
 
365 Days of Thanking God_ Cultivating a Heart of Thanksgiving Everyday (Revis...
365 Days of Thanking God_ Cultivating a Heart of Thanksgiving Everyday (Revis...365 Days of Thanking God_ Cultivating a Heart of Thanksgiving Everyday (Revis...
365 Days of Thanking God_ Cultivating a Heart of Thanksgiving Everyday (Revis...Eizijesu Obahaiye
 

Recently uploaded (13)

The_Chronological_Life_of_Christ_Part_93_Fear God
The_Chronological_Life_of_Christ_Part_93_Fear GodThe_Chronological_Life_of_Christ_Part_93_Fear God
The_Chronological_Life_of_Christ_Part_93_Fear God
 
God needs Worshipers and people who will serve him in spirit and truth.pdf
God needs Worshipers and people who will serve him in spirit and truth.pdfGod needs Worshipers and people who will serve him in spirit and truth.pdf
God needs Worshipers and people who will serve him in spirit and truth.pdf
 
Free eBook ~Short Inspirational Stories - The Benefits.pdf
Free eBook ~Short Inspirational Stories - The Benefits.pdfFree eBook ~Short Inspirational Stories - The Benefits.pdf
Free eBook ~Short Inspirational Stories - The Benefits.pdf
 
All About Zakah for Muslim Americans - Dr. Main Alqudah [https://www.guidance...
All About Zakah for Muslim Americans - Dr. Main Alqudah [https://www.guidance...All About Zakah for Muslim Americans - Dr. Main Alqudah [https://www.guidance...
All About Zakah for Muslim Americans - Dr. Main Alqudah [https://www.guidance...
 
Old Age but fruitful and meaningful.pptx
Old Age but fruitful and meaningful.pptxOld Age but fruitful and meaningful.pptx
Old Age but fruitful and meaningful.pptx
 
Islamic Finance 101 - Dr. Main Alqudah [https://www.guidancecollege.org/]
Islamic Finance 101 - Dr. Main Alqudah [https://www.guidancecollege.org/]Islamic Finance 101 - Dr. Main Alqudah [https://www.guidancecollege.org/]
Islamic Finance 101 - Dr. Main Alqudah [https://www.guidancecollege.org/]
 
Easter Apocalypse_Palm Sunday_Rev. 7.pptx
Easter Apocalypse_Palm Sunday_Rev. 7.pptxEaster Apocalypse_Palm Sunday_Rev. 7.pptx
Easter Apocalypse_Palm Sunday_Rev. 7.pptx
 
The Mormon & Quaker Moons of Lancashire: Stories of Religious Conversion & Mi...
The Mormon & Quaker Moons of Lancashire: Stories of Religious Conversion & Mi...The Mormon & Quaker Moons of Lancashire: Stories of Religious Conversion & Mi...
The Mormon & Quaker Moons of Lancashire: Stories of Religious Conversion & Mi...
 
English - The 1st Book of Adam and Eve.pdf
English - The 1st Book of Adam and Eve.pdfEnglish - The 1st Book of Adam and Eve.pdf
English - The 1st Book of Adam and Eve.pdf
 
Deerfoot Church of Christ Bulletin 3 24 24
Deerfoot Church of Christ Bulletin 3 24 24Deerfoot Church of Christ Bulletin 3 24 24
Deerfoot Church of Christ Bulletin 3 24 24
 
DP & Jesus Marriage - 2 potential candidates
DP & Jesus Marriage - 2 potential candidatesDP & Jesus Marriage - 2 potential candidates
DP & Jesus Marriage - 2 potential candidates
 
DP & Nostradamus-Fatima-Bailey-Branham-Ford - Short vers
DP & Nostradamus-Fatima-Bailey-Branham-Ford - Short versDP & Nostradamus-Fatima-Bailey-Branham-Ford - Short vers
DP & Nostradamus-Fatima-Bailey-Branham-Ford - Short vers
 
365 Days of Thanking God_ Cultivating a Heart of Thanksgiving Everyday (Revis...
365 Days of Thanking God_ Cultivating a Heart of Thanksgiving Everyday (Revis...365 Days of Thanking God_ Cultivating a Heart of Thanksgiving Everyday (Revis...
365 Days of Thanking God_ Cultivating a Heart of Thanksgiving Everyday (Revis...
 

Introduction to Reactive Streams and Reactor 2.5

  • 1. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ (Rx + Reactive Streams + Spring) % Java 8 = Reactor 2.5 Stéphane Maldini @smaldlini
  • 2. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Stéphane Maldini • Survive in London • Reactive Engineering @ • Project Reactor lead • Reactive Streams & 
 Reactive Streams Commons contributor • Works on Spring Framework 5
 upcoming Reactive support • @smaldini on Twitter 2 +
  • 3. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Do you need to be “reactive” ? If you ask then you probably don’t. 3
  • 4. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ How much faster is it ? It’s slower than your usual imperative system. 4
  • 5. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 5 Is it good at anything beyond pretending ? Yes. It scales with the request volume.
  • 6. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 6 But remember it changes the way you think code. 
 It’s definitely a michelin star lunch.
  • 7. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Swipe Right - it’s a match • Mobile/IoT backend API • Server-to-Server communications (HTTP…) • Unreliable clients • Big Data • Mutualized Resources (Cloud…) • User Interfaces 7
  • 8. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive, what the sh*t? 8 More details on http://fr.slideshare.net/StphaneMaldini/intro-to-reactive-programming-52821416 • Reactive is used to broadly define event-driven systems • Reactive Manifesto defines qualities of reactive systems • Reactive programming: moving imperative logic to async, non- blocking, functional-style code, in particular when interacting with “time consuming” resources
  • 9. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ For reactive programming, we need tools : ☐ Reactive Streams ☐ Reactive APIs 9
  • 10. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Streams • Reactive Streams is a protocol for asynchronous stream processing with non-blocking backpressure • De facto standard for interop between reactive libraries • To be included in Java 9 as java.util.concurrent.Flow 10
  • 11. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Streams principle 11 Publisher SubscriberData Demand • Max(InflightData) <= demand • No data sent without demand • Demand can be unbounded
  • 12. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Streams is 3+1 interfaces (+ a TCK) 1215 onSubscribe onNext* (onError|onComplete)? Publisher Subscriber Subscription request(n) cancel()
  • 13. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Streams offers Quality of Service for the JVM Bounded hardware use and flow prioritization 13
  • 14. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Imperative vs Reactive Streams ? 14 User rickSanchez = userRepository.findUser(“rick”); Blocking, not returning until done ! Might throw exceptions
  • 15. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ If this blocks, and runs on a serving HTTP request ? If the calling HTTP requests come from another “Microservice” ? If that Microservice is also calling in a blocking way ? If you solve scalability issues by scaling out ? If you agreed to pay the scalability tax, how far can it help you ? Thinking about the big picture 15
  • 16. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Imperative vs Reactive Streams ? 16 Publisher<User> rickSanchez = userRepository.findUser(“rick”); rickSanchez.subscribe(new Subscriber<User>(){ … }); Might send 0, 1 or N Users ! Non Blocking - on demand data emission Callback for start, result, error or complete
  • 17. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ How practical is Publisher ? 17
  • 18. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Do you want to implement Publisher yourself ? Probably not, usually. 18
  • 19. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ For reactive programming, we need tools : ☑ Reactive Streams ☐ Reactive APIs 19
  • 20. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ • Transform, Combine, Timebox, Aggregate, Consume… • On the JVM: • Reactor 2.5 is 4th generation* and based on Reactive Streams • RxJava 1.x: 2nd generation* and most used implementation • Akka Stream 2.x: Lightbend 3rd generation* Reactive API • Also for other languages, for example RxJS, MostJS Reactive APIs 20 * Based on http://akarnokd.blogspot.fr/2016/03/operator-fusion-part-1.html
  • 21. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactor 2.5 ecosystem 21
  • 22. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactor Core 2.5 • Cross collaboration with Dávid Karnok (RxJava) and some Spring Framework committers • Natively based on Reactive Streams, RSC* and Java 8+ • 2 new rich Publisher types : Flux & Mono • Strong focus on efficiency • Ever-improving debugging, logging, testing capabilities * ReactiveStreamsCommons is a research effort about reactive flows 22
  • 23. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Flux (0..N elements) with ReactiveX compliant API 23
  • 24. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Mono (0..1 element) 24
  • 25. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Imperative vs Reactor ? 25 Mono<User> rickSanchez = userRepository.findUser(“rick”); rickSanchez.consume(this::userHandler, this::errorHandler) Single Typed Publisher ! Start the Mono and consume its result or error.
  • 26. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Mono, a single-data-at-most API 26
  • 27. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Flux, classic Rx patterns for 0..N events 27
  • 28. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Visual (Marble) doc for Flux & Mono 28
  • 29. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactor Web Console (preview) 29
  • 30. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Concurrency Types Cheat Sheet 30 No value Single value Multiple values Blocking void T
 Future<T> Iterable<T> Collection<T> Stream<T> Non- blocking CompletableFuture<Void> CompletableFuture<T> CompletableFuture<List<T>> Reactive
 Streams Publisher<Void> Publisher<T> Publisher<T> RxJava Observable<Void> Completable (1.1.1) Observable<T> Single<T> (1.0.13) Observable<T> Reactor Mono<Void> Mono<T> Flux<T>
  • 31. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ https://spring.io/blog/2016/04/19/understanding-reactive-types 31
  • 32. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Spring 32 • Spring projects are going reactive • Reactor Core is the reactive foundation • RxJava support provided out of the box • You will be able to choose your web engine:
 Tomcat, Jetty, Undertow or Netty • Most impact on Web and Data support (IO intensive) • Spring Reactive experiment • Spring Reactive Playground sample application
  • 33. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Well known Controller example 33 @RestController public class UserController { private BlockingRepository<User> repository; @RequestMapping(path = "/save-capitalized", method = RequestMethod.POST) public void saveCapitalized(@RequestBody List<User> users) { users.forEach(u -> u.setName(u.getName().toUpperCase())); repository.save(users); } } public interface BlockingRepository<T> { void save(List<T> elements); Iterable<T> findAll(); }
  • 34. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Controller with Reactive types 34 @RestController public class UserController { private ReactiveRepository<User> repository; @RequestMapping(path = "/save-capitalized", method = RequestMethod.POST) public Mono<Void> saveCapitalized(@RequestBody Flux<User> users) { return repository.save(users.map(u -> new User(u.getName().toUpperCase())); } } public interface ReactiveRepository<T> { Mono<Void> save(Publisher<T> elements); Flux<T> findAll(); }
  • 35. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Blocking vs Reactive: memory consumption 35 Memoryconsumption Time Blocking Reactive
  • 36. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Blocking vs Reactive: streaming updates 36 Numberofuserssaved inthedatabase Time Blocking Reactive
  • 37. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Controller with Reactive return values 37 @RestController public class UserController { private ReactiveRepository<User> repository; @RequestMapping(path = "/", method = RequestMethod.GET) public Flux<User> findAll() { return repository.findAll(); } } • Optimized serialization when using Flux instead of List • Also perfectly suitable for Server-Sent Events
  • 38. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive HTTP client with Mono 38 import static org.springframework.web.client.reactive.HttpRequestBuilders.*; import static org.springframework.web.client.reactive.WebResponseExtractors.*; Mono<Person> result = webClient .perform(get("http://localhost:8080/person") .header("X-Test-Header", "testvalue") .accept(MediaType.APPLICATION_JSON)) .extract(body(Person.class));
  • 39. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive HTTP client with Flux 39 import static org.springframework.web.client.reactive.HttpRequestBuilders.*; import static org.springframework.web.client.reactive.WebResponseExtractors.*; Flux<Person> response = webClient .perform(get("http://localhost:8080/persons") .accept(MediaType.APPLICATION_JSON)) .extract(bodyStream(Person.class)); Works for: • JSON array [{"foo":"bar"},{"foo":"baz"}] • JSON Streaming {"foo":"bar"}{"foo":"baz"} • SSE with something like .extract(sseStream(Person.class))
  • 40. Unless otherwise indicated, these slides are © 2013-2015 Pivotal Software, Inc. and licensed under a
 Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Do you want to learn and play at the same time ? Get Factorio on Steam for a few coins 40