Going Reactive with gRPC

Andres Almiray
Andres AlmiraySoftware Developer, Open Source advocate
GOING REACTIVE
WITH GRPC
ANDRES ALMIRAY
@AALMIRAY
ANDRESALMIRAY.COM
@aalmiray
@aalmiray
JCP Executive Committee Associate Seat
Committer
Committer
JSR377 Specification Lead
@aalmiray
CONCEPTS
@aalmiray
STATE
Imperative Programming (Procedural)
var a := b + c
println a
Declarative Programming (Functional)
(println (sum(b, c))
@aalmiray
TIME
Imperative Programming
var a := b + c
println a
Reactive Programming
var a := b + c
a.done( v -> println v)
@aalmiray
SYNC VS ASYNC
Synchronous operations block the flow until they yield a
result (success or error).
Asynchronous operations DO NOT block the flow, rather they
allow the program to continue. Results (or errors) will be
handled at a later point in time, typically using functions
(callbacks).
@aalmiray
FUTURES AND PROMISES
They describe an object that acts as mediator for a value that
may be unknown at init time.
The terms Future and Promise are normally used
interchangeably but there’s a difference:
• A Future is a read-only reference of the expected value.
• A Promise is a write-once container that sets the value of
the Future.
https://en.wikipedia.org/wiki/Futures_and_promises
@aalmiray
FUTURES AND PROMISES
Futures in Java are synchronous, this can be demonstrated
by the following method signatures found in
java.util.concurrent.Future
V get()
V get(long timeout, TimeUnit unit)
@aalmiray
FUTURES AND PROMISES
Java 8 added a new type, CompletableFuture, that
implements CompletableStage, which in turns defines the
contract of a Promise, such as
thenAccept(Consumer<? Super T> action)
whenComplete(BiConsumer<? super T,? super Throwable>
action)
exceptionally(Function<Throwable,? extends T> fn)
… and many others
@aalmiray
FUTURES AND PROMISES
JDeferred offers a different API that allows better function
composition
Promise<D, F, P> then(DoneCallback<D> doneCallback)
Promise<D, F, P> done(DoneCallback<D> callback)
Promise<D, F, P> fail(FailCallback<F> callback)
Promise<D, F, P> always(AlwaysCallback<D, F> callback)
@aalmiray
DATA STREAMS
@aalmiray
DATA STREAMS
A sequence of values calculated over time.
Values are emitted when ready; they are computed without
blocking consumers.
Consumers listen to changes in the data stream and react to
said changes (hence the name Reactive Programming).
Push vs pull model.
@aalmiray
OBSERVABLE/OBSERVER
Data streams are of type Observable while consumer are of
type Observer.
The Observable type exposes multiple operations that allow
value composition, combinations, filtering, and other value
transformations.
NOTE: many operations from RxJava/Reactor generate a new
Observable (decorator pattern)
@aalmiray
OPERATIONS
(A SMALL SAMPLE OF)
@aalmiray
HTTP://RXMARBLES.COM
@aalmiray
HTTP://RXMARBLES.COM
@aalmiray
HTTP://RXMARBLES.COM
@aalmiray
HTTP://RXMARBLES.COM
@aalmiray
HTTP://REACTIVEX.IO/RXJAVA/2.X/JAVADOC/INDEX.HTML
@aalmiray
GRPC
@aalmiray
HTTPS://GRPC.IO/
gRPC is a modern, open source, high-performance remote
procedure call (RPC) framework that can run anywhere. It
enables client and server applications to communicate
transparently, and makes it easier to build connected
systems.
@aalmiray
@aalmiray
Go
Java
@aalmiray
RXGRPC
https://github.com/salesforce/reactive-grpc
Combines gRPC with Reactive Streams
Encapsulates gRPC’s API
Producers/Consumers only see Rx API
@aalmiray
DEMO
HTTPS://GITHUB.COM/AALMIRAY/HELLO-GRPC/
@aalmiray
RESOURCES
http://download.java.net/java/jdk9/docs/api/java/util/concurrent/Flow.ht
ml
http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Completab
leFuture.html
http://jdeferred.org/
http://andresalmiray.com/articles/jdeferred-simple-handling-of-
promises-and-futures/
http://andresalmiray.com/articles/testing-rxjava2/
https://www.infoq.com/articles/rxjava2-by-example
@aalmiray
REACTIVE
PROGRAMMING
IMPLIES AND
PARADIGM
CHANGE!
@aalmiray
HTTP://ANDRESALMIRAY.COM/NEWSLETTER
HTTP://ANDRESALMIRAY.COM/EDITORIAL
@aalmiray
THANK YOU!
ANDRES ALMIRAY
@AALMIRAY
ANDRESALMIRAY.COM
1 of 31

Recommended

DBMS by
DBMSDBMS
DBMSSHIKHA GAUTAM
3.2K views41 slides
SQL and E R diagram by
SQL and E R diagramSQL and E R diagram
SQL and E R diagramMahbubur Rahman Shimul
3.6K views38 slides
Minor project Report for "Quiz Application" by
Minor project Report for "Quiz Application"Minor project Report for "Quiz Application"
Minor project Report for "Quiz Application"Harsh Verma
68.5K views52 slides
Data collection and presentation in Research by
Data collection and presentation in Research Data collection and presentation in Research
Data collection and presentation in Research Dr Deepthi Athuluru
14.5K views58 slides
Introduction to sampling by
Introduction to samplingIntroduction to sampling
Introduction to samplingSituo Liu
14.6K views22 slides
Aggregation by
AggregationAggregation
AggregationMd Khan
2.5K views13 slides

More Related Content

What's hot

Quiz by
QuizQuiz
QuizSourabh Bhattacharya
1.9K views6 slides
School Management System by
School Management SystemSchool Management System
School Management SystemNortheastern University
162.9K views78 slides
The Ultimate Guide for UML Class Diagrams by Creately by
The Ultimate Guide for UML Class Diagrams by CreatelyThe Ultimate Guide for UML Class Diagrams by Creately
The Ultimate Guide for UML Class Diagrams by CreatelyCreately
1.5K views28 slides
E-R Diagram of College Management Systems by
E-R Diagram of College Management SystemsE-R Diagram of College Management Systems
E-R Diagram of College Management SystemsOmprakash Chauhan
5.3K views9 slides
Learning Management System by
Learning Management SystemLearning Management System
Learning Management SystemShubham Singh
4.2K views10 slides
HCI 2015 (8/10) Data Visualization (an introduction) by
HCI 2015 (8/10) Data Visualization (an introduction)HCI 2015 (8/10) Data Visualization (an introduction)
HCI 2015 (8/10) Data Visualization (an introduction)Sabin Buraga
2.1K views140 slides

What's hot(7)

The Ultimate Guide for UML Class Diagrams by Creately by Creately
The Ultimate Guide for UML Class Diagrams by CreatelyThe Ultimate Guide for UML Class Diagrams by Creately
The Ultimate Guide for UML Class Diagrams by Creately
Creately1.5K views
E-R Diagram of College Management Systems by Omprakash Chauhan
E-R Diagram of College Management SystemsE-R Diagram of College Management Systems
E-R Diagram of College Management Systems
Omprakash Chauhan5.3K views
Learning Management System by Shubham Singh
Learning Management SystemLearning Management System
Learning Management System
Shubham Singh4.2K views
HCI 2015 (8/10) Data Visualization (an introduction) by Sabin Buraga
HCI 2015 (8/10) Data Visualization (an introduction)HCI 2015 (8/10) Data Visualization (an introduction)
HCI 2015 (8/10) Data Visualization (an introduction)
Sabin Buraga2.1K views

Similar to Going Reactive with gRPC

Going Reactive with g rpc by
Going Reactive with g rpcGoing Reactive with g rpc
Going Reactive with g rpcAndres Almiray
142 views33 slides
Understanding Reactive Programming by
Understanding Reactive ProgrammingUnderstanding Reactive Programming
Understanding Reactive ProgrammingAndres Almiray
1.2K views54 slides
DZone_RC_RxJS by
DZone_RC_RxJSDZone_RC_RxJS
DZone_RC_RxJSLuis Atencio
226 views6 slides
Jumping-with-java8 by
Jumping-with-java8Jumping-with-java8
Jumping-with-java8Dhaval Dalal
6.4K views175 slides
Angular mix chrisnoring by
Angular mix chrisnoringAngular mix chrisnoring
Angular mix chrisnoringChristoffer Noring
503 views65 slides
Acceptance tests by
Acceptance testsAcceptance tests
Acceptance testsDragan Tomic
512 views21 slides

Similar to Going Reactive with gRPC(20)

Understanding Reactive Programming by Andres Almiray
Understanding Reactive ProgrammingUnderstanding Reactive Programming
Understanding Reactive Programming
Andres Almiray1.2K views
Jumping-with-java8 by Dhaval Dalal
Jumping-with-java8Jumping-with-java8
Jumping-with-java8
Dhaval Dalal6.4K views
How to perform debounce in react by BOSC Tech Labs
How to perform debounce in reactHow to perform debounce in react
How to perform debounce in react
BOSC Tech Labs67 views
Performance Testing using LoadRunner by Kumar Gupta
Performance Testing using LoadRunnerPerformance Testing using LoadRunner
Performance Testing using LoadRunner
Kumar Gupta1.3K views
Mario Fusco - Reactive programming in Java - Codemotion Milan 2017 by Codemotion
Mario Fusco - Reactive programming in Java - Codemotion Milan 2017Mario Fusco - Reactive programming in Java - Codemotion Milan 2017
Mario Fusco - Reactive programming in Java - Codemotion Milan 2017
Codemotion1.1K views
Promises look into the async future by slicejs
Promises look into the async futurePromises look into the async future
Promises look into the async future
slicejs1.1K views
PerformanceTestingWithLoadrunner by techgajanan
PerformanceTestingWithLoadrunnerPerformanceTestingWithLoadrunner
PerformanceTestingWithLoadrunner
techgajanan523 views
Performance Testing With Loadrunner by vladimir zaremba
Performance Testing With LoadrunnerPerformance Testing With Loadrunner
Performance Testing With Loadrunner
vladimir zaremba4.7K views
Flowchart - Introduction and Designing Tools by Jawad Khan
Flowchart - Introduction and Designing ToolsFlowchart - Introduction and Designing Tools
Flowchart - Introduction and Designing Tools
Jawad Khan1.3K views
CompletableFuture by koji lin
CompletableFutureCompletableFuture
CompletableFuture
koji lin9.2K views
Enterprise State Management with NGRX/platform by Ilia Idakiev
Enterprise State Management with NGRX/platformEnterprise State Management with NGRX/platform
Enterprise State Management with NGRX/platform
Ilia Idakiev283 views
Droolsand Rule Based Systems 2008 Srping by Srinath Perera
Droolsand Rule Based Systems 2008 SrpingDroolsand Rule Based Systems 2008 Srping
Droolsand Rule Based Systems 2008 Srping
Srinath Perera1.6K views
AngularJS, More Than Directives ! by Gaurav Behere
AngularJS, More Than Directives !AngularJS, More Than Directives !
AngularJS, More Than Directives !
Gaurav Behere317 views

More from Andres Almiray

Liberando a produccion con confidencia.pdf by
Liberando a produccion con confidencia.pdfLiberando a produccion con confidencia.pdf
Liberando a produccion con confidencia.pdfAndres Almiray
8 views49 slides
OracleDB Ecosystem for Java Developers by
OracleDB Ecosystem for Java DevelopersOracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java DevelopersAndres Almiray
13 views48 slides
Softcon.ph - Maven Puzzlers by
Softcon.ph - Maven PuzzlersSoftcon.ph - Maven Puzzlers
Softcon.ph - Maven PuzzlersAndres Almiray
5 views37 slides
Maven Puzzlers by
Maven PuzzlersMaven Puzzlers
Maven PuzzlersAndres Almiray
49 views37 slides
Oracle Database Ecosystem for Java Developers by
Oracle Database Ecosystem for Java DevelopersOracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java DevelopersAndres Almiray
44 views33 slides
JReleaser - Releasing at the speed of light by
JReleaser - Releasing at the speed of lightJReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of lightAndres Almiray
396 views31 slides

More from Andres Almiray(20)

Liberando a produccion con confidencia.pdf by Andres Almiray
Liberando a produccion con confidencia.pdfLiberando a produccion con confidencia.pdf
Liberando a produccion con confidencia.pdf
Andres Almiray8 views
OracleDB Ecosystem for Java Developers by Andres Almiray
OracleDB Ecosystem for Java DevelopersOracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java Developers
Andres Almiray13 views
Oracle Database Ecosystem for Java Developers by Andres Almiray
Oracle Database Ecosystem for Java DevelopersOracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java Developers
Andres Almiray44 views
JReleaser - Releasing at the speed of light by Andres Almiray
JReleaser - Releasing at the speed of lightJReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of light
Andres Almiray396 views
Building modular applications with the Java Platform Module System and Layrry by Andres Almiray
Building modular applications with the Java Platform Module System and LayrryBuilding modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and Layrry
Andres Almiray293 views
Building modular applications with JPMS and Layrry by Andres Almiray
Building modular applications with JPMS and LayrryBuilding modular applications with JPMS and Layrry
Building modular applications with JPMS and Layrry
Andres Almiray193 views
Taking Micronaut out for a spin by Andres Almiray
Taking Micronaut out for a spinTaking Micronaut out for a spin
Taking Micronaut out for a spin
Andres Almiray644 views
Apache Groovy's Metaprogramming Options and You by Andres Almiray
Apache Groovy's Metaprogramming Options and YouApache Groovy's Metaprogramming Options and You
Apache Groovy's Metaprogramming Options and You
Andres Almiray718 views
What I wish I knew about Maven years ago by Andres Almiray
What I wish I knew about Maven years agoWhat I wish I knew about Maven years ago
What I wish I knew about Maven years ago
Andres Almiray425 views
What I wish I knew about maven years ago by Andres Almiray
What I wish I knew about maven years agoWhat I wish I knew about maven years ago
What I wish I knew about maven years ago
Andres Almiray1K views
The impact of sci fi in tech by Andres Almiray
The impact of sci fi in techThe impact of sci fi in tech
The impact of sci fi in tech
Andres Almiray210 views
Gradle Ex Machina - Devoxx 2019 by Andres Almiray
Gradle Ex Machina - Devoxx 2019Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019
Andres Almiray490 views
Creating Better Builds with Gradle by Andres Almiray
Creating Better Builds with GradleCreating Better Builds with Gradle
Creating Better Builds with Gradle
Andres Almiray239 views
Interacting with the Oracle Cloud Java SDK with Gradle by Andres Almiray
Interacting with the Oracle Cloud Java SDK with GradleInteracting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with Gradle
Andres Almiray796 views

Recently uploaded

GDSC GLAU Info Session.pptx by
GDSC GLAU Info Session.pptxGDSC GLAU Info Session.pptx
GDSC GLAU Info Session.pptxgauriverrma4
15 views28 slides
Netmera Presentation.pdf by
Netmera Presentation.pdfNetmera Presentation.pdf
Netmera Presentation.pdfMustafa Kuğu
22 views50 slides
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023 by
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023BookNet Canada
46 views19 slides
AI + Memoori = AIM by
AI + Memoori = AIMAI + Memoori = AIM
AI + Memoori = AIMMemoori
15 views9 slides
Transcript: Redefining the book supply chain: A glimpse into the future - Tec... by
Transcript: Redefining the book supply chain: A glimpse into the future - Tec...Transcript: Redefining the book supply chain: A glimpse into the future - Tec...
Transcript: Redefining the book supply chain: A glimpse into the future - Tec...BookNet Canada
43 views16 slides
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...The Digital Insurer
98 views52 slides

Recently uploaded(20)

GDSC GLAU Info Session.pptx by gauriverrma4
GDSC GLAU Info Session.pptxGDSC GLAU Info Session.pptx
GDSC GLAU Info Session.pptx
gauriverrma415 views
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023 by BookNet Canada
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
BookNet Canada46 views
AI + Memoori = AIM by Memoori
AI + Memoori = AIMAI + Memoori = AIM
AI + Memoori = AIM
Memoori15 views
Transcript: Redefining the book supply chain: A glimpse into the future - Tec... by BookNet Canada
Transcript: Redefining the book supply chain: A glimpse into the future - Tec...Transcript: Redefining the book supply chain: A glimpse into the future - Tec...
Transcript: Redefining the book supply chain: A glimpse into the future - Tec...
BookNet Canada43 views
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by The Digital Insurer
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...
Cocktail of Environments. How to Mix Test and Development Environments and St... by Aleksandr Tarasov
Cocktail of Environments. How to Mix Test and Development Environments and St...Cocktail of Environments. How to Mix Test and Development Environments and St...
Cocktail of Environments. How to Mix Test and Development Environments and St...
Initiating and Advancing Your Strategic GIS Governance Strategy by Safe Software
Initiating and Advancing Your Strategic GIS Governance StrategyInitiating and Advancing Your Strategic GIS Governance Strategy
Initiating and Advancing Your Strategic GIS Governance Strategy
Safe Software198 views
Bronack Skills - Risk Management and SRE v1.0 12-3-2023.pdf by ThomasBronack
Bronack Skills - Risk Management and SRE v1.0 12-3-2023.pdfBronack Skills - Risk Management and SRE v1.0 12-3-2023.pdf
Bronack Skills - Risk Management and SRE v1.0 12-3-2023.pdf
ThomasBronack31 views
"Package management in monorepos", Zoltan Kochan by Fwdays
"Package management in monorepos", Zoltan Kochan"Package management in monorepos", Zoltan Kochan
"Package management in monorepos", Zoltan Kochan
Fwdays37 views
Digital Personal Data Protection (DPDP) Practical Approach For CISOs by Priyanka Aash
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Priyanka Aash171 views
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell by Fwdays
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
Fwdays14 views
Measurecamp Brussels - Synthetic data.pdf by Human37
Measurecamp Brussels - Synthetic data.pdfMeasurecamp Brussels - Synthetic data.pdf
Measurecamp Brussels - Synthetic data.pdf
Human37 27 views
Discover Aura Workshop (12.5.23).pdf by Neo4j
Discover Aura Workshop (12.5.23).pdfDiscover Aura Workshop (12.5.23).pdf
Discover Aura Workshop (12.5.23).pdf
Neo4j20 views
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And... by ShapeBlue
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...
ShapeBlue120 views
LLMs in Production: Tooling, Process, and Team Structure by Aggregage
LLMs in Production: Tooling, Process, and Team StructureLLMs in Production: Tooling, Process, and Team Structure
LLMs in Production: Tooling, Process, and Team Structure
Aggregage65 views
Innovation & Entrepreneurship strategies in Dairy Industry by PervaizDar1
Innovation & Entrepreneurship strategies in Dairy IndustryInnovation & Entrepreneurship strategies in Dairy Industry
Innovation & Entrepreneurship strategies in Dairy Industry
PervaizDar139 views
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu474 views

Going Reactive with gRPC