JAX-RS and CDI Bike the Reactive Bridge!
summary
JAX-RS 2.1 plus CDI 2.0 and Java 8 CompletionStage let synchronous REST code become nonblocking by replacing blocking get/callback patterns with composable futures. The client reactive invoker returns CompletionStage chains using thenApply/thenCompose/thenCombine to parallelize per-destination weather/quote calls, gather many sub-futures into one, and handle errors with exceptionally/handle/whenComplete. Server resource methods return CompletionStage or use AsyncResponse.resume so request threads free quickly. Jersey also exposes JAX-RS 2.1 reactive invoker and adapters for Guava/RxJava and supports CDI asynchronous events.
AI-written summary · about
chapters (13)
- 0:00Start
- 3:06The Reactive Manifesto
- 5:18Client-Side Api of Jax-Rs
- 5:50Web Target
- 8:53Invocation Callback
- 12:04Using the Jax-Rs-Api
- 13:25Reactive Invoker
- 20:32Apply Method
- 25:16Levels of Computable Futures
- 28:50Execute Execution Flow
- 34:14End all Exception
- 39:07Synchronous Event
- 47:43The Jax-Rs Specification
related talks
50mJAX-RS 2.1 Reloaded
43mRESTful Java with JAX-RS 2.0 and Jersey
43mRESTEasy beyond JAX-RS 2.1: reactive, non-blocking IO and more
38mHow to bake reactive behavior into your Java EE applications
17mJAX-RS 2.1: Preview and Practical Insights on the New REST Service APIs
38mBest Practices in Reactive Application with Java 1.8 and Play
01h 01mReactive web services
48mReactive for the Impatient
