Submit Search
Upload
Reactive Jersey Client
•
4 likes
•
7,584 views
Michal Gajdos
Follow
CZJUG presentation (January 2015).
Read less
Read more
Software
Report
Share
Report
Share
1 of 32
Download now
Download to read offline
Recommended
Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?
Izzet Mustafaiev
A Journey to Reactive Function Programming
A Journey to Reactive Function Programming
Ahmed Soliman
Resilient Applications with Akka Persistence - Scaladays 2014
Resilient Applications with Akka Persistence - Scaladays 2014
Björn Antonsson
Akka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in Practice
Roland Kuhn
Akka A to Z: A Guide To The Industry’s Best Toolkit for Fast Data and Microse...
Akka A to Z: A Guide To The Industry’s Best Toolkit for Fast Data and Microse...
Lightbend
Akka Cluster in Production
Akka Cluster in Production
bilyushonak
Akka Actor presentation
Akka Actor presentation
Gene Chang
Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Cl...
Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Cl...
Lightbend
Recommended
Docker. Does it matter for Java developer ?
Docker. Does it matter for Java developer ?
Izzet Mustafaiev
A Journey to Reactive Function Programming
A Journey to Reactive Function Programming
Ahmed Soliman
Resilient Applications with Akka Persistence - Scaladays 2014
Resilient Applications with Akka Persistence - Scaladays 2014
Björn Antonsson
Akka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in Practice
Roland Kuhn
Akka A to Z: A Guide To The Industry’s Best Toolkit for Fast Data and Microse...
Akka A to Z: A Guide To The Industry’s Best Toolkit for Fast Data and Microse...
Lightbend
Akka Cluster in Production
Akka Cluster in Production
bilyushonak
Akka Actor presentation
Akka Actor presentation
Gene Chang
Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Cl...
Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Cl...
Lightbend
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and more
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and more
Legacy Typesafe (now Lightbend)
Samuele Resca - REACTIVE PROGRAMMING, DAMN. IT IS NOT ABOUT REACTJS - Codemot...
Samuele Resca - REACTIVE PROGRAMMING, DAMN. IT IS NOT ABOUT REACTJS - Codemot...
Codemotion
[Japanese] How Reactive Streams and Akka Streams change the JVM Ecosystem @ R...
[Japanese] How Reactive Streams and Akka Streams change the JVM Ecosystem @ R...
Konrad Malawski
Akka-chan's Survival Guide for the Streaming World
Akka-chan's Survival Guide for the Streaming World
Konrad Malawski
How Reactive Streams & Akka Streams change the JVM Ecosystem
How Reactive Streams & Akka Streams change the JVM Ecosystem
Konrad Malawski
Akka 2.4 plus new commercial features in Typesafe Reactive Platform
Akka 2.4 plus new commercial features in Typesafe Reactive Platform
Legacy Typesafe (now Lightbend)
Akka Streams in Action @ ScalaDays Berlin 2016
Akka Streams in Action @ ScalaDays Berlin 2016
Konrad Malawski
Architectural changes in the repo in 6.1 and beyond
Architectural changes in the repo in 6.1 and beyond
Stefan Kopf
What’s expected in Spring 5
What’s expected in Spring 5
Gal Marder
Do's and don'ts when deploying akka in production
Do's and don'ts when deploying akka in production
jglobal
End to End Akka Streams / Reactive Streams - from Business to Socket
End to End Akka Streams / Reactive Streams - from Business to Socket
Konrad Malawski
Lessons Learned From PayPal: Implementing Back-Pressure With Akka Streams And...
Lessons Learned From PayPal: Implementing Back-Pressure With Akka Streams And...
Lightbend
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...
Gal Marder
Exachk and oem12c
Exachk and oem12c
Bobby Curtis
Dropwizard and Groovy
Dropwizard and Groovy
tomaslin
#GeodeSummit - Apex & Geode: In-memory streaming, storage & analytics
#GeodeSummit - Apex & Geode: In-memory streaming, storage & analytics
PivotalOpenSourceHub
Developing Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's Guide
Mohanraj Thirumoorthy
Spring boot - an introduction
Spring boot - an introduction
Jonathan Holloway
Developing Resilient Cloud Native Apps with Spring Cloud
Developing Resilient Cloud Native Apps with Spring Cloud
Dustin Ruehle
Tachyon and Apache Spark
Tachyon and Apache Spark
rhatr
Reactive streams
Reactive streams
codepitbull
xPatterns on Spark, Shark, Mesos, Tachyon
xPatterns on Spark, Shark, Mesos, Tachyon
Claudiu Barbura
More Related Content
What's hot
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and more
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and more
Legacy Typesafe (now Lightbend)
Samuele Resca - REACTIVE PROGRAMMING, DAMN. IT IS NOT ABOUT REACTJS - Codemot...
Samuele Resca - REACTIVE PROGRAMMING, DAMN. IT IS NOT ABOUT REACTJS - Codemot...
Codemotion
[Japanese] How Reactive Streams and Akka Streams change the JVM Ecosystem @ R...
[Japanese] How Reactive Streams and Akka Streams change the JVM Ecosystem @ R...
Konrad Malawski
Akka-chan's Survival Guide for the Streaming World
Akka-chan's Survival Guide for the Streaming World
Konrad Malawski
How Reactive Streams & Akka Streams change the JVM Ecosystem
How Reactive Streams & Akka Streams change the JVM Ecosystem
Konrad Malawski
Akka 2.4 plus new commercial features in Typesafe Reactive Platform
Akka 2.4 plus new commercial features in Typesafe Reactive Platform
Legacy Typesafe (now Lightbend)
Akka Streams in Action @ ScalaDays Berlin 2016
Akka Streams in Action @ ScalaDays Berlin 2016
Konrad Malawski
Architectural changes in the repo in 6.1 and beyond
Architectural changes in the repo in 6.1 and beyond
Stefan Kopf
What’s expected in Spring 5
What’s expected in Spring 5
Gal Marder
Do's and don'ts when deploying akka in production
Do's and don'ts when deploying akka in production
jglobal
End to End Akka Streams / Reactive Streams - from Business to Socket
End to End Akka Streams / Reactive Streams - from Business to Socket
Konrad Malawski
Lessons Learned From PayPal: Implementing Back-Pressure With Akka Streams And...
Lessons Learned From PayPal: Implementing Back-Pressure With Akka Streams And...
Lightbend
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...
Gal Marder
Exachk and oem12c
Exachk and oem12c
Bobby Curtis
Dropwizard and Groovy
Dropwizard and Groovy
tomaslin
#GeodeSummit - Apex & Geode: In-memory streaming, storage & analytics
#GeodeSummit - Apex & Geode: In-memory streaming, storage & analytics
PivotalOpenSourceHub
Developing Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's Guide
Mohanraj Thirumoorthy
Spring boot - an introduction
Spring boot - an introduction
Jonathan Holloway
Developing Resilient Cloud Native Apps with Spring Cloud
Developing Resilient Cloud Native Apps with Spring Cloud
Dustin Ruehle
What's hot
(19)
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and more
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and more
Samuele Resca - REACTIVE PROGRAMMING, DAMN. IT IS NOT ABOUT REACTJS - Codemot...
Samuele Resca - REACTIVE PROGRAMMING, DAMN. IT IS NOT ABOUT REACTJS - Codemot...
[Japanese] How Reactive Streams and Akka Streams change the JVM Ecosystem @ R...
[Japanese] How Reactive Streams and Akka Streams change the JVM Ecosystem @ R...
Akka-chan's Survival Guide for the Streaming World
Akka-chan's Survival Guide for the Streaming World
How Reactive Streams & Akka Streams change the JVM Ecosystem
How Reactive Streams & Akka Streams change the JVM Ecosystem
Akka 2.4 plus new commercial features in Typesafe Reactive Platform
Akka 2.4 plus new commercial features in Typesafe Reactive Platform
Akka Streams in Action @ ScalaDays Berlin 2016
Akka Streams in Action @ ScalaDays Berlin 2016
Architectural changes in the repo in 6.1 and beyond
Architectural changes in the repo in 6.1 and beyond
What’s expected in Spring 5
What’s expected in Spring 5
Do's and don'ts when deploying akka in production
Do's and don'ts when deploying akka in production
End to End Akka Streams / Reactive Streams - from Business to Socket
End to End Akka Streams / Reactive Streams - from Business to Socket
Lessons Learned From PayPal: Implementing Back-Pressure With Akka Streams And...
Lessons Learned From PayPal: Implementing Back-Pressure With Akka Streams And...
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...
Exachk and oem12c
Exachk and oem12c
Dropwizard and Groovy
Dropwizard and Groovy
#GeodeSummit - Apex & Geode: In-memory streaming, storage & analytics
#GeodeSummit - Apex & Geode: In-memory streaming, storage & analytics
Developing Microservices using Spring - Beginner's Guide
Developing Microservices using Spring - Beginner's Guide
Spring boot - an introduction
Spring boot - an introduction
Developing Resilient Cloud Native Apps with Spring Cloud
Developing Resilient Cloud Native Apps with Spring Cloud
Viewers also liked
Tachyon and Apache Spark
Tachyon and Apache Spark
rhatr
Reactive streams
Reactive streams
codepitbull
xPatterns on Spark, Shark, Mesos, Tachyon
xPatterns on Spark, Shark, Mesos, Tachyon
Claudiu Barbura
PSUG #52 Dataflow and simplified reactive programming with Akka-streams
PSUG #52 Dataflow and simplified reactive programming with Akka-streams
Stephane Manciot
Reactive programming on Android
Reactive programming on Android
Tomáš Kypta
Reactive Streams and RabbitMQ
Reactive Streams and RabbitMQ
mkiedys
Akka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based Applications
NLJUG
xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)
xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)
Claudiu Barbura
Micro services, reactive manifesto and 12-factors
Micro services, reactive manifesto and 12-factors
Dejan Glozic
12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM Deployment
Joe Kutner
Viewers also liked
(10)
Tachyon and Apache Spark
Tachyon and Apache Spark
Reactive streams
Reactive streams
xPatterns on Spark, Shark, Mesos, Tachyon
xPatterns on Spark, Shark, Mesos, Tachyon
PSUG #52 Dataflow and simplified reactive programming with Akka-streams
PSUG #52 Dataflow and simplified reactive programming with Akka-streams
Reactive programming on Android
Reactive programming on Android
Reactive Streams and RabbitMQ
Reactive Streams and RabbitMQ
Akka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based Applications
xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)
xPatterns ... beyond Hadoop (Spark, Shark, Mesos, Tachyon)
Micro services, reactive manifesto and 12-factors
Micro services, reactive manifesto and 12-factors
12 Factor App: Best Practices for JVM Deployment
12 Factor App: Best Practices for JVM Deployment
Similar to Reactive Jersey Client
Stream Analytics
Stream Analytics
Franco Ucci
JAX-RS.next
JAX-RS.next
Michal Gajdos
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck
Edward Burns
How to Thrive on REST/WebSocket-Based Microservices
How to Thrive on REST/WebSocket-Based Microservices
Pavel Bucek
HTTP/2 Comes to Java - What Servlet 4.0 Means to You
HTTP/2 Comes to Java - What Servlet 4.0 Means to You
David Delabassee
JAX RS and CDI bike the reactive bridge
JAX RS and CDI bike the reactive bridge
José Paumard
JAX RS 2.0 - OTN Bangalore 2013
JAX RS 2.0 - OTN Bangalore 2013
Jagadish Prasath
JAX-RS and CDI Bike the (Reactive) Bridge
JAX-RS and CDI Bike the (Reactive) Bridge
José Paumard
Oracle REST Data Services
Oracle REST Data Services
Chris Muir
Why Upgrade to Oracle Database 12c?
Why Upgrade to Oracle Database 12c?
DLT Solutions
QA standup - workload analysis
QA standup - workload analysis
Serghei Radov
Alta Disponibilidade no MySQL 5.7
Alta Disponibilidade no MySQL 5.7
MySQL Brasil
Real World Problem Solving Using Application Performance Management 10
Real World Problem Solving Using Application Performance Management 10
CA Technologies
112815 java ee8_davidd
112815 java ee8_davidd
Takashi Ito
Explore Advanced CA Release Automation Configuration Topics
Explore Advanced CA Release Automation Configuration Topics
CA Technologies
Jfokus 2017 Oracle Dev Cloud and Containers
Jfokus 2017 Oracle Dev Cloud and Containers
Mika Rinne
(ZDM) Zero Downtime DB Migration to Oracle Cloud
(ZDM) Zero Downtime DB Migration to Oracle Cloud
Ruggero Citton
Oracle Cloud Platform - Migrer vers la Database 12c
Oracle Cloud Platform - Migrer vers la Database 12c
Bastien Leblanc
Coherence 12.1.2 Live Events
Coherence 12.1.2 Live Events
harvraja
Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...
Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...
Codemotion Tel Aviv
Similar to Reactive Jersey Client
(20)
Stream Analytics
Stream Analytics
JAX-RS.next
JAX-RS.next
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck
How to Thrive on REST/WebSocket-Based Microservices
How to Thrive on REST/WebSocket-Based Microservices
HTTP/2 Comes to Java - What Servlet 4.0 Means to You
HTTP/2 Comes to Java - What Servlet 4.0 Means to You
JAX RS and CDI bike the reactive bridge
JAX RS and CDI bike the reactive bridge
JAX RS 2.0 - OTN Bangalore 2013
JAX RS 2.0 - OTN Bangalore 2013
JAX-RS and CDI Bike the (Reactive) Bridge
JAX-RS and CDI Bike the (Reactive) Bridge
Oracle REST Data Services
Oracle REST Data Services
Why Upgrade to Oracle Database 12c?
Why Upgrade to Oracle Database 12c?
QA standup - workload analysis
QA standup - workload analysis
Alta Disponibilidade no MySQL 5.7
Alta Disponibilidade no MySQL 5.7
Real World Problem Solving Using Application Performance Management 10
Real World Problem Solving Using Application Performance Management 10
112815 java ee8_davidd
112815 java ee8_davidd
Explore Advanced CA Release Automation Configuration Topics
Explore Advanced CA Release Automation Configuration Topics
Jfokus 2017 Oracle Dev Cloud and Containers
Jfokus 2017 Oracle Dev Cloud and Containers
(ZDM) Zero Downtime DB Migration to Oracle Cloud
(ZDM) Zero Downtime DB Migration to Oracle Cloud
Oracle Cloud Platform - Migrer vers la Database 12c
Oracle Cloud Platform - Migrer vers la Database 12c
Coherence 12.1.2 Live Events
Coherence 12.1.2 Live Events
Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...
Pushing JavaEE outside of the enterprise: Home Automation & IoT - David Delab...
Recently uploaded
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
qr0udbr0
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
umasea
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
andrehoraa
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
Velvetech LLC
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Cizo Technology Services
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
preethippts
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
Hironori Washizaki
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
confluent
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
Cyber security and its impact on E commerce
Cyber security and its impact on E commerce
manigoyal112
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
Christian Birchler
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
FerryKemperman
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
Tier1 app
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
Hr365.us smith
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
BradBedford3
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
Andreas Granig
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
Lionel Briand
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
OnePlan Solutions
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
Philip Schwarz
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
Hanief Utama
Recently uploaded
(20)
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Cyber security and its impact on E commerce
Cyber security and its impact on E commerce
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
Reactive Jersey Client
1.
Reac%ve Jersey Client
Michal Gajdos michal.gajdos@oracle.com January, 2015 Copyright © 2014, Oracle and/or its affiliates. All rights reserved.
2.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Safe Harbor Statement The following is intended to outline our general product direc%on. It is intended for informa%on purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or func%onality, and should not be relied upon in making purchasing decisions. The development, release, and %ming of any features or func%onality described for Oracle’s products remains at the sole discre%on of Oracle.
3.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. The Problem A Travel Agency
4.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. A Travel Agency Service Orchestra%ng Services Weather Customers Des%na%ons Quo%ng Travel Agency
5.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. The Why
6.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. The Why • Client specific API – Different needs for various devices: screen size, payment methods, ... • Single Entry Point – No need to communicate with mul%ple services • Thinner client – No need to consume different formats of data • Less frequent client updates – Doesn’t ma]er if one service is removed in favor of another service Building an Orchestra6on Layer
7.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. The How JAX-‐RS 2.0 and Jersey 2
8.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Demo Applica%on • “Remote” – applica%on/json, applica%on/xml – delays • “Agent” – applica%on/json – dependent calls Exposed resources
9.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. A Naïve Approach Implemen%ng the Service Get Customer Details Get a list of 10 Recommended Des6na6ons Get Quote for the Customer Get Weather Forecast for each Des6na6on for each Des6na6on
10.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Client client = ClientBuilder.newClient(); WebTarget rx = client.target("http://example.com/rx").register(JacksonFeature.class); WebTarget forecasts = rx.path("remote/forecast/{destination}"); Forecast forecast = forecasts.resolveTemplate("destination", dest.getDestination()) .request("application/xml") .get(Forecast.class); JAX-‐RS 2.0 Client – Synchronous
11.
Copyright © 2014,
Oracle and/or its affiliates. All rights reserved. DEMO
12.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. A Naïve Approach Implemen%ng the Service Get Customer Details Get a list of 10 Recommended Des6na6ons Get Quote for the Customer Get Weather Forecast for each Des6na6on for each Des6na6on 150 ms 250 ms 1 700 ms 170 ms 3 300 ms 330 ms 5 400 ms
13.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Client – Synchronous Approach • Easy to read, understand and debug – Simple requests, Composed requests • Slow – Sequen%al processing even for independent requests • Was%ng resources – Wai%ng threads • Suitable for – Lower number of requests – Single request that depends on the result of previous opera%on
14.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Op6mized Approach Implemen%ng the Service 170 ms Get Customer Details Get a list of 10 Recommended Des6na6ons Async Get Quote for the Customer Async Get Weather Forecast for each Des6na6on for each Des6na6on 150 ms 250 ms 330 ms 330 ms 730 ms
15.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Future<Forecast> forecast = forecasts.resolveTemplate("destination", d.getDestination()) .request() .async() .get(new InvocationCallback<Forecast>() { @Override public void completed(Forecast forecast) { // Do Something. } @Override public void failed(Throwable throwable) { // Do Something else. } }); while (!forecast.isDone()) { // Do Something. } System.out.println(forecast.get()); JAX-‐RS 2.0 Client – Asynchronous
16.
Copyright © 2014,
Oracle and/or its affiliates. All rights reserved. DEMO
17.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Client – Asynchronous Approach • Returns immediately afer submigng a request – Future • Harder to understand, debug – Especially when dealing with mul%ple futures • Fast – Each request can run on a separate thread – Need to ac%vely check for comple%on event (future.isDone()) or block (slow) Futures
18.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Client – Asynchronous Approach • “Don’t call us, we’ll call you” • Harder to read, understand and debug – Especially for composed calls (dependent) • Need to find out when all Async requests finished – Relevant only for 2 or more requests (CountDownLatch) • Fast – Each request can run on a separate thread • Suitable for – Many independent calls The Callback Hell
19.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Beyond The Callback Hell Reac6ve (Jersey) Client
20.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Client – Reac%ve Approach • Data-‐Flows – Execu%on model propagates changes through the flow • Asynchronous – Preferably, Speed • Event-‐based – No%fy user code or another item in flow about con%nua%on, error, comple%on • Composable – Compose/Transform mul%ple flows into the resul%ng one
21.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Reac%ve Java Libraries • RxJava – Observable – Analogy to Iterable – Currently most advanced reac%ve API in Java – Contributed by Nemlix – hardened & tested in produc%on • Java SE 8 – CompletionStage and CompletableFuture – Na%ve part of JDK – Fits the new Java Stream API programming model – JSR166e – Support for CompletableFuture on Java SE 6 and Java SE 7 • Guava – ListenableFuture and Futures – Similar to Java SE 8
22.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Observable • Observable (push) – retrieve data – onNext(T) – discover error – onError(Exception) – complete – onCompleted() • Iterable (pull) – retrieve data – T next() – discover error – throws Exception – complete – !hasNext()
23.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Observable<Response> response = … ; List<String> visited = new ArrayList<>(10); // Read a list of destinations from JAX-‐RS response response.map(resp -‐> resp.readEntity(new GenericType<List<Destination>>() {})) // If an exception is thrown, continue with an empty list .onErrorReturn(throwable -‐> Collections.emptyList()) // Emit list of destinations as a new Observable .flatMap(Observable::from) // Take the first 10 destinations .take(10) // Obtain a string representation of a destination .map(Destination::getDestination) // Observe the destination events on a separate thread .observeOn(Schedulers.io()) // Subscribe to callbacks – OnNext, OnError, OnComplete .subscribe(visited::add, async::resume, () -‐> async.resume(visited)); An Observable<Response> Example
24.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Reac%ve Jersey Client • Remember #request() and #request().async() ? – request() returns Invoca6on.Builder; SyncInvoker – sync HTTP methods – request().async() returns AsyncInvoker – async HTTP methods • #rx() and #rx(ExecutorService) – Return an extension of RxInvoker Extension of JAX-‐RS Client
25.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. public interface SyncInvoker { Response get(); <T> T get(Class<T> responseType); <T> T get(GenericType<T> responseType); // ... } public interface AsyncInvoker { Future<Response> get(); <T> Future<T> get(Class<T> responseType); <T> Future<T> get(GenericType<T> responseType); // ... } SyncInvoker and AsyncInvoker
26.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. public interface RxInvoker<T> { T get(); <R> T get(Class<R> responseType); <R> T get(GenericType<R> responseType); // ... } public interface RxObservableInvoker extends RxInvoker<Observable> { Observable<Response> get(); <T> Observable<T> get(Class<T> responseType); <T> Observable<T> get(GenericType<T> responseType); // ... } RxInvoker and an extension Example
27.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Reac%ve Jersey Client – contd • Affected JAX-‐RS interfaces – RxInvoca%onBuilder<RX extends RxInvoker> extends Invoca%on.Builder – RxWebTarget<RX extends RxInvoker> extends WebTarget – RxClient<RX extends RxInvoker> extends Client • Rx class – RxObservable – RxComple%onStage – RxListenableFuture – RxCompletableFuture (JSR 166e) Extension of JAX-‐RS Client
28.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Client client = ClientBuilder.newClient(); WebTarget target = client.target("..."); // Rx RxClient<RxObservableInvoker> rxClient = Rx.newClient(RxObservableInvoker.class); RxClient<RxObservableInvoker> rxClient = Rx.client(client, RxObservableInvoker.class); RxWebTarget<RxObservableInvoker> rxTarget = Rx.target(target, RxObservableInvoker.class); // RxObservable RxClient<RxObservableInvoker> rxClient = RxObservable.newClient(); RxClient<RxObservableInvoker> rxClient = RxObservable.client(client); RxWebTarget<RxObservableInvoker> rxTarget = RxObservable.target(target); Reac%ve Client – Crea%on
29.
Copyright © 2014,
Oracle and/or its affiliates. All rights reserved. DEMO
30.
Copyright © 2014,
Oracle and/or its affiliates. All rights reserved. Q&A
31.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Resources • JAX-‐RS Client API – h]ps://jax-‐rs-‐spec.java.net/nonav/2.0/apidocs/overview-‐summary.html – h]ps://jersey.java.net/documenta%on/latest/client.html • Jersey Rx Client – h]ps://github.com/jersey/jersey/tree/master/incubator/rx/rx-‐client – h]ps://github.com/jersey/jersey/tree/master/incubator/rx/rx-‐client-‐guava – h]ps://github.com/jersey/jersey/tree/master/incubator/rx/rx-‐client-‐java8 – h]ps://github.com/jersey/jersey/tree/master/incubator/rx/rx-‐client-‐jsr166e – h]ps://github.com/jersey/jersey/tree/master/incubator/rx/rx-‐client-‐rxjava JAX-‐RS and Jersey
32.
Copyright © 2015,
Oracle and/or its affiliates. All rights reserved. Resources • 3rd party libraries – h]ps://code.google.com/p/guava-‐libraries/ – h]ps://github.com/Reac%veX/RxJava – h]p://docs.oracle.com/javase/8/docs/api/java/u%l/concurrent/package-‐ summary.html – h]p://gee.cs.oswego.edu/dl/concurrency-‐interest/index.html • Example (JDK7) – h]ps://github.com/jersey/jersey/tree/master/examples/rx-‐client-‐webapp Example and Libraries
Download now